This patch enables the forwarding of multicast data and uses the same methods for deciding to forward via broad- or unicast(s) as the local packet encapsulation already did.
Signed-off-by: Linus Lüssing linus.luessing@saxnet.de --- multicast.c | 2 +- multicast.h | 1 + routing.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/batman-adv/multicast.c b/batman-adv/multicast.c index a8613ef..70184cf 100644 --- a/batman-adv/multicast.c +++ b/batman-adv/multicast.c @@ -1241,7 +1241,7 @@ static inline void nexthops_from_table(uint8_t *dest, uint8_t *orig, } }
-static void route_mcast_packet(struct sk_buff *skb, struct bat_priv *bat_priv) +void route_mcast_packet(struct sk_buff *skb, struct bat_priv *bat_priv) { struct sk_buff *skb1; struct mcast_packet *mcast_packet; diff --git a/batman-adv/multicast.h b/batman-adv/multicast.h index 06dd398..6dcf537 100644 --- a/batman-adv/multicast.h +++ b/batman-adv/multicast.h @@ -32,6 +32,7 @@ void route_mcast_tracker_packet( int tracker_packet_len, struct bat_priv *bat_priv); void purge_mcast_forw_table(struct bat_priv *bat_priv); int mcast_forw_table_seq_print_text(struct seq_file *seq, void *offset); +void route_mcast_packet(struct sk_buff *skb, struct bat_priv *bat_priv); int mcast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv); int mcast_init(struct bat_priv *bat_priv); void mcast_free(struct bat_priv *bat_priv); diff --git a/batman-adv/routing.c b/batman-adv/routing.c index b5559c0..512d9ba 100644 --- a/batman-adv/routing.c +++ b/batman-adv/routing.c @@ -1512,6 +1512,7 @@ out:
int recv_mcast_packet(struct sk_buff *skb, struct batman_if *recv_if) { + struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct ethhdr *ethhdr; MC_LIST *mc_entry; int ret = 1; @@ -1522,6 +1523,9 @@ int recv_mcast_packet(struct sk_buff *skb, struct batman_if *recv_if) check_broadcast_packet(skb, hdr_size) < 0) return NET_RX_DROP;
+ /* forward multicast packet if necessary */ + route_mcast_packet(skb, bat_priv); + ethhdr = (struct ethhdr *)(skb->data + sizeof(struct mcast_packet));
/* multicast for me? */