On Thursday, February 09, 2012 03:05:58 Martin Hundebøll wrote:
For testing purposes, forcing specific paths in a network where all nodes are within reach, can be useful. This patch allows the use to enter addresses from which direct OGMs should be ignored.
An address is added by echoing it into /sys/class/net/bat0/filter_add_addr and removed again by echoing the same address into /sys/class/net/bat0/filter_del_addr. The list of currently blocked direct OGM sources is available in /sys/kernel/debug/batman-adv/bat0/filter_table.
In addition to what Antonio has already pointed out:
diff --git a/bat_sysfs.c b/bat_sysfs.c index 3adb183..0fc5e3e 100644 --- a/bat_sysfs.c +++ b/bat_sysfs.c @@ -27,6 +27,7 @@ #include "gateway_common.h" #include "gateway_client.h" #include "vis.h" +#include "filter.h"
static struct net_device *kobj_to_netdev(struct kobject *obj) { @@ -384,11 +385,49 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr, return gw_bandwidth_set(net_dev, buff, count); }
It might be better to move filter_add/filter_del into debugfs. There we have less "regulation rules" and more freedom when it comes to the syntax and what we add. It is for debugging purposes anyways.
Do you plan to add more "filters" in the future ? Otherwise I'd rather call it "block_orig/unblock_orig". Seems more obvious than the generic "filter".
- if ((res = filter_parse_addr_str(buff, count, mac)) < 0) {
bat_info(net_dev, "Address has invalid format: %s\n", buff);
return res;
Is there no existing kernel function for the mac address parsing ?
+void filter_addr_add(struct bat_priv *bat_priv, const uint8_t *addr) +{
- struct orig_node *orig_node = orig_hash_find(bat_priv, addr);
- if (!orig_node)
return;
- atomic_set(&orig_node->filter, FILTER_TRUE);
- orig_node_free_ref(orig_node);
+}
This will only allow blocking an originator if it is already there. What if I configure my node before the mesh is up ? For example via scripts ?
Cheers, Marek