diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-04-25 04:37:23 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-09 15:22:34 -0400 |
commit | a1f1ac5c4d045a1adc6662346733a6db3aee5a9d (patch) | |
tree | ba32dde81ad0d35055bf8102a609e6b07c8cda9d /net/batman-adv/routing.c | |
parent | 80067c8320aebab6d740e07be6ecf3dd04787f60 (diff) |
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>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r-- | net/batman-adv/routing.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 2a9318bd9026..457dfef9c5fc 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -911,6 +911,34 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
911 | return 1; | 911 | return 1; |
912 | } | 912 | } |
913 | 913 | ||
914 | /** | ||
915 | * batadv_recv_unhandled_unicast_packet - receive and process packets which | ||
916 | * are in the unicast number space but not yet known to the implementation | ||
917 | * @skb: unicast tvlv packet to process | ||
918 | * @recv_if: pointer to interface this packet was received on | ||
919 | * | ||
920 | * Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP | ||
921 | * otherwise. | ||
922 | */ | ||
923 | int batadv_recv_unhandled_unicast_packet(struct sk_buff *skb, | ||
924 | struct batadv_hard_iface *recv_if) | ||
925 | { | ||
926 | struct batadv_unicast_packet *unicast_packet; | ||
927 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | ||
928 | int check, hdr_size = sizeof(*unicast_packet); | ||
929 | |||
930 | check = batadv_check_unicast_packet(bat_priv, skb, hdr_size); | ||
931 | if (check < 0) | ||
932 | return NET_RX_DROP; | ||
933 | |||
934 | /* we don't know about this type, drop it. */ | ||
935 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | ||
936 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) | ||
937 | return NET_RX_DROP; | ||
938 | |||
939 | return batadv_route_unicast_packet(skb, recv_if); | ||
940 | } | ||
941 | |||
914 | int batadv_recv_unicast_packet(struct sk_buff *skb, | 942 | int batadv_recv_unicast_packet(struct sk_buff *skb, |
915 | struct batadv_hard_iface *recv_if) | 943 | struct batadv_hard_iface *recv_if) |
916 | { | 944 | { |