Author: marek Date: 2010-01-10 04:56:08 +0100 (Sun, 10 Jan 2010) New Revision: 1548
Modified: trunk/batman-adv-kernelland/gateway_client.c Log: batman-adv: best gw DHCP filter 802.1Q support
The DHCP filter inspects packets to determine whether or not to send them via ethernet unicast. This patch adds 802.1Q (vlan) support for this check.
Signed-off-by: Marek Lindner lindner_marek@yahoo.de
Modified: trunk/batman-adv-kernelland/gateway_client.c =================================================================== --- trunk/batman-adv-kernelland/gateway_client.c 2010-01-10 03:56:03 UTC (rev 1547) +++ trunk/batman-adv-kernelland/gateway_client.c 2010-01-10 03:56:08 UTC (rev 1548) @@ -22,6 +22,7 @@ #include "gateway_common.h" #include <linux/ip.h> #include <linux/udp.h> +#include <linux/if_vlan.h>
LIST_HEAD(gw_list); DEFINE_SPINLOCK(curr_gw_lock); @@ -370,15 +371,20 @@ return false;
ethhdr = (struct ethhdr *)skb->data; + + if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) + ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN); + if (ntohs(ethhdr->h_proto) != ETH_P_IP) return false;
- iphdr = (struct iphdr *)(skb->data + ETH_HLEN); + iphdr = (struct iphdr *)(((unsigned char *)ethhdr) + ETH_HLEN);
if (iphdr->protocol != IPPROTO_UDP) return false;
- udphdr = (struct udphdr *)(skb->data + ETH_HLEN + (iphdr->ihl * 4)); + udphdr = (struct udphdr *)(((unsigned char *)iphdr) + + (iphdr->ihl * 4));
if (ntohs(udphdr->dest) != 67) return false;