batman-adv: reorder packet types
Reordering the packet type numbers allows us to handle unicast packets in a general way - even if we don't know the specific packet type, we can still forward it. There was already code handling this for a couple of unicast packets, and this is the more generalized version to do that. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
This commit is contained in:

committed by
Antonio Quartulli

parent
80067c8320
commit
a1f1ac5c4d
@@ -911,6 +911,34 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* batadv_recv_unhandled_unicast_packet - receive and process packets which
|
||||
* are in the unicast number space but not yet known to the implementation
|
||||
* @skb: unicast tvlv packet to process
|
||||
* @recv_if: pointer to interface this packet was received on
|
||||
*
|
||||
* Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP
|
||||
* otherwise.
|
||||
*/
|
||||
int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb,
|
||||
struct batadv_hard_iface *recv_if)
|
||||
{
|
||||
struct batadv_unicast_packet *unicast_packet;
|
||||
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
|
||||
int check, hdr_size = sizeof(*unicast_packet);
|
||||
|
||||
check = batadv_check_unicast_packet(bat_priv, skb, hdr_size);
|
||||
if (check < 0)
|
||||
return NET_RX_DROP;
|
||||
|
||||
/* we don't know about this type, drop it. */
|
||||
unicast_packet = (struct batadv_unicast_packet *)skb->data;
|
||||
if (batadv_is_my_mac(bat_priv, unicast_packet->dest))
|
||||
return NET_RX_DROP;
|
||||
|
||||
return batadv_route_unicast_packet(skb, recv_if);
|
||||
}
|
||||
|
||||
int batadv_recv_unicast_packet(struct sk_buff *skb,
|
||||
struct batadv_hard_iface *recv_if)
|
||||
{
|
||||
|
Reference in New Issue
Block a user