From: Steven H. Wang Date: Mon, 20 Mar 2017 20:07:02 +0000 (-0700) Subject: add NSH ethertype X-Git-Tag: tcpdump-4.99-bp~2065 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/99f6d01b24d037f4d69ad098f085d98e3d1b73b4 add NSH ethertype https://tools.ietf.org/html/draft-ietf-sfc-nsh-12#section-12.1 --- diff --git a/ethertype.h b/ethertype.h index 2aa53a08..f38ec8e4 100644 --- a/ethertype.h +++ b/ethertype.h @@ -145,6 +145,9 @@ #ifndef ETHERTYPE_PPPOES #define ETHERTYPE_PPPOES 0x8864 #endif +#ifndef ETHERTYPE_NSH +#define ETHERTYPE_NSH 0x894F +#endif #ifndef ETHERTYPE_PPPOED2 #define ETHERTYPE_PPPOED2 0x3c12 #endif diff --git a/print-ether.c b/print-ether.c index bbfd7e96..57c07ce9 100644 --- a/print-ether.c +++ b/print-ether.c @@ -72,6 +72,7 @@ const struct tok ethertype_values[] = { { ETHERTYPE_RRCP, "RRCP" }, { ETHERTYPE_MS_NLB_HB, "MS NLB heartbeat" }, { ETHERTYPE_JUMBO, "Jumbo" }, + { ETHERTYPE_NSH, "NSH" }, { ETHERTYPE_LOOPBACK, "Loopback" }, { ETHERTYPE_ISO, "OSI" }, { ETHERTYPE_GRE_ISO, "GRE-OSI" }, @@ -408,6 +409,10 @@ ethertype_print(netdissect_options *ndo, lldp_print(ndo, p, length); return (1); + case ETHERTYPE_NSH: + nsh_print(ndo, p, length); + return (1); + case ETHERTYPE_LOOPBACK: loopback_print(ndo, p, length); return (1); diff --git a/tests/TESTLIST b/tests/TESTLIST index ba29da40..38e3e64f 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -361,7 +361,9 @@ pcap-invalid-version-2 pcap-invalid-version-2.pcap pcap-invalid-version-2.out -t pcap-ng-invalid-vers-1 pcap-ng-invalid-vers-1.pcap pcap-ng-invalid-vers-1.out -t pcap-ng-invalid-vers-2 pcap-ng-invalid-vers-2.pcap pcap-ng-invalid-vers-2.out -t -# NSH over VxLAN-GPE +# NSH tests +nsh nsh.pcap nsh.out -t +nsh-vvv nsh.pcap nsh-vvv.out -t -vvv nsh-over-vxlan-gpe nsh-over-vxlan-gpe.pcap nsh-over-vxlan-gpe.out -t nsh-over-vxlan-gpe-v nsh-over-vxlan-gpe.pcap nsh-over-vxlan-gpe-v.out -t -v nsh-over-vxlan-gpe-vv nsh-over-vxlan-gpe.pcap nsh-over-vxlan-gpe-vv.out -t -vv diff --git a/tests/nsh-vvv.out b/tests/nsh-vvv.out new file mode 100644 index 00000000..43967119 --- /dev/null +++ b/tests/nsh-vvv.out @@ -0,0 +1,7 @@ +NSH, ver 0, flags [none], length 6, md type 0x1, next-protocol 0x1, service-path-id 0x000309, service-index 0x7 + Context[00]: 0x00000001 + Context[01]: 0x00000002 + Context[02]: 0x00000003 + Context[03]: 0x00000004 + IP (tos 0x0, ttl 64, id 10308, offset 0, flags [DF], proto UDP (17), length 34) + 10.0.8.3.52229 > 10.13.13.13.8000: [no cksum] UDP, length 6 diff --git a/tests/nsh.out b/tests/nsh.out new file mode 100644 index 00000000..1c6a4cda --- /dev/null +++ b/tests/nsh.out @@ -0,0 +1 @@ +NSH, flags [none], service-path-id 0x000309, service-index 0x7: IP 10.0.8.3.52229 > 10.13.13.13.8000: UDP, length 6 diff --git a/tests/nsh.pcap b/tests/nsh.pcap new file mode 100644 index 00000000..c919ee23 Binary files /dev/null and b/tests/nsh.pcap differ