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 <[email protected]>
---
 multicast.c |    2 +-
 multicast.h |    1 +
 routing.c   |    4 ++++
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/multicast.c b/multicast.c
index 72249ef..042d392 100644
--- a/multicast.c
+++ b/multicast.c
@@ -1059,7 +1059,7 @@ int mcast_forw_table_seq_print_text(struct seq_file *seq, 
void *offset)
        return 0;
 }
 
-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/multicast.h b/multicast.h
index 06dd398..6dcf537 100644
--- a/multicast.h
+++ b/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/routing.c b/routing.c
index b1aad26..f9582be 100644
--- a/routing.c
+++ b/routing.c
@@ -1390,6 +1390,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct 
batman_if *recv_if)
 
 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;
        unsigned long flags;
@@ -1401,6 +1402,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? */
-- 
1.7.1

Reply via email to