Skip to content

Commit

Permalink
Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git…
Browse files Browse the repository at this point in the history
…/tcpdump
  • Loading branch information
guyharris committed Dec 11, 2012
2 parents cbac6ce + 1f59859 commit 05bf602
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ tcpdump
tcpdump.1
tcpdump-*.tar.gz
version.c
failure-outputs.txt
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
language: c

env:
- BUILD_LIBPCAP=true
- BUILD_LIBPCAP=false

before_script:
- sudo apt-get install libpcap-dev libssl-dev libssl0.9.8 libssl1.0.0
- sudo apt-get install libssl-dev libssl0.9.8 libssl1.0.0
- if [ $BUILD_LIBPCAP == "true" ]; then ( cd ../ && git clone https://github.com/mcr/libpcap.git && cd libpcap && ./configure && make ); else sudo apt-get install libpcap-dev; fi

script:
- ./configure
Expand Down
25 changes: 13 additions & 12 deletions print-dhcp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
/*
* RFC3315: DHCPv6
* supported DHCPv6 options:
* RFC3319,
* RFC3633,
* RFC3646,
* RFC3898,
* RFC4075,
* RFC4242,
* RFC4280,
* RFC6334,
* RFC3319: Session Initiation Protocol (SIP) Servers options,
* RFC3633: IPv6 Prefix options,
* RFC3646: DNS Configuration options,
* RFC3898: Network Information Service (NIS) Configuration options,
* RFC4075: Simple Network Time Protocol (SNTP) Configuration option,
* RFC4242: Information Refresh Time option,
* RFC4280: Broadcast and Multicast Control Servers options,
* RFC6334: Dual-Stack Lite option,
*/

#ifndef lint
Expand Down Expand Up @@ -342,6 +342,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
if (ep < cp + sizeof(*dh6o))
goto trunc;
dh6o = (struct dhcp6opt *)cp;
TCHECK(*dh6o);
optlen = EXTRACT_16BITS(&dh6o->dh6opt_len);
if (ep < cp + sizeof(*dh6o) + optlen)
goto trunc;
Expand Down Expand Up @@ -414,7 +415,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
EXTRACT_32BITS(&tp[20]));
if (optlen > 24) {
/* there are sub-options */
dhcp6opt_print(tp + 24, tp + 24 + optlen);
dhcp6opt_print(tp + 24, tp + optlen);
}
printf(")");
break;
Expand Down Expand Up @@ -614,7 +615,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
EXTRACT_32BITS(&tp[8]));
if (optlen > 12) {
/* there are sub-options */
dhcp6opt_print(tp + 12, tp + 12 + optlen);
dhcp6opt_print(tp + 12, tp + optlen);
}
printf(")");
break;
Expand All @@ -627,7 +628,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
printf(" IAID:%u", EXTRACT_32BITS(tp));
if (optlen > 4) {
/* there are sub-options */
dhcp6opt_print(tp + 4, tp + 4 + optlen);
dhcp6opt_print(tp + 4, tp + optlen);
}
printf(")");
break;
Expand All @@ -643,7 +644,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
EXTRACT_32BITS(&tp[4]));
if (optlen > 25) {
/* there are sub-options */
dhcp6opt_print(tp + 25, tp + 25 + optlen);
dhcp6opt_print(tp + 25, tp + optlen);
}
printf(")");
break;
Expand Down
14 changes: 12 additions & 2 deletions tcpdump.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ tcpdump \- dump traffic on a network
.I file
]
[
.B \-V
.I file
]
[
.B \-s
.I snaplen
]
Expand Down Expand Up @@ -127,8 +131,10 @@ flag, which causes it to save the packet data to a file for later
analysis, and/or with the
.B \-r
flag, which causes it to read from a saved packet file rather than to
read packets from a network interface. In all cases, only packets that
match
read packets from a network interface. It can also be run with the
.B \-V
flag, which causes it to read a list of saved packet files. In all cases,
only packets that match
.I expression
will be processed by
.IR tcpdump .
Expand Down Expand Up @@ -594,6 +600,10 @@ With
.B \-X
Telnet options are printed in hex as well.
.TP
.B \-V
Read a list of filenames from \fIfile\fR. Standard input is used
if \fIfile\fR is ``-''.
.TP
.B \-w
Write the raw packets to \fIfile\fR rather than parsing and printing
them out.
Expand Down
3 changes: 3 additions & 0 deletions tests/TESTLIST
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ ripv2_auth ripv2_auth.pcap ripv2_auth.out -t -v

# DHCPv6 tests
dhcpv6-aftr-name dhcpv6-AFTR-Name-RFC6334.pcap dhcpv6-AFTR-Name-RFC6334.out -t -v
dhcpv6-ia-na dhcpv6-ia-na.pcap dhcpv6-ia-na.out -t -v
dhcpv6-ia-pd dhcpv6-ia-pd.pcap dhcpv6-ia-pd.out -t -v
dhcpv6-ia-ta dhcpv6-ia-ta.pcap dhcpv6-ia-ta.out -t -v
6 changes: 3 additions & 3 deletions tests/dhcpv6-AFTR-Name-RFC6334.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 56) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=d81eb8 (client-ID hwaddr type 1 000102030405) (option-request DNS-server AFTR-Name) (elapsed-time 0) (IA_PD IAID:33752069 T1:3600 T2:5400))
IP6 (hlim 64, next-header UDP (17) payload length: 142) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 advertise (xid=d81eb8 (IA_PD IAID:33752069 T1:150 T2:250 (IA_PD-prefix 2a00:1:1:100::/56 pltime:250 vltime:300)[|dhcp6ext]) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (preference 10) (DNS-server 2a01::1) (AFTR-Name aftr-name.mydomain.net))
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 103) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=1e291d (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (option-request DNS-server AFTR-Name) (elapsed-time 0) (IA_PD IAID:33752069 T1:3600 T2:5400 (IA_PD-prefix 2a00:1:1:100::/56 pltime:7200 vltime:7500) (opt_0) (opt_0)[|dhcp6ext]))
IP6 (hlim 64, next-header UDP (17) payload length: 142) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 reply (xid=1e291d (IA_PD IAID:33752069 T1:150 T2:250 (IA_PD-prefix 2a00:1:1:100::/56 pltime:250 vltime:300)[|dhcp6ext]) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (preference 10) (DNS-server 2a01::1) (AFTR-Name aftr-name.mydomain.net))
IP6 (hlim 64, next-header UDP (17) payload length: 142) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 advertise (xid=d81eb8 (IA_PD IAID:33752069 T1:150 T2:250 (IA_PD-prefix 2a00:1:1:100::/56 pltime:250 vltime:300)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (preference 10) (DNS-server 2a01::1) (AFTR-Name aftr-name.mydomain.net))
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 103) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=1e291d (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (option-request DNS-server AFTR-Name) (elapsed-time 0) (IA_PD IAID:33752069 T1:3600 T2:5400 (IA_PD-prefix 2a00:1:1:100::/56 pltime:7200 vltime:7500)))
IP6 (hlim 64, next-header UDP (17) payload length: 142) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 reply (xid=1e291d (IA_PD IAID:33752069 T1:150 T2:250 (IA_PD-prefix 2a00:1:1:100::/56 pltime:250 vltime:300)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 406802160 001122334455) (preference 10) (DNS-server 2a01::1) (AFTR-Name aftr-name.mydomain.net))
4 changes: 4 additions & 0 deletions tests/dhcpv6-ia-na.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 56) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=90b45c (client-ID hwaddr type 1 000102030405) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_NA IAID:33752069 T1:3600 T2:5400))
IP6 (hlim 64, next-header UDP (17) payload length: 88) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 advertise (xid=90b45c (IA_NA IAID:33752069 T1:3600 T2:5400 (IA_ADDR 2a00:1:1:200:38e6:b22e:c440:acdf pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259276 001122334455))
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 102) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=2ffdd1 (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259276 001122334455) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_NA IAID:33752069 T1:3600 T2:5400 (IA_ADDR 2a00:1:1:200:38e6:b22e:c440:acdf pltime:7200 vltime:7500)))
IP6 (hlim 64, next-header UDP (17) payload length: 88) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 reply (xid=2ffdd1 (IA_NA IAID:33752069 T1:3600 T2:5400 (IA_ADDR 2a00:1:1:200:38e6:b22e:c440:acdf pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259276 001122334455))
Binary file added tests/dhcpv6-ia-na.pcap
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/dhcpv6-ia-pd.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 56) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=e1e093 (client-ID hwaddr type 1 000102030405) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_PD IAID:33752069 T1:3600 T2:5400))
IP6 (hlim 64, next-header UDP (17) payload length: 89) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 advertise (xid=e1e093 (IA_PD IAID:33752069 T1:3600 T2:5400 (IA_PD-prefix 2a00:1:1:100::/56 pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259545 001122334455))
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 103) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=12b08a (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259545 001122334455) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_PD IAID:33752069 T1:3600 T2:5400 (IA_PD-prefix 2a00:1:1:100::/56 pltime:7200 vltime:7500)))
IP6 (hlim 64, next-header UDP (17) payload length: 89) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 reply (xid=12b08a (IA_PD IAID:33752069 T1:3600 T2:5400 (IA_PD-prefix 2a00:1:1:100::/56 pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259545 001122334455))
Binary file added tests/dhcpv6-ia-pd.pcap
Binary file not shown.
4 changes: 4 additions & 0 deletions tests/dhcpv6-ia-ta.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 48) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=28b040 (client-ID hwaddr type 1 000102030405) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_TA IAID:33752069))
IP6 (hlim 64, next-header UDP (17) payload length: 80) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 advertise (xid=28b040 (IA_TA IAID:33752069 (IA_ADDR 2a00:1:1:200:5da2:f920:84c4:88cc pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259120 001122334455))
IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 94) fe80::201:2ff:fe03:405.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=2b0e45 (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259120 001122334455) (option-request DNS-server DNS-search-list) (elapsed-time 0) (IA_TA IAID:33752069 (IA_ADDR 2a00:1:1:200:5da2:f920:84c4:88cc pltime:7200 vltime:7500)))
IP6 (hlim 64, next-header UDP (17) payload length: 80) fe80::211:22ff:fe33:4455.547 > fe80::201:2ff:fe03:405.546: [udp sum ok] dhcp6 reply (xid=2b0e45 (IA_TA IAID:33752069 (IA_ADDR 2a00:1:1:200:5da2:f920:84c4:88cc pltime:4500 vltime:7200)) (client-ID hwaddr type 1 000102030405) (server-ID hwaddr/time type 1 time 407259120 001122334455))
Binary file added tests/dhcpv6-ia-ta.pcap
Binary file not shown.

0 comments on commit 05bf602

Please sign in to comment.