mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
batman-adv: change interface_rx to get orig node
In order to understand where a broadcast packet is coming from and use this information to detect not yet announced clients, this patch modifies the interface_rx() function by passing a new argument: the orig node corresponding to the node that originated the received packet (if known). This new argument if not NULL for broadcast packets only (other packets does not have source field). Signed-off-by: Antonio Quartulli <ordex@autistici.org>
This commit is contained in:
parent
30cfd02b60
commit
371351731e
@ -1012,8 +1012,9 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
|
|||||||
|
|
||||||
/* packet for me */
|
/* packet for me */
|
||||||
if (batadv_is_my_mac(unicast_packet->dest)) {
|
if (batadv_is_my_mac(unicast_packet->dest)) {
|
||||||
batadv_interface_rx(recv_if->soft_iface, skb, recv_if,
|
batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size,
|
||||||
hdr_size);
|
NULL);
|
||||||
|
|
||||||
return NET_RX_SUCCESS;
|
return NET_RX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1050,7 +1051,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
|
|||||||
return NET_RX_SUCCESS;
|
return NET_RX_SUCCESS;
|
||||||
|
|
||||||
batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
|
batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
|
||||||
sizeof(struct batadv_unicast_packet));
|
sizeof(struct batadv_unicast_packet), NULL);
|
||||||
return NET_RX_SUCCESS;
|
return NET_RX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,7 +1138,8 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* broadcast for me */
|
/* broadcast for me */
|
||||||
batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size);
|
batadv_interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size,
|
||||||
|
orig_node);
|
||||||
ret = NET_RX_SUCCESS;
|
ret = NET_RX_SUCCESS;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ end:
|
|||||||
|
|
||||||
void batadv_interface_rx(struct net_device *soft_iface,
|
void batadv_interface_rx(struct net_device *soft_iface,
|
||||||
struct sk_buff *skb, struct batadv_hard_iface *recv_if,
|
struct sk_buff *skb, struct batadv_hard_iface *recv_if,
|
||||||
int hdr_size)
|
int hdr_size, struct batadv_orig_node *orig_node)
|
||||||
{
|
{
|
||||||
struct batadv_priv *bat_priv = netdev_priv(soft_iface);
|
struct batadv_priv *bat_priv = netdev_priv(soft_iface);
|
||||||
struct ethhdr *ethhdr;
|
struct ethhdr *ethhdr;
|
||||||
@ -322,6 +322,10 @@ void batadv_interface_rx(struct net_device *soft_iface,
|
|||||||
|
|
||||||
soft_iface->last_rx = jiffies;
|
soft_iface->last_rx = jiffies;
|
||||||
|
|
||||||
|
if (orig_node)
|
||||||
|
batadv_tt_add_temporary_global_entry(bat_priv, orig_node,
|
||||||
|
ethhdr->h_source);
|
||||||
|
|
||||||
if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
|
if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
|
||||||
goto dropped;
|
goto dropped;
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
|
#define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
|
||||||
|
|
||||||
int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
|
int batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
|
||||||
void batadv_interface_rx(struct net_device *soft_iface, struct sk_buff *skb,
|
void batadv_interface_rx(struct net_device *soft_iface,
|
||||||
struct batadv_hard_iface *recv_if, int hdr_size);
|
struct sk_buff *skb, struct batadv_hard_iface *recv_if,
|
||||||
|
int hdr_size, struct batadv_orig_node *orig_node);
|
||||||
struct net_device *batadv_softif_create(const char *name);
|
struct net_device *batadv_softif_create(const char *name);
|
||||||
void batadv_softif_destroy(struct net_device *soft_iface);
|
void batadv_softif_destroy(struct net_device *soft_iface);
|
||||||
int batadv_softif_is_valid(const struct net_device *net_dev);
|
int batadv_softif_is_valid(const struct net_device *net_dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user