batman-adv: simplify bat_ogm_receive API call
authorMarek Lindner <lindner_marek@yahoo.de>
Sun, 4 Dec 2011 20:01:51 +0000 (04:01 +0800)
committerMarek Lindner <lindner_marek@yahoo.de>
Thu, 16 Feb 2012 18:50:19 +0000 (02:50 +0800)
Most of the values in that call are derived from the skb, so we can hand
over the skb instead.

Reported-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_ogm.h
net/batman-adv/routing.c

index d60e1ba0bc150e600f8ee6d9076c9ab4714e8674..3402fa575b4705284cfd195fc00537d3e1f50df0 100644 (file)
@@ -1140,13 +1140,16 @@ out:
        orig_node_free_ref(orig_node);
 }
 
-void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff,
-                    int packet_len, struct hard_iface *if_incoming)
+void bat_ogm_receive(struct hard_iface *if_incoming, struct sk_buff *skb)
 {
        struct batman_ogm_packet *batman_ogm_packet;
-       int buff_pos = 0;
-       unsigned char *tt_buff;
+       struct ethhdr *ethhdr;
+       int buff_pos = 0, packet_len;
+       unsigned char *tt_buff, *packet_buff;
 
+       packet_len = skb_headlen(skb);
+       ethhdr = (struct ethhdr *)skb_mac_header(skb);
+       packet_buff = skb->data;
        batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
 
        /* unpack the aggregated packets and process them one by one */
index 69329c107e2863322356ab084e1d17cd51fa411d..47edfde6f924bc02eebcaf7583b54b473f44ab4c 100644 (file)
@@ -29,7 +29,6 @@ void bat_ogm_init_primary(struct hard_iface *hard_iface);
 void bat_ogm_update_mac(struct hard_iface *hard_iface);
 void bat_ogm_schedule(struct hard_iface *hard_iface, int tt_num_changes);
 void bat_ogm_emit(struct forw_packet *forw_packet);
-void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff,
-                    int packet_len, struct hard_iface *if_incoming);
+void bat_ogm_receive(struct hard_iface *if_incoming, struct sk_buff *skb);
 
 #endif /* _NET_BATMAN_ADV_OGM_H_ */
index 4363d197aebcb7adfa6442fe4433e9a09b66e089..5bc41c896e35cad36922c1aea18cb445fb75b7f5 100644 (file)
@@ -272,9 +272,7 @@ int recv_bat_ogm_packet(struct sk_buff *skb, struct hard_iface *hard_iface)
        if (skb_linearize(skb) < 0)
                return NET_RX_DROP;
 
-       ethhdr = (struct ethhdr *)skb_mac_header(skb);
-
-       bat_ogm_receive(ethhdr, skb->data, skb_headlen(skb), hard_iface);
+       bat_ogm_receive(hard_iface, skb);
 
        kfree_skb(skb);
        return NET_RX_SUCCESS;