include/linux/netfilter_bridge/ebt_arp.h

Grzegorz Borowiak <[email protected]>
Newsgroups gmane.linux.network.bridge.ebtables.devel
Message-ID <[email protected]>
Maybe I'm wrong again, but I see there is a difference between file
ebtables-v2.0.5/include/linux/netfilter_bridge/ebt_arp.h in the user-space
utility package ebtables-v2.0.5.tar.gz and
/usr/src/linux/include/linux/netfilter_bridge/ebt_arp.h, generated by the
kernel patch ebtables-v2.0.003_vs_2.4.20.diff.gz. In user-space, it is:

struct ebt_arp_info
{
	uint16_t htype;
	uint16_t ptype;
	uint16_t opcode;
	uint32_t saddr;
	uint32_t smsk;
	uint32_t daddr;
	uint32_t dmsk;
	unsigned char smaddr[ETH_ALEN];
	unsigned char smmsk[ETH_ALEN];
	unsigned char dmaddr[ETH_ALEN];
	unsigned char dmmsk[ETH_ALEN];
	uint8_t  bitmask;
	uint8_t  invflags;
};

while in kernel it is:

struct ebt_arp_info
{
	uint16_t htype;
	uint16_t ptype;
	uint16_t opcode;
	uint32_t saddr;
	uint32_t smsk;
	uint32_t daddr;
	uint32_t dmsk;
	uint8_t  bitmask;
	uint8_t  invflags;
};

It prevents --arp-* options from working. Function ebt_arp_check from file
eth_arp.c in kernel finds a difference between sizes:

static int ebt_arp_check(const char *tablename, unsigned int hookmask,
   const struct ebt_entry *e, void *data, unsigned int datalen)
{
	struct ebt_arp_info *info = (struct ebt_arp_info *)data;

	if (datalen != sizeof(struct ebt_arp_info))

		/**** it comes here ****/

		return -EINVAL;
	if ((e->ethproto != __constant_htons(ETH_P_ARP) &&
	   e->ethproto != __constant_htons(ETH_P_RARP)) ||
	   e->invflags & EBT_IPROTO)
		return -EINVAL;
	if (info->bitmask & ~EBT_ARP_MASK || info->invflags &
~EBT_ARP_MASK)
		return -EINVAL;
	return 0;
}

I just copied the former ebt_arp.h onto the latter and it works so far.

BTW I'm implementing some contribs to ebtables, include arp-replyer
(replies with arbitrary mac address) and indexed snat/dnat (a large
target, which does MAC snatting/dnatting the packets dependently of their
IP addresses). I'll publish them ASAP. I hope You will enjoy it.

-- 
Grzesław


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.