Hello people,
****
This is the **fifth** version of this patchset. The whole code has been reviewed
after some discussions on irc and here in the ml in the previous threads.
Several bugs have been spotted and fixed. Thanks Marek, Sven, Simon, Andrew and
all the others for the comments/feedbacks.
This patchset assumes that patch
[PATCH] batman-adv: add biggest_unsigned_int(x) macro
has already been applied
****
For details about the DAT mechanism, please refer to the preliminary
documentation that has already been put on the wiki[1]. A more exhaustive and
detailed documentation is going to come soon.
PatchsetV5 Additions:
------------------------
- Sanity check for ARP messages (messages containing multicast/loopback
addresses are ignored)
- A new unicast packet type has been introduced (UNICAST_4ADDR), which contains
the originator address and the payload type.
- Thanks to this new packet type, more and more debugging messages have been
added. In this way it is easier to track the behaviour of DAT and it is possible to
understand who and why added a given entry in the soft_iface ARP table.
Hi folks,
after having the B.A.T.M.A.N. IV routing code moved into one single file, a
preliminary routing protocol API and an easy to use routing protocol switch it
is time to move forward with B.A.T.M.A.N. V.
B.A.T.M.A.N. V is going to split the various tasks handled by the B.A.T.M.A.N.
IV OGM protocol into subprotocols which will allow us to optimize each
protocol much better. The ELP protocol is the first of these subprotocols to
come. The initial ideas surrounding this protocol type are more than 2-3 years
old. At some point Linus was the driving force behind the protocol
development. Thanks to him we have proper documentation[1] as well as some
code in his repository[2] (still called ndp). I began rebasing and integrating
his code [3]. It will take a couple of patch series to get the API and the old
ELP code base into shape.
Cheers,
Marek
[1] http://www.open-mesh.org/wiki/batman-adv/ELP
[2] http://git.open-mesh.org/?p=t_x/batman-adv.git;a=summary
[3] http://git.open-mesh.org/?p=marek/batman-adv.git;a=summary
On Sunday, February 12, 2012 21:03:20 you wrote:
> 2012/2/12 Marek Lindner <lindner_marek(a)yahoo.de>:
> > On Saturday, February 11, 2012 08:36:22 Gioacchino Mazzurco wrote:
> >> After upgrading to latest batman version on openwt batman stopped adding
> >> ethernet or bridge interfaces at start...
> >>
> >> it add only wireless interfaces
> >
> > Last night we got to the bottom of this. The new hotplug based system is
> > at the core of the issue: The Ethernet driver on the device is compiled
> > into the kernel, thus loaded before the batman-adv kernel module is
> > loaded. As a result the "interface add" event is triggered before
> > batman-adv is active and the device can't be added to the batman-adv
> > mesh.
> >
> > Filippo, I cc'ed you because you are the "father" of the hotplug based
> > system. Seems we are having some side effects. Any idea how to fix it ?
> >
> > Regards,
> > Marek
>
> I need a few more hours and i'll send a full worked patch.
Any particular reason that you always email me privately ?
At this point it would be better to discuss a possible solution first. What if
your patch does not work ? We can save time by talking about a solution before
implementing it.
Regards,
Marek
9fd6b0615b5499b270d39a92b8790e206cf75833 introduced some regressions in the
daily checks on open-mesh.org. Those were only visible when
CONFIG_BATMAN_ADV_BLA was disabled. The reason was the usage of defines to
replace the calls for not available functions. The actual c compiler is not
able to distinguish between the used and unused variables because it doesn't
see the function call anymore. The second problem was the use of simple
subscopes where "do {} while(0)" whould have been necessary.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
bridge_loop_avoidance.h | 5 +++--
soft-interface.c | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h
index 24d7f16..2758b8c 100644
--- a/bridge_loop_avoidance.h
+++ b/bridge_loop_avoidance.h
@@ -46,9 +46,10 @@ void bla_free(struct bat_priv *bat_priv);
#define bla_claim_table_seq_print_text (0)
#define bla_is_backbone_gw_orig(...) (0)
#define bla_check_bcast_duplist(...) (0)
-#define bla_update_orig_address(...) {}
+#define bla_update_orig_address(...) do {} while (0)
#define bla_init(...) (1)
-#define bla_free(...) {}
+#define bla_free(...) do {} while (0)
+
#endif /* ifdef CONFIG_BATMAN_ADV_BLA */
diff --git a/soft-interface.c b/soft-interface.c
index 8de8779..579f509 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -132,7 +132,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00, 0x00};
unsigned int header_len = 0;
int data_len = skb->len, ret;
- short vid = -1;
+ short vid __maybe_unused = -1;
bool do_bcast = false;
if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
@@ -253,7 +253,7 @@ void interface_rx(struct net_device *soft_iface,
struct bat_priv *bat_priv = netdev_priv(soft_iface);
struct ethhdr *ethhdr;
struct vlan_ethhdr *vhdr;
- short vid = -1;
+ short vid __maybe_unused = -1;
/* check if enough space is available for pulling, and pull */
if (!pskb_may_pull(skb, hdr_size))
--
1.7.9
in case of dynamic type variable, it could be needed to compute at compile time
its maximal value. This macro helps in doing that for unsigned integer types
Signed-off-by: Antonio Quartulli <ordex(a)autistici.org>
---
main.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/main.h b/main.h
index 464439f..3c58235 100644
--- a/main.h
+++ b/main.h
@@ -210,6 +210,9 @@ static inline int compare_eth(const void *data1, const void *data2)
/* Returns the smallest signed integer in two's complement with the sizeof x */
#define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u)))
+/* Returns the biggest unsigned integer with the sizeof x */
+#define biggest_unsigned_int(x) (~(x)0)
+
/* Checks if a sequence number x is a predecessor/successor of y.
* they handle overflows/underflows and can correctly check for a
* predecessor/successor unless the variable sequence number has grown by
--
1.7.3.4
Signed-off-by: Simon Wunderlich <siwu(a)hrz.tu-chemnitz.de>
---
debug.c | 6 +++---
debug.h | 4 ++--
main.c | 50 ++++++++++++++++++++++++++++----------------------
man/batctl.8 | 7 +++++--
sys.c | 12 ++++++++++++
sys.h | 2 ++
6 files changed, 52 insertions(+), 29 deletions(-)
diff --git a/debug.c b/debug.c
index 6a553ff..155f499 100644
--- a/debug.c
+++ b/debug.c
@@ -61,13 +61,13 @@ void trans_global_usage(void)
printf(" \t -w [interval] watch mode - refresh the global translation table continuously\n");
}
-void softif_neigh_usage(void)
+void bla_claim_table_usage(void)
{
- printf("Usage: batctl [options] softif_neigh \n");
+ printf("Usage: batctl [options] claimtable \n");
printf("options:\n");
printf(" \t -h print this help\n");
printf(" \t -n don't replace mac addresses with bat-host names\n");
- printf(" \t -w [interval] watch mode - refresh the soft-interface neighbor table continuously\n");
+ printf(" \t -w [interval] watch mode - refresh the bridge loop avoidance claim table continuously\n");
}
void gateways_usage(void)
diff --git a/debug.h b/debug.h
index 939f281..50d0e24 100644
--- a/debug.h
+++ b/debug.h
@@ -24,7 +24,7 @@
#define DEBUG_ORIGINATORS "originators"
#define DEBUG_TRANSTABLE_LOCAL "transtable_local"
#define DEBUG_TRANSTABLE_GLOBAL "transtable_global"
-#define DEBUG_SOFTIF_NEIGH "softif_neigh"
+#define DEBUG_BLA_CLAIM_TABLE "bla_claim_table"
#define DEBUG_GATEWAYS "gateways"
#define DEBUG_VIS_DATA "vis_data"
#define DEBUG_LOG "log"
@@ -32,7 +32,7 @@
void originators_usage(void);
void trans_local_usage(void);
void trans_global_usage(void);
-void softif_neigh_usage(void);
+void bla_claim_table_usage(void);
void gateways_usage(void);
int handle_debug_table(char *mesh_iface, int argc, char **argv,
char *file_path, void table_usage(void));
diff --git a/main.c b/main.c
index 0dfdb8e..86e2078 100644
--- a/main.c
+++ b/main.c
@@ -45,27 +45,28 @@ char module_ver_path[] = "/sys/module/batman_adv/version";
void print_usage(void) {
printf("Usage: batctl [options] commands \n");
printf("commands:\n");
- printf(" \tinterface|if [add|del iface(s)]\tdisplay or modify the interface settings\n");
- printf(" \toriginators|o \tdisplay the originator table\n");
- printf(" \tinterval|it [orig_interval] \tdisplay or modify the originator interval (in ms)\n");
- printf(" \tloglevel|ll [level] \tdisplay or modify the log level\n");
- printf(" \tlog|l \tread the log produced by the kernel module\n");
- printf(" \tgw_mode|gw [mode] \tdisplay or modify the gateway mode\n");
- printf(" \tgateways|gwl \tdisplay the gateway server list\n");
- printf(" \ttranslocal|tl \tdisplay the local translation table\n");
- printf(" \ttransglobal|tg \tdisplay the global translation table\n");
- printf(" \tsoftif_neigh|sn \tdisplay the soft-interface neighbor table\n");
- printf(" \tvis_mode|vm [mode] \tdisplay or modify the status of the VIS server\n");
- printf(" \tvis_data|vd [dot|JSON] \tdisplay the VIS data in dot or JSON format\n");
- printf(" \taggregation|ag [0|1] \tdisplay or modify the packet aggregation setting\n");
- printf(" \tbonding|b [0|1] \tdisplay or modify the bonding mode setting\n");
- printf(" \tfragmentation|f [0|1] \tdisplay or modify the fragmentation mode setting\n");
- printf(" \tap_isolation|ap [0|1] \tdisplay or modify the ap isolation mode setting\n");
+ printf(" \tinterface|if [add|del iface(s)]\tdisplay or modify the interface settings\n");
+ printf(" \toriginators|o \tdisplay the originator table\n");
+ printf(" \tinterval|it [orig_interval] \tdisplay or modify the originator interval (in ms)\n");
+ printf(" \tloglevel|ll [level] \tdisplay or modify the log level\n");
+ printf(" \tlog|l \tread the log produced by the kernel module\n");
+ printf(" \tgw_mode|gw [mode] \tdisplay or modify the gateway mode\n");
+ printf(" \tgateways|gwl \tdisplay the gateway server list\n");
+ printf(" \ttranslocal|tl \tdisplay the local translation table\n");
+ printf(" \ttransglobal|tg \tdisplay the global translation table\n");
+ printf(" \tclaimtable|cl \tdisplay the bridge loop avoidance claim table\n");
+ printf(" \tvis_mode|vm [mode] \tdisplay or modify the status of the VIS server\n");
+ printf(" \tvis_data|vd [dot|JSON] \tdisplay the VIS data in dot or JSON format\n");
+ printf(" \taggregation|ag [0|1] \tdisplay or modify the packet aggregation setting\n");
+ printf(" \tbonding|b [0|1] \tdisplay or modify the bonding mode setting\n");
+ printf(" \tbridge_loop_avoidance|bl [0|1] \tdisplay or modify the bridge loop avoidance setting\n");
+ printf(" \tfragmentation|f [0|1] \tdisplay or modify the fragmentation mode setting\n");
+ printf(" \tap_isolation|ap [0|1] \tdisplay or modify the ap isolation mode setting\n");
printf("\n");
- printf(" \tping|p <destination> \tping another batman adv host via layer 2\n");
- printf(" \ttraceroute|tr <destination> \ttraceroute another batman adv host via layer 2\n");
- printf(" \ttcpdump|td <interface> \ttcpdump layer 2 traffic on the given interface\n");
- printf(" \tbisect <file1> .. <fileN>\tanalyze given log files for routing stability\n");
+ printf(" \tping|p <destination> \tping another batman adv host via layer 2\n");
+ printf(" \ttraceroute|tr <destination> \ttraceroute another batman adv host via layer 2\n");
+ printf(" \ttcpdump|td <interface> \ttcpdump layer 2 traffic on the given interface\n");
+ printf(" \tbisect <file1> .. <fileN>\tanalyze given log files for routing stability\n");
printf("options:\n");
printf(" \t-m mesh interface (default 'bat0')\n");
printf(" \t-h print this help (or 'batctl <command> -h' for the command specific help)\n");
@@ -151,10 +152,10 @@ int main(int argc, char **argv)
ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
DEBUG_TRANSTABLE_GLOBAL, trans_global_usage);
- } else if ((strcmp(argv[1], "softif_neigh") == 0) || (strcmp(argv[1], "sn") == 0)) {
+ } else if ((strcmp(argv[1], "claimtable") == 0) || (strcmp(argv[1], "cl") == 0)) {
ret = handle_debug_table(mesh_iface, argc - 1, argv + 1,
- DEBUG_SOFTIF_NEIGH, softif_neigh_usage);
+ DEBUG_BLA_CLAIM_TABLE, bla_claim_table_usage);
} else if ((strcmp(argv[1], "loglevel") == 0) || (strcmp(argv[1], "ll") == 0)) {
@@ -197,6 +198,11 @@ int main(int argc, char **argv)
ret = handle_sys_setting(mesh_iface, argc - 1, argv + 1,
SYS_BONDING, bonding_usage, sysfs_param_enable);
+ } else if ((strcmp(argv[1], "bridge_loop_avoidance") == 0) || (strcmp(argv[1], "bl") == 0)) {
+
+ ret = handle_sys_setting(mesh_iface, argc - 1, argv + 1,
+ SYS_BRIDGE_LOOP_AVOIDANCE, bridge_loop_avoidance_usage, sysfs_param_enable);
+
} else if ((strcmp(argv[1], "fragmentation") == 0) || (strcmp(argv[1], "f") == 0)) {
ret = handle_sys_setting(mesh_iface, argc - 1, argv + 1,
diff --git a/man/batctl.8 b/man/batctl.8
index 0cf0a7b..f45a070 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -121,8 +121,8 @@ Display the local translation table. batctl will refresh the list every second i
.IP "\fBtransglobal\fP|\fBtg\fP [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
Display the global translation table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
.br
-.IP "\fBsoftif_neigh\fP|\fBsn\fP [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
-Display the soft\-interface neighbor table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
+.IP "\fBclaimtable\fP|\fBcl\fP [\fB\-w\fP [\fI\interval\fP]][\fB\-n\fP]"
+Display the bridge loop avoidance claim table. batctl will refresh the list every second if the "\-w" option was given or add a number to let it refresh at a custom interval in seconds (with optional decimal places). Use "\-n" to let batctl not replace the MAC addresses with bat\-host names in the output.
.br
.IP "\fBvis_mode|vm\fP [\fBmode\fP]\fP"
If no parameter is given the current vis mode is displayed otherwise the parameter is used to set the vis mode.
@@ -149,6 +149,9 @@ If no parameter is given the current aggregation setting is displayed. Otherwise
.IP "\fBbonding\fP|\fBb\fP [\fB1\fP|\fB0\fP]"
If no parameter is given the current bonding mode setting is displayed. Otherwise the parameter is used to enable or disable the bonding mode.
.br
+.IP "\fBbridge_loop_avoidance\fP|\fBbl\fP [\fB1\fP|\fB0\fP]"
+If no parameter is given the current bridge loop avoidance setting is displayed. Otherwise the parameter is used to enable or disable the bridge loop avoidance.
+.br
.IP "\fBfragmentation\fP|\fBf\fP [\fB1\fP|\fB0\fP]"
If no parameter is given the current fragmentation mode setting is displayed. Otherwise the parameter is used to enable or disable fragmentation.
.br
diff --git a/sys.c b/sys.c
index 0263ae7..6cf4714 100644
--- a/sys.c
+++ b/sys.c
@@ -183,6 +183,7 @@ static void log_level_usage(void)
printf(" \t batman Messages related to routing / flooding / broadcasting\n");
printf(" \t routes Messages related to route added / changed / deleted\n");
printf(" \t tt Messages related to translation table operations\n");
+ printf(" \t bla Messages related to bridge loop avoidance\n");
}
int handle_loglevel(char *mesh_iface, int argc, char **argv)
@@ -221,6 +222,8 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
log_level |= (1 << 1);
else if (strcmp(argv[i], "tt") == 0)
log_level |= (1 << 2);
+ else if (strcmp(argv[i], "bla") == 0)
+ log_level |= (1 << 4);
else {
log_level_usage();
goto out;
@@ -248,6 +251,8 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
"messages related to route added / changed / deleted", "routes");
printf("[%c] %s (%s)\n", (log_level & 4) ? 'x' : ' ',
"messages related to translation table operations", "tt");
+ printf("[%c] %s (%s)\n", (log_level & 8) ? 'x' : ' ',
+ "messages related to bridge loop avoidance", "bla");
out:
if (errno == ENOENT)
@@ -271,6 +276,13 @@ void bonding_usage(void)
printf(" \t -h print this help\n");
}
+void bridge_loop_avoidance_usage(void)
+{
+ printf("Usage: batctl [options] bridge_loop_avoidance [0|1]\n");
+ printf("options:\n");
+ printf(" \t -h print this help\n");
+}
+
void gw_mode_usage(void)
{
printf("Usage: batctl [options] gw_mode [mode] [sel_class|bandwidth]\n");
diff --git a/sys.h b/sys.h
index 5dafe85..46a1159 100644
--- a/sys.h
+++ b/sys.h
@@ -25,6 +25,7 @@
#define SYS_LOG "log"
#define SYS_AGGR "aggregated_ogms"
#define SYS_BONDING "bonding"
+#define SYS_BRIDGE_LOOP_AVOIDANCE "bridge_loop_avoidance"
#define SYS_GW_MODE "gw_mode"
#define SYS_GW_SEL "gw_sel_class"
#define SYS_GW_BW "gw_bandwidth"
@@ -47,6 +48,7 @@ extern const char *sysfs_param_server[];
void aggregation_usage(void);
void bonding_usage(void);
+void bridge_loop_avoidance_usage(void);
void fragmentation_usage(void);
void ap_isolation_usage(void);
void gw_mode_usage(void);
--
1.7.8.3