다음과 같이 scapy를 이용해서 fragment를 쉽게 만들 수 있다.
from scapy.all import * dip="10.0.0.1" payload=" "*1000 packet=IP(dst=dip)/UDP(dport=0x1234)/payload frag_list=fragment(packet,fragsize=500) counter=1 for fragment in frag_list: print "Packet no%d" %counter print fragment.show() counter+=1 send(fragment) frag_list에서 counter 변수를 확인해서 전송하지 않으면 간단하게 fragment가 수신되지 않은 경우에 시험할 수 있음.
필요하면 frag_list의 순서를 뒤집는 것도 가능하고, 각 fragment의 offset값을 조정하거나 패킷 크기를 변경하면 다른 비정상 경우도 쉽게 시험할 수 있다.
scapy interactive tutorial
Vagrant
fd.io의 개발 환경 구성하는 문서를 보니 vagrant를 사용한다. 그런데 또 virtualbox니 vmware 이야기를 한다. 이전에도 vagrant라는 단어를 들어본적이 있었는데 이번 기회에 좀 알아보기로
Why Vagrant를 보면 다음과 같이 설명하고 있다.
Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.
To achieve its magic, Vagrant stands on the shoulders of giants.
├── build-data │ ├── packages │ └── platforms ├── build-root │ ├── deb │ │ └── debian │ │ └── source │ ├── emacs-lisp │ ├── packages │ ├── rpm │ ├── scripts │ └── vagrant ├── dpdk │ ├── dkms │ ├── dpdk-2.1.0_patches │ └── dpdk-2.2.0_patches ├── g2 ├── gmod │ └── gmod ├── perftool ├── sample-plugin │ └── sample ├── svm ├── test │ ├── resources │ │ ├── libraries │ │ │ ├── bash │ │ │ ├── python │ │ │ └── robot │ │ │ └── vat │ │ └── templates │ │ └── vat │ └── tests │ └── suites │ ├── bridge_domain │ └── vhost_user_dummy ├── vlib │ ├── example │ └── vlib │ └── unix ├── vlib-api │ ├── vlibapi │ ├── vlibmemory │ └── vlibsocket ├── vnet │ ├── etc │ │ └── scripts │ │ ├── dhcp │ │ ├── ludd-cluster-1 │ │ ├── ludd-cluster-3 │ │ ├── mpls-o-ethernet │ │ ├── mpls-o-gre │ │ ├── sr │ │ └── virl │ └── vnet │ ├── cdp │ ├── classify │ ├── devices │ │ ├── dpdk │ │ ├── ssvm │ │ └── virtio │ ├── dhcp │ ├── dhcpv6 │ ├── ethernet │ ├── flow │ ├── gre │ ├── hdlc │ ├── ip │ ├── ipsec │ ├── l2 │ ├── l2tp │ ├── lawful-intercept │ ├── lisp-gpe │ ├── llc │ ├── map │ │ └── examples │ ├── mcast │ ├── mpls-gre │ ├── nsh-gre │ ├── nsh-vxlan-gpe │ ├── osi │ ├── pg │ ├── plugin │ ├── policer │ ├── ppp │ ├── snap │ ├── sr │ ├── srp │ ├── unix │ ├── vcgn │ └── vxlan ├── vpp │ ├── api │ ├── app │ ├── conf │ ├── oam │ ├── stats │ └── vnet ├── vpp-api-test │ ├── scripts │ └── vat ├── vpp-japi │ ├── japi │ │ ├── org │ │ │ └── openvpp │ │ │ └── vppjapi │ │ └── test │ └── m4 ├── vppapigen └── vppinfra ├── config ├── tools └── vppinfra
2016년 2월 11일 공개된 CISCO 주도의 프로젝트. 무려 2002년부터 개발한 것으로 현재 버전은 3번째 revision이라고 한다.
간만에 dpdk.org mailing list에 들어갔다 가장 최근에 올라온 글 제목이 눈에 띄었다.
[dpdk-dev] [dpdk-announce] new project using DPDK - FD.io Vincent JARDIN
“new project”?
그래서 내용을 봤더니 이게 다 였다는
A new project using DPDK is available, http://FD.io said FiDo You can clone it from: http://gerrit.fd.io/ Best regards, Vincent 그래도 첫 번째 링크를 따라가 보니 화려하다.
왜 공부해야 하는가
사회의 변화속도는 우리의 변화속도를 압도하기 때문입니다.
<누가 내 치즈를 옮겼을까>에 잘 묘사되어 있지요.
따라잡지 않으면 뒤쳐지기 때문에 우리는 늘 공부해야 합니다.
https://brunch.co.kr/@choihs0228/4
constructor attribute http://phoxis.org/2011/04/27/c-language-constructors-and-destructors-with-gcc/
constructor attribute을 가진 함수는 main 함수를 실행하기 전에 호출한다.
예제 (출처)
#include <stdio.h> void begin (void) __attribute__((constructor)); void end (void) __attribute__((destructor)); int main (void) { printf ("\nInside main ()"); } void begin (void) { printf ("\nIn begin ()"); } void end (void) { printf ("\nIn end ()\n"); } 실행하면
In begin () Inside main () In end () DPDK DPDK의 경우 device driver들을 모두 constructor attirbute을 사용해서 main 함수 전에 호출되록 한다.
Introducing Python 을 판교어린이도서관에서 짧게 보고 적은 아이템들
python3 based
Decorator는 공부가 필요한 내용
sys.path : module 검색 경로 __init__.py 파일이 있으면 그 디렉토리를 PKG로 간주함
defaultdic()
Counters()
dicionary는 key의 순서를 보장하지 않음. OrderedDict()로 사전을 정의하면 가능 deque = stack + queue pprint()는 print보다 깔끔하게 출력한다고.
'\uXXX' 유니코드
%10.4s : 10칸의 공간. 문자열 중 4개만 출력
struct '>LL' : '>' Big endian, L : uint32_t
list comprehension : for loop보다 빠름.
SR-IOV and DPDK
Accelerating the NFV Data Plane : SR-IOV and DPDK… in my own words 를 읽고 요약
Before HW assisted Virtualisation SR-IOV 전까지는 VMM이 패킷 송수신에 매번 개입해야 했음.
1st interrupt from NIC to VMM 2nd interrupt from VMM to VM Intel VMDq Only one interrupt from NIC to VM as each VM has its own Rx queue.
SR-IOV SR-IOV : Standard IO memory Memory Management Unit from Intel(VT-d) and AMD(IOV) Virtual Function - Limited, lightweight, PCIe resource and a dedicated Tx/Rx packet queue Interrupt 부담이 없다고 하는데 왜?
pktmbuf_offload pool은 rte_pktmbuf_offload_pool_create()를 사용하여 생성 l2fwd_mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "mbuf_offload_pool", NB_MBUF, 128, 0, rte_socket_id()); 할당은 rte_pktmbuf_offload_alloc()를 이용. rte_pktmbuf_offload_alloc(l2fwd_mbuf_ol_pool, RTE_PKTMBUF_OL_CRYPTO); mbuf 마다 하나씩 할당해서 crypto 연산에 사용 crypto 연산에 필요한 추가 옵션 등을 설정함. /* Append space for digest to end of packet */ ol->op.crypto.digest.data = (uint8_t *)rte_pktmbuf_append(m, cparams->digest_length); ol->op.crypto.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, rte_pktmbuf_pkt_len(m) - cparams->digest_length); ol->op.crypto.digest.length = cparams->digest_length; ol->op.crypto.iv.data = cparams->iv_key.data; ol->op.crypto.iv.phys_addr = cparams->iv_key.phys_addr; ol->op.crypto.iv.length = cparams->iv_key.length; ol->op.crypto.data.to_cipher.offset = ipdata_offset; ol->op.crypto.data.to_cipher.length = data_len; ol->op.
2016.02.10 기준
DPDK-dump TRex - Realistic traffic generator
git-hub - trex-core, trex-doc, trex-profiles, trex-qt-gui Packet-journey git-hub FD.io Fast Data Path DPDK-nginx DPDK-pktgen DPDK-ODP TCP/IP stack for DPDK