Skip to contentSkip to conversation

batman-adv: Split the setting for number re-broadcasts

RFC In review Sven Eckelmann 2 participants 4 messages Mar 30, 2016 – Mar 31, 2016 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

RFC 1/2 batman-adv: Split the setting for number re-broadcasts

The number of rebroadcasts are currently not differenciated between re-broadcasts on the same interface and the re-broadcasts on a different interface. This differenciation can be important when the link medium already guarantees to some extend that a packet received by one participant is also received by all other participants.

---
 net/batman-adv/hard-interface.c | 10 +++++++---
 net/batman-adv/main.h           |  3 ++-
 net/batman-adv/send.c           |  8 +++++++-
 net/batman-adv/types.h          |  8 ++++++--
 4 files changed, 22 insertions(+), 7 deletions(-)
net/batman-adv/hard-interface.c +7 -3
index f41b472..a8385fa 100644
@@ -678,9 +678,13 @@ batadv_hardif_add_interface(struct net_device *net_dev)
 
 	spin_lock_init(&hard_iface->neigh_list_lock);
 
-	hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
-	if (batadv_is_wifi_netdev(net_dev))
-		hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
+	if (batadv_is_wifi_netdev(net_dev)) {
+		hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_WIRELESS;
+		hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_WIRELESS;
+	} else {
+		hard_iface->num_bcasts_sameif = BATADV_NUM_BCASTS_SAMEIF;
+		hard_iface->num_bcasts_otherif = BATADV_NUM_BCASTS_OTHERIF;
+	}
 
 	/* extra reference for return */
 	kref_init(&hard_iface->refcount);
net/batman-adv/main.h +2 -1
index 1565df0..aad4a3a 100644
@@ -96,7 +96,8 @@
 #define BATADV_LOG_BUF_LEN 8192	  /* has to be a power of 2 */
 
 /* number of packets to send for broadcasts on different interface types */
-#define BATADV_NUM_BCASTS_DEFAULT 1
+#define BATADV_NUM_BCASTS_SAMEIF 1
+#define BATADV_NUM_BCASTS_OTHERIF 1
 #define BATADV_NUM_BCASTS_WIRELESS 3
 #define BATADV_NUM_BCASTS_MAX 3
 
net/batman-adv/send.c +7 -1
index 2e8433b..724bd6e 100644
@@ -552,6 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 	struct sk_buff *skb1;
 	struct net_device *soft_iface;
 	struct batadv_priv *bat_priv;
+	u8 num_bcasts;
 
 	delayed_work = to_delayed_work(work);
 	forw_packet = container_of(delayed_work, struct batadv_forw_packet,
@@ -575,7 +576,12 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
 		if (hard_iface->soft_iface != soft_iface)
 			continue;
 
-		if (forw_packet->num_packets >= hard_iface->num_bcasts)
+		if (forw_packet->skb->dev == hard_iface->net_dev)
+			num_bcasts = hard_iface->num_bcasts_sameif;
+		else
+			num_bcasts = hard_iface->num_bcasts_otherif;
+
+		if (forw_packet->num_packets >= num_bcasts)
 			continue;
 
 		if (!kref_get_unless_zero(&hard_iface->refcount))
net/batman-adv/types.h +6 -2
index 9abfb3e..5e80113 100644
@@ -122,7 +122,10 @@ struct batadv_hard_iface_bat_v {
  * @if_num: identificator of the interface
  * @if_status: status of the interface for batman-adv
  * @net_dev: pointer to the net_device
- * @num_bcasts: number of payload re-broadcasts on this interface (ARQ)
+ * @num_bcasts_sameif: number of payload re-broadcasts on this interface (ARQ)
+ *  when the packet was received on this interface
+ * @num_bcasts_otherif: number of payload re-broadcasts on this interface (ARQ)
+ *  when the packet was received on a different interface
  * @hardif_obj: kobject of the per interface sysfs "mesh" directory
  * @refcount: number of contexts the object is used
  * @batman_adv_ptype: packet type describing packets that should be processed by
@@ -141,7 +144,8 @@ struct batadv_hard_iface {
 	s16 if_num;
 	char if_status;
 	struct net_device *net_dev;
-	u8 num_bcasts;
+	u8 num_bcasts_sameif;
+	u8 num_bcasts_otherif;
 	struct kobject *hardif_obj;
 	struct kref refcount;
 	struct packet_type batman_adv_ptype;
Signature · 1 line
2.8.0.rc3
author maintainer
#1 lore raw

RFC 2/2 batman-adv: Don't re-broadcast packets on non-wifi devices

It is not necessary to re-broadcast a received broadcast packet on the rx-device when it is a standard ethernet device. The link medium already takes care of transporting it to all participants in the broadcast domain.

The re-broadcast on other devices is still necessary to allow the broadcast packet to be received by devices which are using a different link medium.

---
 net/batman-adv/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/main.h +1 -1
index aad4a3a..ddad99d 100644
@@ -96,7 +96,7 @@
 #define BATADV_LOG_BUF_LEN 8192	  /* has to be a power of 2 */
 
 /* number of packets to send for broadcasts on different interface types */
-#define BATADV_NUM_BCASTS_SAMEIF 1
+#define BATADV_NUM_BCASTS_SAMEIF 0
 #define BATADV_NUM_BCASTS_OTHERIF 1
 #define BATADV_NUM_BCASTS_WIRELESS 3
 #define BATADV_NUM_BCASTS_MAX 3
Signature · 1 line
2.8.0.rc3
#2 lore raw

Re: [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices

Quoted 9 lines · Sven Eckelmann

It is not necessary to re-broadcast a received broadcast packet on the rx-device when it is a standard ethernet device. The link medium already takes care of transporting it to all participants in the broadcast domain.

The re-broadcast on other devices is still necessary to allow the broadcast packet to be received by devices which are using a different link medium.

---

I don't think completely disabling the rebroadcast here without a way to enable it again is a viable option.

At least when using batman-adv over VPN tunnels, making batman-adv take care of establishing transitive connectivity may make sense, as batman-adv does this very well and without much configuration. This is actually the recommended setup for non-full-mesh setups using the VPN tool fastd (which is developed by me.)

Regards,
Matthias

author maintainer
#3 lore raw

Re: [B.A.T.M.A.N.] [RFC 2/2] batman-adv: Don't re-broadcast packets on non-wifi devices

On Thursday 31 March 2016 10:41:04 Matthias Schiffer wrote:
[...]

Quoted 8 lines

I don't think completely disabling the rebroadcast here without a way to enable it again is a viable option.

At least when using batman-adv over VPN tunnels, making batman-adv take care of establishing transitive connectivity may make sense, as batman-adv does this very well and without much configuration. This is actually the recommended setup for non-full-mesh setups using the VPN tool fastd (which is developed by me.)

Thanks for the feedback. There was also a small questionnaire answered by Adrian Reyer about fastd:
https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-March/014803.html

Kind regards,
Sven