diff options
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r-- | net/batman-adv/soft-interface.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 05dd35114a27..f9cc95728989 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -445,30 +445,31 @@ static void softif_batman_recv(struct sk_buff *skb, struct net_device *dev, | |||
445 | { | 445 | { |
446 | struct bat_priv *bat_priv = netdev_priv(dev); | 446 | struct bat_priv *bat_priv = netdev_priv(dev); |
447 | struct ethhdr *ethhdr = (struct ethhdr *)skb->data; | 447 | struct ethhdr *ethhdr = (struct ethhdr *)skb->data; |
448 | struct batman_packet *batman_packet; | 448 | struct batman_ogm_packet *batman_ogm_packet; |
449 | struct softif_neigh *softif_neigh = NULL; | 449 | struct softif_neigh *softif_neigh = NULL; |
450 | struct hard_iface *primary_if = NULL; | 450 | struct hard_iface *primary_if = NULL; |
451 | struct softif_neigh *curr_softif_neigh = NULL; | 451 | struct softif_neigh *curr_softif_neigh = NULL; |
452 | 452 | ||
453 | if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) | 453 | if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) |
454 | batman_packet = (struct batman_packet *) | 454 | batman_ogm_packet = (struct batman_ogm_packet *) |
455 | (skb->data + ETH_HLEN + VLAN_HLEN); | 455 | (skb->data + ETH_HLEN + VLAN_HLEN); |
456 | else | 456 | else |
457 | batman_packet = (struct batman_packet *)(skb->data + ETH_HLEN); | 457 | batman_ogm_packet = (struct batman_ogm_packet *) |
458 | (skb->data + ETH_HLEN); | ||
458 | 459 | ||
459 | if (batman_packet->version != COMPAT_VERSION) | 460 | if (batman_ogm_packet->version != COMPAT_VERSION) |
460 | goto out; | 461 | goto out; |
461 | 462 | ||
462 | if (batman_packet->packet_type != BAT_PACKET) | 463 | if (batman_ogm_packet->packet_type != BAT_OGM) |
463 | goto out; | 464 | goto out; |
464 | 465 | ||
465 | if (!(batman_packet->flags & PRIMARIES_FIRST_HOP)) | 466 | if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) |
466 | goto out; | 467 | goto out; |
467 | 468 | ||
468 | if (is_my_mac(batman_packet->orig)) | 469 | if (is_my_mac(batman_ogm_packet->orig)) |
469 | goto out; | 470 | goto out; |
470 | 471 | ||
471 | softif_neigh = softif_neigh_get(bat_priv, batman_packet->orig, vid); | 472 | softif_neigh = softif_neigh_get(bat_priv, batman_ogm_packet->orig, vid); |
472 | if (!softif_neigh) | 473 | if (!softif_neigh) |
473 | goto out; | 474 | goto out; |
474 | 475 | ||
@@ -532,11 +533,11 @@ static int interface_set_mac_addr(struct net_device *dev, void *p) | |||
532 | if (!is_valid_ether_addr(addr->sa_data)) | 533 | if (!is_valid_ether_addr(addr->sa_data)) |
533 | return -EADDRNOTAVAIL; | 534 | return -EADDRNOTAVAIL; |
534 | 535 | ||
535 | /* only modify transtable if it has been initialised before */ | 536 | /* only modify transtable if it has been initialized before */ |
536 | if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) { | 537 | if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) { |
537 | tt_local_remove(bat_priv, dev->dev_addr, | 538 | tt_local_remove(bat_priv, dev->dev_addr, |
538 | "mac address changed", false); | 539 | "mac address changed", false); |
539 | tt_local_add(dev, addr->sa_data); | 540 | tt_local_add(dev, addr->sa_data, NULL_IFINDEX); |
540 | } | 541 | } |
541 | 542 | ||
542 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | 543 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
@@ -595,11 +596,12 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
595 | goto dropped; | 596 | goto dropped; |
596 | 597 | ||
597 | /* Register the client MAC in the transtable */ | 598 | /* Register the client MAC in the transtable */ |
598 | tt_local_add(soft_iface, ethhdr->h_source); | 599 | tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); |
599 | 600 | ||
600 | orig_node = transtable_search(bat_priv, ethhdr->h_dest); | 601 | orig_node = transtable_search(bat_priv, ethhdr->h_source, |
602 | ethhdr->h_dest); | ||
601 | do_bcast = is_multicast_ether_addr(ethhdr->h_dest); | 603 | do_bcast = is_multicast_ether_addr(ethhdr->h_dest); |
602 | if (do_bcast || (orig_node && orig_node->gw_flags)) { | 604 | if (do_bcast || (orig_node && orig_node->gw_flags)) { |
603 | ret = gw_is_target(bat_priv, skb, orig_node); | 605 | ret = gw_is_target(bat_priv, skb, orig_node); |
604 | 606 | ||
605 | if (ret < 0) | 607 | if (ret < 0) |
@@ -739,6 +741,9 @@ void interface_rx(struct net_device *soft_iface, | |||
739 | 741 | ||
740 | soft_iface->last_rx = jiffies; | 742 | soft_iface->last_rx = jiffies; |
741 | 743 | ||
744 | if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) | ||
745 | goto dropped; | ||
746 | |||
742 | netif_rx(skb); | 747 | netif_rx(skb); |
743 | goto out; | 748 | goto out; |
744 | 749 | ||
@@ -796,10 +801,8 @@ struct net_device *softif_create(const char *name) | |||
796 | 801 | ||
797 | soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup); | 802 | soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup); |
798 | 803 | ||
799 | if (!soft_iface) { | 804 | if (!soft_iface) |
800 | pr_err("Unable to allocate the batman interface: %s\n", name); | ||
801 | goto out; | 805 | goto out; |
802 | } | ||
803 | 806 | ||
804 | ret = register_netdevice(soft_iface); | 807 | ret = register_netdevice(soft_iface); |
805 | if (ret < 0) { | 808 | if (ret < 0) { |
@@ -812,6 +815,7 @@ struct net_device *softif_create(const char *name) | |||
812 | 815 | ||
813 | atomic_set(&bat_priv->aggregated_ogms, 1); | 816 | atomic_set(&bat_priv->aggregated_ogms, 1); |
814 | atomic_set(&bat_priv->bonding, 0); | 817 | atomic_set(&bat_priv->bonding, 0); |
818 | atomic_set(&bat_priv->ap_isolation, 0); | ||
815 | atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); | 819 | atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); |
816 | atomic_set(&bat_priv->gw_mode, GW_MODE_OFF); | 820 | atomic_set(&bat_priv->gw_mode, GW_MODE_OFF); |
817 | atomic_set(&bat_priv->gw_sel_class, 20); | 821 | atomic_set(&bat_priv->gw_sel_class, 20); |