Date: Sun, 29 Jun 2008 20:38:51 +0900 From: Shunsuke SHINOMIYA <shino@fornext.org> To: Hiroki Sato <hrs@FreeBSD.org> Cc: freebsd-bugs@FreeBSD.org, bug-followup@FreeBSD.org, thompsa@FreeBSD.org Subject: Re[2]: kern/125003: incorrect EtherIP header format. Message-ID: <20080629193803.A849.A2D40D1E@fornext.org> In-Reply-To: <20080629.185711.61984972.hrs@allbsd.org> References: <20080629150108.6783.A2D40D1E@fornext.org> <20080629.185711.61984972.hrs@allbsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi, > Could you let me know if the following patch solves your symptom or > not? It can be applied to 8.x and 7.x: > > http://people.allbsd.org/~hrs/FreeBSD/gif.diff Thank you. I applied your patch to RELENG_6_3 and modified netinet6/in6_gif.c manually(because of tab expansion?). I had 2 problems. One is syntax error around `eip_ver:4,' when BYTE_ORDER is LITTELE_ENDIAN. Another one is 2 octet padding for struct etherip_header. To solve this, I specified __packed attribute for this structure. Attached patch based on yours is for RELENG_6_3. Patched implementation works well with IX2015. 192.168.2.37: FreeBSD box 192.168.2.128: IX2015 20:22:55.540804 IP 192.168.2.128 > 192.168.2.37: etherip 76 0x0000: 4500 0060 076b 0000 4061 ecdc c0a8 0280 0x0010: c0a8 0225 3000 **** **** **** **** **** 0x0020: **** 0800 4500 003c 0cc0 0000 8001 a82e 0x0030: c0a8 0281 c0a8 0201 0800 4753 0001 0608 0x0040: 6162 6364 6566 6768 696a 6b6c 6d6e 6f70 0x0050: 7172 20:22:55.541815 IP 192.168.2.37 > 192.168.2.128: etherip 76 0x0000: 4500 0060 3511 0000 1e61 e136 c0a8 0225 0x0010: c0a8 0280 3000 **** **** **** **** **** 0x0020: **** 0800 4500 003c 319b 0000 4001 c353 0x0030: c0a8 0201 c0a8 0281 0000 4f53 0001 0608 0x0040: 6162 6364 6566 6768 696a 6b6c 6d6e 6f70 0x0050: 7172 -- Shunsuke SHINOMIYA <shino@fornext.org> [-- Attachment #2 --] --- net/if_gif.h.orig 2006-02-01 00:56:46.000000000 +0900 +++ net/if_gif.h 2008-06-29 19:36:40.000000000 +0900 @@ -93,12 +93,17 @@ #define MTAG_GIF_CALLED 0 struct etherip_header { - u_int8_t eip_ver; /* version/reserved */ - u_int8_t eip_pad; /* required padding byte */ -}; -#define ETHERIP_VER_VERS_MASK 0x0f -#define ETHERIP_VER_RSVD_MASK 0xf0 -#define ETHERIP_VERSION 0x03 +#if BYTE_ORDER == LITTLE_ENDIAN + u_int eip_resvl:4, /* reserved */ + eip_ver:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int eip_ver:4, /* version */ + eip_resvl:4; /* reserved */ +#endif + u_int8_t eip_resvh; /* reserved */ +} __packed; +#define ETHERIP_VERSION 0x3 /* Prototypes */ void gif_input(struct mbuf *, int, struct ifnet *); --- netinet/in_gif.c.orig 2006-02-01 00:56:46.000000000 +0900 +++ netinet/in_gif.c 2008-06-29 19:22:48.000000000 +0900 @@ -147,8 +147,9 @@ #endif /* INET6 */ case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header)) --- netinet6/in6_gif.c.orig 2006-02-01 00:56:47.000000000 +0900 +++ netinet6/in6_gif.c 2008-06-29 19:24:49.000000000 +0900 @@ -140,8 +140,9 @@ #endif case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080629193803.A849.A2D40D1E>
