aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-10-01 03:57:35 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-11-07 14:00:18 -0500
commit7cdcf6dddc428c90ac867267a8d301e9e8b25612 (patch)
tree7cdbf95a57239352f9203b96dc915649bc0be253 /net/batman-adv/routing.c
parentf6c57a460913f3c83b0e8eb51f4021fcf1c83cdc (diff)
batman-adv: add UNICAST_4ADDR packet type
The current unicast packet type does not contain the orig source address. This patches add a new unicast packet (called UNICAST_4ADDR) which provides two new fields: the originator source address and the subtype (the type of the data contained in the packet payload). The former is useful to identify the node which injected the packet into the network and the latter is useful to avoid creating new unicast packet types in the future: a macro defining a new subtype will be enough. Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 46dd5b47ed29..859679b08286 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -986,14 +986,18 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
986 struct batadv_unicast_packet *unicast_packet; 986 struct batadv_unicast_packet *unicast_packet;
987 int hdr_size = sizeof(*unicast_packet); 987 int hdr_size = sizeof(*unicast_packet);
988 988
989 unicast_packet = (struct batadv_unicast_packet *)skb->data;
990
991 /* the caller function should have already pulled 2 bytes */
992 if (unicast_packet->header.packet_type == BATADV_UNICAST_4ADDR)
993 hdr_size = sizeof(struct batadv_unicast_4addr_packet);
994
989 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 995 if (batadv_check_unicast_packet(skb, hdr_size) < 0)
990 return NET_RX_DROP; 996 return NET_RX_DROP;
991 997
992 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 998 if (!batadv_check_unicast_ttvn(bat_priv, skb))
993 return NET_RX_DROP; 999 return NET_RX_DROP;
994 1000
995 unicast_packet = (struct batadv_unicast_packet *)skb->data;
996
997 /* packet for me */ 1001 /* packet for me */
998 if (batadv_is_my_mac(unicast_packet->dest)) { 1002 if (batadv_is_my_mac(unicast_packet->dest)) {
999 batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size, 1003 batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size,