summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2010-11-22 00:56:04 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-29 11:09:14 -0800
commitc9c556b63b19c8b52de5c5ea6f47ab16fc540e47 (patch)
tree3ec092dd2eb830f9c7ad85f8d97190ee4f8a2ad2
parent6c3a42db6ca46204b35f0cdb8abfa9e4771641ef (diff)
downloadlinux-3.10-c9c556b63b19c8b52de5c5ea6f47ab16fc540e47.tar.gz
linux-3.10-c9c556b63b19c8b52de5c5ea6f47ab16fc540e47.tar.bz2
linux-3.10-c9c556b63b19c8b52de5c5ea6f47ab16fc540e47.zip
Staging: 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> [sven.eckelmann@gmx.de: Rework on top of current version] Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/batman-adv/gateway_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/batman-adv/gateway_client.c b/drivers/staging/batman-adv/gateway_client.c
index 3d4e1096a9d..fde1d8a952f 100644
--- a/drivers/staging/batman-adv/gateway_client.c
+++ b/drivers/staging/batman-adv/gateway_client.c
@@ -415,6 +415,14 @@ int gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb)
ethhdr = (struct ethhdr *)skb->data;
header_len += ETH_HLEN;
+ /* check for initial vlan header */
+ if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) {
+ if (!pskb_may_pull(skb, header_len + VLAN_HLEN))
+ return 0;
+ ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN);
+ header_len += VLAN_HLEN;
+ }
+
/* check for ip header */
if (ntohs(ethhdr->h_proto) != ETH_P_IP)
return 0;