aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-22 20:32:51 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-22 20:32:51 -0400
commit6e0895c2ea326cc4bb11e8fa2f654628d5754c31 (patch)
tree7089303ac11a12edc43a8c4fa1b23974e10937ea /net/batman-adv/routing.c
parent55fbbe46e9eb3cbe6c335503f5550855a1128dce (diff)
parent60d509fa6a9c4653a86ad830e4c4b30360b23f0e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/intel/igb/igb_main.c drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c include/net/scm.h net/batman-adv/routing.c net/ipv4/tcp_input.c The e{uid,gid} --> {uid,gid} credentials fix conflicted with the cleanup in net-next to now pass cred structs around. The be2net driver had a bug fix in 'net' that overlapped with the VLAN interface changes by Patrick McHardy in net-next. An IGB conflict existed because in 'net' the build_skb() support was reverted, and in 'net-next' there was a comment style fix within that code. Several batman-adv conflicts were resolved by making sure that all calls to batadv_is_my_mac() are changed to have a new bat_priv first argument. Eric Dumazet's TS ECR fix in TCP in 'net' conflicted with the F-RTO rewrite in 'net-next', mostly overlapping changes. Thanks to Stephen Rothwell and Antonio Quartulli for help with several of these merge resolutions. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 8f88967ff14b..2f1f88923df8 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -403,7 +403,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
403 goto out; 403 goto out;
404 404
405 /* not for me */ 405 /* not for me */
406 if (!batadv_is_my_mac(ethhdr->h_dest)) 406 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
407 goto out; 407 goto out;
408 408
409 icmp_packet = (struct batadv_icmp_packet_rr *)skb->data; 409 icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
@@ -417,7 +417,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
417 } 417 }
418 418
419 /* packet for me */ 419 /* packet for me */
420 if (batadv_is_my_mac(icmp_packet->dst)) 420 if (batadv_is_my_mac(bat_priv, icmp_packet->dst))
421 return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size); 421 return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size);
422 422
423 /* TTL exceeded */ 423 /* TTL exceeded */
@@ -551,6 +551,7 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
551 551
552/** 552/**
553 * batadv_check_unicast_packet - Check for malformed unicast packets 553 * batadv_check_unicast_packet - Check for malformed unicast packets
554 * @bat_priv: the bat priv with all the soft interface information
554 * @skb: packet to check 555 * @skb: packet to check
555 * @hdr_size: size of header to pull 556 * @hdr_size: size of header to pull
556 * 557 *
@@ -559,7 +560,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
559 * reason: -ENODATA for bad header, -EBADR for broadcast destination or source, 560 * reason: -ENODATA for bad header, -EBADR for broadcast destination or source,
560 * and -EREMOTE for non-local (other host) destination. 561 * and -EREMOTE for non-local (other host) destination.
561 */ 562 */
562static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) 563static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
564 struct sk_buff *skb, int hdr_size)
563{ 565{
564 struct ethhdr *ethhdr; 566 struct ethhdr *ethhdr;
565 567
@@ -578,7 +580,7 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
578 return -EBADR; 580 return -EBADR;
579 581
580 /* not for me */ 582 /* not for me */
581 if (!batadv_is_my_mac(ethhdr->h_dest)) 583 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
582 return -EREMOTE; 584 return -EREMOTE;
583 585
584 return 0; 586 return 0;
@@ -593,7 +595,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
593 char tt_flag; 595 char tt_flag;
594 size_t packet_size; 596 size_t packet_size;
595 597
596 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 598 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
597 return NET_RX_DROP; 599 return NET_RX_DROP;
598 600
599 /* I could need to modify it */ 601 /* I could need to modify it */
@@ -625,7 +627,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
625 case BATADV_TT_RESPONSE: 627 case BATADV_TT_RESPONSE:
626 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); 628 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
627 629
628 if (batadv_is_my_mac(tt_query->dst)) { 630 if (batadv_is_my_mac(bat_priv, tt_query->dst)) {
629 /* packet needs to be linearized to access the TT 631 /* packet needs to be linearized to access the TT
630 * changes 632 * changes
631 */ 633 */
@@ -668,14 +670,15 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
668 struct batadv_roam_adv_packet *roam_adv_packet; 670 struct batadv_roam_adv_packet *roam_adv_packet;
669 struct batadv_orig_node *orig_node; 671 struct batadv_orig_node *orig_node;
670 672
671 if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) 673 if (batadv_check_unicast_packet(bat_priv, skb,
674 sizeof(*roam_adv_packet)) < 0)
672 goto out; 675 goto out;
673 676
674 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); 677 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
675 678
676 roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data; 679 roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data;
677 680
678 if (!batadv_is_my_mac(roam_adv_packet->dst)) 681 if (!batadv_is_my_mac(bat_priv, roam_adv_packet->dst))
679 return batadv_route_unicast_packet(skb, recv_if); 682 return batadv_route_unicast_packet(skb, recv_if);
680 683
681 /* check if it is a backbone gateway. we don't accept 684 /* check if it is a backbone gateway. we don't accept
@@ -981,7 +984,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
981 * last time) the packet had an updated information or not 984 * last time) the packet had an updated information or not
982 */ 985 */
983 curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); 986 curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn);
984 if (!batadv_is_my_mac(unicast_packet->dest)) { 987 if (!batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
985 orig_node = batadv_orig_hash_find(bat_priv, 988 orig_node = batadv_orig_hash_find(bat_priv,
986 unicast_packet->dest); 989 unicast_packet->dest);
987 /* if it is not possible to find the orig_node representing the 990 /* if it is not possible to find the orig_node representing the
@@ -1059,7 +1062,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1059 hdr_size = sizeof(*unicast_4addr_packet); 1062 hdr_size = sizeof(*unicast_4addr_packet);
1060 1063
1061 /* function returns -EREMOTE for promiscuous packets */ 1064 /* function returns -EREMOTE for promiscuous packets */
1062 check = batadv_check_unicast_packet(skb, hdr_size); 1065 check = batadv_check_unicast_packet(bat_priv, skb, hdr_size);
1063 1066
1064 /* Even though the packet is not for us, we might save it to use for 1067 /* Even though the packet is not for us, we might save it to use for
1065 * decoding a later received coded packet 1068 * decoding a later received coded packet
@@ -1074,7 +1077,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1074 return NET_RX_DROP; 1077 return NET_RX_DROP;
1075 1078
1076 /* packet for me */ 1079 /* packet for me */
1077 if (batadv_is_my_mac(unicast_packet->dest)) { 1080 if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
1078 if (is4addr) { 1081 if (is4addr) {
1079 batadv_dat_inc_counter(bat_priv, 1082 batadv_dat_inc_counter(bat_priv,
1080 unicast_4addr_packet->subtype); 1083 unicast_4addr_packet->subtype);
@@ -1111,7 +1114,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1111 struct sk_buff *new_skb = NULL; 1114 struct sk_buff *new_skb = NULL;
1112 int ret; 1115 int ret;
1113 1116
1114 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 1117 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1115 return NET_RX_DROP; 1118 return NET_RX_DROP;
1116 1119
1117 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1120 if (!batadv_check_unicast_ttvn(bat_priv, skb))
@@ -1120,7 +1123,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1120 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; 1123 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
1121 1124
1122 /* packet for me */ 1125 /* packet for me */
1123 if (batadv_is_my_mac(unicast_packet->dest)) { 1126 if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
1124 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); 1127 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
1125 1128
1126 if (ret == NET_RX_DROP) 1129 if (ret == NET_RX_DROP)
@@ -1174,13 +1177,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
1174 goto out; 1177 goto out;
1175 1178
1176 /* ignore broadcasts sent by myself */ 1179 /* ignore broadcasts sent by myself */
1177 if (batadv_is_my_mac(ethhdr->h_source)) 1180 if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
1178 goto out; 1181 goto out;
1179 1182
1180 bcast_packet = (struct batadv_bcast_packet *)skb->data; 1183 bcast_packet = (struct batadv_bcast_packet *)skb->data;
1181 1184
1182 /* ignore broadcasts originated by myself */ 1185 /* ignore broadcasts originated by myself */
1183 if (batadv_is_my_mac(bcast_packet->orig)) 1186 if (batadv_is_my_mac(bat_priv, bcast_packet->orig))
1184 goto out; 1187 goto out;
1185 1188
1186 if (bcast_packet->header.ttl < 2) 1189 if (bcast_packet->header.ttl < 2)
@@ -1266,14 +1269,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb,
1266 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1269 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1267 1270
1268 /* not for me */ 1271 /* not for me */
1269 if (!batadv_is_my_mac(ethhdr->h_dest)) 1272 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
1270 return NET_RX_DROP; 1273 return NET_RX_DROP;
1271 1274
1272 /* ignore own packets */ 1275 /* ignore own packets */
1273 if (batadv_is_my_mac(vis_packet->vis_orig)) 1276 if (batadv_is_my_mac(bat_priv, vis_packet->vis_orig))
1274 return NET_RX_DROP; 1277 return NET_RX_DROP;
1275 1278
1276 if (batadv_is_my_mac(vis_packet->sender_orig)) 1279 if (batadv_is_my_mac(bat_priv, vis_packet->sender_orig))
1277 return NET_RX_DROP; 1280 return NET_RX_DROP;
1278 1281
1279 switch (vis_packet->vis_type) { 1282 switch (vis_packet->vis_type) {