diff options
author | Denis Ovsienko <infrastation@yandex.ru> | 2013-11-12 17:10:33 +0400 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2013-11-13 15:49:50 +0400 |
commit | d00d1670cec6b90d8b8e94c2b6b37f5a08d0ce17 (patch) | |
tree | a5505130b9540b74259cfe228688b9ae6ef6631a | |
parent | 7be1e976c946be21b8ca3b5a77efa21c32f2516f (diff) | |
download | tcpdump-d00d1670cec6b90d8b8e94c2b6b37f5a08d0ce17.tar.gz |
AHCP: add version 1 decoder
Add new decoder for UDP port 5359 and a sample packet capture produced
on a couple of Linux hosts (a server and a client). Besides that, an
existing Babel capture contained AHCP packets and the current AHCP tests
cover 0, 1 and 2 "-v" flags.
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | interface.h | 1 | ||||
-rw-r--r-- | print-ahcp.c | 401 | ||||
-rw-r--r-- | print-udp.c | 2 | ||||
-rw-r--r-- | tests/TESTLIST | 3 | ||||
-rw-r--r-- | tests/ahcp-vv.out | 76 | ||||
-rw-r--r-- | tests/ahcp.pcap | bin | 0 -> 1784 bytes | |||
-rw-r--r-- | tests/babel1.out | 16 | ||||
-rw-r--r-- | tests/babel1v.out | 32 | ||||
-rw-r--r-- | udp.h | 1 |
10 files changed, 516 insertions, 18 deletions
diff --git a/Makefile.in b/Makefile.in index da6c1f35..60bf0917 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,7 +73,7 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \ nlpid.c l2vpn.c machdep.c parsenfsfh.c in_cksum.c \ - print-802_11.c print-802_15_4.c print-ap1394.c print-ah.c \ + print-802_11.c print-802_15_4.c print-ap1394.c print-ah.c print-ahcp.c \ print-arcnet.c print-aodv.c print-arp.c print-ascii.c print-atalk.c \ print-atm.c print-beep.c print-bfd.c print-bgp.c \ print-bootp.c print-bt.c print-calm-fast.c print-carp.c print-cdp.c print-cfm.c \ diff --git a/interface.h b/interface.h index 9732d39d..97c3a0ed 100644 --- a/interface.h +++ b/interface.h @@ -357,6 +357,7 @@ extern void ripng_print(const u_char *, unsigned int); extern int rt6_print(const u_char *, const u_char *); extern void ospf6_print(const u_char *, u_int); extern void dhcp6_print(const u_char *, u_int); +extern void ahcp_print(const u_char *, u_int); extern void babel_print(const u_char *, u_int); extern int mask62plen(const u_char *); #endif /*INET6*/ diff --git a/print-ahcp.c b/print-ahcp.c new file mode 100644 index 00000000..a62b2696 --- /dev/null +++ b/print-ahcp.c @@ -0,0 +1,401 @@ +/* + * This module implements decoding of AHCP (Ad Hoc Configuration Protocol) based + * on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53. + * + * + * Copyright (c) 2013 The TCPDUMP project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <tcpdump-stdinc.h> + +#include "interface.h" +#include "extract.h" +#include "addrtoname.h" + +static const char *corrupt_str = "(corrupt)"; +static const char *trunc_str = "[|ahcp]"; + +#define AHCP_MAGIC_NUMBER 43 +#define AHCP_VERSION_1 1 +#define AHCP1_HEADER_FIX_LEN 24 +#define AHCP1_BODY_MIN_LEN 4 + +#define AHCP1_MSG_DISCOVER 0 +#define AHCP1_MSG_OFFER 1 +#define AHCP1_MSG_REQUEST 2 +#define AHCP1_MSG_ACK 3 +#define AHCP1_MSG_NACK 4 +#define AHCP1_MSG_RELEASE 5 + +static const struct tok ahcp1_msg_str[] = { + { AHCP1_MSG_DISCOVER, "Discover" }, + { AHCP1_MSG_OFFER, "Offer" }, + { AHCP1_MSG_REQUEST, "Request" }, + { AHCP1_MSG_ACK, "Ack" }, + { AHCP1_MSG_NACK, "Nack" }, + { AHCP1_MSG_RELEASE, "Release" }, + { 0, NULL } +}; + +#define AHCP1_OPT_PAD 0 +#define AHCP1_OPT_MANDATORY 1 +#define AHCP1_OPT_ORIGIN_TIME 2 +#define AHCP1_OPT_EXPIRES 3 +#define AHCP1_OPT_MY_IPV6_ADDRESS 4 +#define AHCP1_OPT_MY_IPV4_ADDRESS 5 +#define AHCP1_OPT_IPV6_PREFIX 6 +#define AHCP1_OPT_IPV4_PREFIX 7 +#define AHCP1_OPT_IPV6_ADDRESS 8 +#define AHCP1_OPT_IPV4_ADDRESS 9 +#define AHCP1_OPT_IPV6_PREFIX_DELEGATION 10 +#define AHCP1_OPT_IPV4_PREFIX_DELEGATION 11 +#define AHCP1_OPT_NAME_SERVER 12 +#define AHCP1_OPT_NTP_SERVER 13 +#define AHCP1_OPT_MAX 13 + +static const struct tok ahcp1_opt_str[] = { + { AHCP1_OPT_PAD, "Pad" }, + { AHCP1_OPT_MANDATORY, "Mandatory" }, + { AHCP1_OPT_ORIGIN_TIME, "Origin Time" }, + { AHCP1_OPT_EXPIRES, "Expires" }, + { AHCP1_OPT_MY_IPV6_ADDRESS, "My-IPv6-Address" }, + { AHCP1_OPT_MY_IPV4_ADDRESS, "My-IPv4-Address" }, + { AHCP1_OPT_IPV6_PREFIX, "IPv6 Prefix" }, + { AHCP1_OPT_IPV4_PREFIX, "IPv4 Prefix" }, + { AHCP1_OPT_IPV6_ADDRESS, "IPv6 Address" }, + { AHCP1_OPT_IPV4_ADDRESS, "IPv4 Address" }, + { AHCP1_OPT_IPV6_PREFIX_DELEGATION, "IPv6 Prefix Delegation" }, + { AHCP1_OPT_IPV4_PREFIX_DELEGATION, "IPv4 Prefix Delegation" }, + { AHCP1_OPT_NAME_SERVER, "Name Server" }, + { AHCP1_OPT_NTP_SERVER, "NTP Server" }, + { 0, NULL } +}; + +static int +ahcp_time_print(const u_char *cp, const u_char *ep) { + time_t t; + struct tm *tm; + char buf[BUFSIZE]; + + if (cp + 4 != ep) + goto corrupt; + TCHECK2(*cp, 4); + t = EXTRACT_32BITS(cp); + if (NULL == (tm = gmtime(&t))) + printf(": gmtime() error"); + else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm)) + printf(": strftime() error"); + else + printf(": %s UTC", buf); + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +static int +ahcp_seconds_print(const u_char *cp, const u_char *ep) { + if (cp + 4 != ep) + goto corrupt; + TCHECK2(*cp, 4); + printf(": %us", EXTRACT_32BITS(cp)); + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +static int +ahcp_ipv6_addresses_print(const u_char *cp, const u_char *ep) { + const char *sep = ": "; + + while (cp < ep) { + if (cp + 16 > ep) + goto corrupt; + TCHECK2(*cp, 16); + printf("%s%s", sep, ip6addr_string(cp)); + cp += 16; + sep = ", "; + } + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +static int +ahcp_ipv4_addresses_print(const u_char *cp, const u_char *ep) { + const char *sep = ": "; + + while (cp < ep) { + if (cp + 4 > ep) + goto corrupt; + TCHECK2(*cp, 4); + printf("%s%s", sep, ipaddr_string(cp)); + cp += 4; + sep = ", "; + } + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +static int +ahcp_ipv6_prefixes_print(const u_char *cp, const u_char *ep) { + const char *sep = ": "; + + while (cp < ep) { + if (cp + 17 > ep) + goto corrupt; + TCHECK2(*cp, 17); + printf("%s%s/%u", sep, ip6addr_string(cp), *(cp + 16)); + cp += 17; + sep = ", "; + } + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +static int +ahcp_ipv4_prefixes_print(const u_char *cp, const u_char *ep) { + const char *sep = ": "; + + while (cp < ep) { + if (cp + 5 > ep) + goto corrupt; + TCHECK2(*cp, 5); + printf("%s%s/%u", sep, ipaddr_string(cp), *(cp + 4)); + cp += 5; + sep = ", "; + } + return 0; + +corrupt: + printf(": %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return 0; +trunc: + printf(" %s", trunc_str); + return -1; +} + +/* Data decoders signal truncated data with -1. */ +static int +(* const data_decoders[AHCP1_OPT_MAX + 1])(const u_char *, const u_char *) = { + [AHCP1_OPT_ORIGIN_TIME] = ahcp_time_print, + [AHCP1_OPT_EXPIRES] = ahcp_seconds_print, + [AHCP1_OPT_MY_IPV6_ADDRESS] = ahcp_ipv6_addresses_print, + [AHCP1_OPT_MY_IPV4_ADDRESS] = ahcp_ipv4_addresses_print, + [AHCP1_OPT_IPV6_PREFIX] = ahcp_ipv6_prefixes_print, + [AHCP1_OPT_IPV6_ADDRESS] = ahcp_ipv6_addresses_print, + [AHCP1_OPT_IPV4_ADDRESS] = ahcp_ipv4_addresses_print, + [AHCP1_OPT_IPV6_PREFIX_DELEGATION] = ahcp_ipv6_prefixes_print, + [AHCP1_OPT_IPV4_PREFIX_DELEGATION] = ahcp_ipv4_prefixes_print, + [AHCP1_OPT_NAME_SERVER] = ahcp_ipv6_addresses_print, + [AHCP1_OPT_NTP_SERVER] = ahcp_ipv6_addresses_print, +}; + +static void +ahcp1_options_print(const u_char *cp, const u_char *ep) { + uint8_t option_no, option_len; + + while (cp < ep) { + /* Option no */ + TCHECK2(*cp, 1); + option_no = *cp; + cp += 1; + printf("\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no)); + if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY) + continue; + /* Length */ + if (cp + 1 > ep) + goto corrupt; + TCHECK2(*cp, 1); + option_len = *cp; + cp += 1; + if (cp + option_len > ep) + goto corrupt; + /* Value */ + if (option_no <= AHCP1_OPT_MAX && data_decoders[option_no] != NULL) { + if (data_decoders[option_no](cp, cp + option_len) < 0) + break; /* truncated and already marked up */ + } else { + printf(" (Length %u)", option_len); + TCHECK2(*cp, option_len); + } + cp += option_len; + } + return; + +corrupt: + printf(" %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return; +trunc: + printf(" %s", trunc_str); +} + +static void +ahcp1_body_print(const u_char *cp, const u_char *ep) { + uint8_t type, mbz; + uint16_t body_len; + + if (cp + AHCP1_BODY_MIN_LEN > ep) + goto corrupt; + /* Type */ + TCHECK2(*cp, 1); + type = *cp; + cp += 1; + /* MBZ */ + TCHECK2(*cp, 1); + mbz = *cp; + cp += 1; + /* Length */ + TCHECK2(*cp, 2); + body_len = EXTRACT_16BITS(cp); + cp += 2; + + if (vflag) { + printf("\n\t%s", tok2str(ahcp1_msg_str, "Unknown-%u", type)); + if (mbz != 0) + printf(", MBZ %u", mbz); + printf(", Length %u", body_len); + } + if (cp + body_len > ep) + goto corrupt; + + /* Options */ + if (vflag >= 2) + ahcp1_options_print(cp, cp + body_len); /* not ep (ignore extra data) */ + else + TCHECK2(*cp, body_len); + return; + +corrupt: + printf(" %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return; +trunc: + printf(" %s", trunc_str); +} + +void +ahcp_print(const u_char *cp, const u_int len) { + const u_char *ep = cp + len; + uint8_t version; + + printf("AHCP"); + if (len < 2) + goto corrupt; + /* Magic */ + TCHECK2(*cp, 1); + if (*cp != AHCP_MAGIC_NUMBER) + goto corrupt; + cp += 1; + /* Version */ + TCHECK2(*cp, 1); + version = *cp; + cp += 1; + switch (version) { + case AHCP_VERSION_1: { + printf(" Version 1"); + if (len < AHCP1_HEADER_FIX_LEN) + goto corrupt; + if (!vflag) { + TCHECK2(*cp, AHCP1_HEADER_FIX_LEN - 2); + cp += AHCP1_HEADER_FIX_LEN - 2; + } else { + /* Hopcount */ + TCHECK2(*cp, 1); + printf("\n\tHopcount %u", *cp); + cp += 1; + /* Original Hopcount */ + TCHECK2(*cp, 1); + printf(", Original Hopcount %u", *cp); + cp += 1; + /* Nonce */ + TCHECK2(*cp, 4); + printf(", Nonce 0x%08x", EXTRACT_32BITS(cp)); + cp += 4; + /* Source Id */ + TCHECK2(*cp, 8); + printf(", Source Id %s", linkaddr_string(cp, 0, 8)); + cp += 8; + /* Destination Id */ + TCHECK2(*cp, 8); + printf(", Destination Id %s", linkaddr_string(cp, 0, 8)); + cp += 8; + } + /* Body */ + ahcp1_body_print(cp, ep); + break; + } + default: + printf(" Version %u (unknown)", version); + break; + } + return; + +corrupt: + printf(" %s", corrupt_str); + TCHECK2(*cp, ep - cp); + return; +trunc: + printf(" %s", trunc_str); +} + diff --git a/print-udp.c b/print-udp.c index 8148023d..5d985b85 100644 --- a/print-udp.c +++ b/print-udp.c @@ -629,6 +629,8 @@ udp_print(register const u_char *bp, u_int length, ripng_print((const u_char *)(up + 1), length); else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT)) dhcp6_print((const u_char *)(up + 1), length); + else if (ISPORT(AHCP_PORT)) + ahcp_print((const u_char *)(up + 1), length); else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD)) babel_print((const u_char *)(up + 1), length); #endif /*INET6*/ diff --git a/tests/TESTLIST b/tests/TESTLIST index 63eac93c..7c7a0059 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -77,7 +77,8 @@ qinqv QinQpacket.pcap QinQpacketv.out -t -e -v sflow1 sflow_multiple_counter_30_pdus.pcap sflow_multiple_counter_30_pdus.out -t -v sflow2 sflow_multiple_counter_30_pdus.pcap sflow_multiple_counter_30_pdus-nv.out -t -# Babel tests +# AHCP and Babel tests +ahcp-vv ahcp.pcap ahcp-vv.out -t -vv babel1 babel.pcap babel1.out -t babel1v babel.pcap babel1v.out -t -v babel_auth babel_auth.pcap babel_auth.out -t -v diff --git a/tests/ahcp-vv.out b/tests/ahcp-vv.out new file mode 100644 index 00000000..167dd438 --- /dev/null +++ b/tests/ahcp-vv.out @@ -0,0 +1,76 @@ +IP6 (class 0xc0, hlim 1, next-header UDP (17) payload length: 60) fe80::6aa3:c4ff:fef4:841e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x7ce31135, Source Id 6a:a3:c4:ff:fe:f4:84:1e, Destination Id ff:ff:ff:ff:ff:ff:ff:ff + Discover, Length 24 + Origin Time: 2013-11-10 07:59:42 UTC + Expires: 418s + IPv4 Address: 0.0.0.0 + IPv6 Prefix + Name Server + NTP Server +IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 193) fe80::22cf:30ff:fe02:b052.5359 > fe80::6aa3:c4ff:fef4:841e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x9dccbd40, Source Id 08:4b:37:1e:f3:6e:1e:dc, Destination Id 6a:a3:c4:ff:fe:f4:84:1e + Offer, Length 157 + Origin Time: 2013-11-10 07:59:44 UTC + Mandatory + Expires: 512s + IPv4 Address: 10.100.0.1 + Name Server: ::ffff:89.233.43.71, ::ffff:89.104.194.142, 2002:d596:2a92:1:71:53::, 2002:5968:c28e::53 + NTP Server: ::ffff:195.234.155.124, ::ffff:78.156.97.78, ::ffff:80.71.132.103, ::ffff:83.151.158.44 + My-IPv4-Address: 10.0.0.80 +IP6 (class 0xc0, hlim 1, next-header UDP (17) payload length: 56) fe80::6aa3:c4ff:fef4:841e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x7de31135, Source Id 6a:a3:c4:ff:fe:f4:84:1e, Destination Id 08:4b:37:1e:f3:6e:1e:dc + Request, Length 20 + Origin Time: 2013-11-10 07:59:42 UTC + Expires: 405s + IPv4 Address + IPv6 Prefix + Name Server + NTP Server +IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 193) fe80::22cf:30ff:fe02:b052.5359 > fe80::6aa3:c4ff:fef4:841e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x9eccbd40, Source Id 08:4b:37:1e:f3:6e:1e:dc, Destination Id 6a:a3:c4:ff:fe:f4:84:1e + Ack, Length 157 + Origin Time: 2013-11-10 07:59:44 UTC + Mandatory + Expires: 524s + IPv4 Address: 10.100.0.1 + Name Server: ::ffff:89.233.43.71, ::ffff:89.104.194.142, 2002:d596:2a92:1:71:53::, 2002:5968:c28e::53 + NTP Server: ::ffff:195.234.155.124, ::ffff:78.156.97.78, ::ffff:80.71.132.103, ::ffff:83.151.158.44 + My-IPv4-Address: 10.0.0.80 +IP6 (class 0xc0, hlim 1, next-header UDP (17) payload length: 56) fe80::6aa3:c4ff:fef4:841e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x7ee31135, Source Id 6a:a3:c4:ff:fe:f4:84:1e, Destination Id ff:ff:ff:ff:ff:ff:ff:ff + Discover, Length 20 + Origin Time: 2013-11-10 08:00:09 UTC + Expires: 415s + IPv4 Address + IPv6 Prefix + Name Server + NTP Server +IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 193) fe80::22cf:30ff:fe02:b052.5359 > fe80::6aa3:c4ff:fef4:841e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x9fccbd40, Source Id 08:4b:37:1e:f3:6e:1e:dc, Destination Id 6a:a3:c4:ff:fe:f4:84:1e + Offer, Length 157 + Origin Time: 2013-11-10 08:00:11 UTC + Mandatory + Expires: 505s + IPv4 Address: 10.100.0.1 + Name Server: ::ffff:89.233.43.71, ::ffff:89.104.194.142, 2002:d596:2a92:1:71:53::, 2002:5968:c28e::53 + NTP Server: ::ffff:195.234.155.124, ::ffff:78.156.97.78, ::ffff:80.71.132.103, ::ffff:83.151.158.44 + My-IPv4-Address: 10.0.0.80 +IP6 (class 0xc0, hlim 1, next-header UDP (17) payload length: 56) fe80::6aa3:c4ff:fef4:841e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0x7fe31135, Source Id 6a:a3:c4:ff:fe:f4:84:1e, Destination Id 08:4b:37:1e:f3:6e:1e:dc + Request, Length 20 + Origin Time: 2013-11-10 08:00:09 UTC + Expires: 409s + IPv4 Address + IPv6 Prefix + Name Server + NTP Server +IP6 (class 0xc0, hlim 64, next-header UDP (17) payload length: 193) fe80::22cf:30ff:fe02:b052.5359 > fe80::6aa3:c4ff:fef4:841e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xa0ccbd40, Source Id 08:4b:37:1e:f3:6e:1e:dc, Destination Id 6a:a3:c4:ff:fe:f4:84:1e + Ack, Length 157 + Origin Time: 2013-11-10 08:00:12 UTC + Mandatory + Expires: 518s + IPv4 Address: 10.100.0.1 + Name Server: ::ffff:89.233.43.71, ::ffff:89.104.194.142, 2002:d596:2a92:1:71:53::, 2002:5968:c28e::53 + NTP Server: ::ffff:195.234.155.124, ::ffff:78.156.97.78, ::ffff:80.71.132.103, ::ffff:83.151.158.44 + My-IPv4-Address: 10.0.0.80 diff --git a/tests/ahcp.pcap b/tests/ahcp.pcap Binary files differnew file mode 100644 index 00000000..e3bfdf1d --- /dev/null +++ b/tests/ahcp.pcap diff --git a/tests/babel1.out b/tests/babel1.out index 2243847f..de3d37ec 100644 --- a/tests/babel1.out +++ b/tests/babel1.out @@ -9,17 +9,17 @@ IP6 fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: babel 2 (8) hello IP6 fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: babel 2 (8) hello IP6 fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: babel 2 (52) update/prefix/id update/prefix update/prefix IP6 fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: babel 2 (32) mh-request -IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: UDP, length 42 -IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: UDP, length 42 -IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: UDP, length 180 -IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: UDP, length 42 -IP6 fe80::3428:af91:251:d626.5359 > ff02::cca6:c0f9:e182:5359.5359: UDP, length 42 +IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: AHCP Version 1 +IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: AHCP Version 1 +IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: AHCP Version 1 +IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: AHCP Version 1 +IP6 fe80::3428:af91:251:d626.5359 > ff02::cca6:c0f9:e182:5359.5359: AHCP Version 1 IP6 fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: babel 2 (28) update/prefix/id IP6 fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: babel 2 (32) mh-request -IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: UDP, length 180 -IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: UDP, length 42 +IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: AHCP Version 1 +IP6 fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: AHCP Version 1 IP6 fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: babel 2 (24) hello ihu IP6 fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: babel 2 (28) update/prefix/id IP6 fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: babel 2 (32) mh-request -IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: UDP, length 180 +IP6 fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: AHCP Version 1 IP6 fe80::68d3:1235:d068:1f9e > ff02::16: HBH ICMP6, multicast listener report v2, 2 group record(s), length 48 diff --git a/tests/babel1v.out b/tests/babel1v.out index c8d85ee3..dd26f875 100644 --- a/tests/babel1v.out +++ b/tests/babel1v.out @@ -29,17 +29,31 @@ IP6 (hlim 1, next-header UDP (17) payload length: 64) fe80::68d3:1235:d068:1f9e. Update/prefix 2001:660:3301:8063:218:f3ff:fea9:914e/128 metric 65535 seqno 40149 interval 800.0s IP6 (hlim 1, next-header UDP (17) payload length: 44) fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: [udp sum ok] babel 2 (32) MH-Request (127 hops) for 2001:660:3301:8063:218:f3ff:fea9:914e/128 seqno 40150 id 02:18:f3:ff:fe:a9:91:4e -IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] UDP, length 42 -IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] UDP, length 42 -IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] UDP, length 180 -IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] UDP, length 42 -IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::3428:af91:251:d626.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] UDP, length 42 +IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xde3e5127, Source Id 02:18:f3:ff:fe:a9:91:4e, Destination Id ff:ff:ff:ff:ff:ff:ff:ff + Discover, Length 14 +IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 2, Original Hopcount 2, Nonce 0xdf3e5127, Source Id 02:18:f3:ff:fe:a9:91:4e, Destination Id ff:ff:ff:ff:ff:ff:ff:ff + Discover, Length 14 +IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xc9b83d0d, Source Id 79:40:14:7f:b6:6d:c3:29, Destination Id 02:18:f3:ff:fe:a9:91:4e + Offer, Length 152 +IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xe03e5127, Source Id 02:18:f3:ff:fe:a9:91:4e, Destination Id 79:40:14:7f:b6:6d:c3:29 + Request, Length 14 +IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::3428:af91:251:d626.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 2, Nonce 0xdf3e5127, Source Id 02:18:f3:ff:fe:a9:91:4e, Destination Id ff:ff:ff:ff:ff:ff:ff:ff + Discover, Length 14 IP6 (hlim 1, next-header UDP (17) payload length: 40) fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: [udp sum ok] babel 2 (28) Update/prefix/id 2001:660:3301:8063:218:f3ff:fea9:914e/128 metric 65535 seqno 40149 interval 800.0s IP6 (hlim 1, next-header UDP (17) payload length: 44) fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: [udp sum ok] babel 2 (32) MH-Request (127 hops) for 2001:660:3301:8063:218:f3ff:fea9:914e/128 seqno 40150 id 02:18:f3:ff:fe:a9:91:4e -IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] UDP, length 180 -IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] UDP, length 42 +IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] AHCP Version 1 + Hopcount 2, Original Hopcount 2, Nonce 0xcab83d0d, Source Id 79:40:14:7f:b6:6d:c3:29, Destination Id 02:18:f3:ff:fe:a9:91:4e + Offer, Length 152 +IP6 (hlim 1, next-header UDP (17) payload length: 50) fe80::68d3:1235:d068:1f9e.5359 > ff02::cca6:c0f9:e182:5359.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xe13e5127, Source Id 02:18:f3:ff:fe:a9:91:4e, Destination Id 79:40:14:7f:b6:6d:c3:29 + Request, Length 14 IP6 (hlim 1, next-header UDP (17) payload length: 36) fe80::68d3:1235:d068:1f9e.6697 > ff02::1:6.6697: [udp sum ok] babel 2 (24) Hello seqno 8046 interval 200.0s IHU fe80::3428:af91:251:d626 txcost 96 interval 600.0s @@ -47,5 +61,7 @@ IP6 (hlim 1, next-header UDP (17) payload length: 40) fe80::68d3:1235:d068:1f9e. Update/prefix/id 2001:660:3301:8063:218:f3ff:fea9:914e/128 metric 65535 seqno 40149 interval 800.0s IP6 (hlim 1, next-header UDP (17) payload length: 44) fe80::3428:af91:251:d626.6697 > ff02::1:6.6697: [udp sum ok] babel 2 (32) MH-Request (127 hops) for 2001:660:3301:8063:218:f3ff:fea9:914e/128 seqno 40150 id 02:18:f3:ff:fe:a9:91:4e -IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] UDP, length 180 +IP6 (hlim 64, next-header UDP (17) payload length: 188) fe80::3428:af91:251:d626.5359 > fe80::68d3:1235:d068:1f9e.5359: [udp sum ok] AHCP Version 1 + Hopcount 1, Original Hopcount 1, Nonce 0xcbb83d0d, Source Id 79:40:14:7f:b6:6d:c3:29, Destination Id 02:18:f3:ff:fe:a9:91:4e + Ack, Length 152 IP6 (hlim 1, next-header Options (0) payload length: 56) fe80::68d3:1235:d068:1f9e > ff02::16: HBH (rtalert: 0x0000) (padn) [icmp6 sum ok] ICMP6, multicast listener report v2, 2 group record(s) [gaddr ff02::1:6 to_ex, 0 source(s)] [gaddr ff02::cca6:c0f9:e182:5359 to_ex, 0 source(s)] @@ -94,6 +94,7 @@ struct udphdr { #define RIPNG_PORT 521 /*XXX*/ #define DHCP6_SERV_PORT 546 /*XXX*/ #define DHCP6_CLI_PORT 547 /*XXX*/ +#define AHCP_PORT 5359 /* draft-chroboczek-ahcp-00 */ #define BABEL_PORT 6696 #define BABEL_PORT_OLD 6697 #endif |