diff options
author | Antonio Quartulli <ordex@autistici.org> | 2011-07-07 09:35:35 -0400 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2011-08-22 09:16:20 -0400 |
commit | bc2790808a7a3699a7c9f72f7ad225c8504824aa (patch) | |
tree | a1b0e88091facf44e0afb78d3438c55cfd6633ad /net/batman-adv/translation-table.c | |
parent | 015758d00251a4dd9287806cdab4b9c1298f97ed (diff) |
batman-adv: detect clients connected through a 802.11 device
Clients connected through a 802.11 device are now marked with the
TT_CLIENT_WIFI flag. This flag is also advertised with the tt
announcement.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 6004cd8eb9c7..d6305645e08d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -183,7 +183,8 @@ static int tt_local_init(struct bat_priv *bat_priv) | |||
183 | return 1; | 183 | return 1; |
184 | } | 184 | } |
185 | 185 | ||
186 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) | 186 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
187 | int ifindex) | ||
187 | { | 188 | { |
188 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 189 | struct bat_priv *bat_priv = netdev_priv(soft_iface); |
189 | struct tt_local_entry *tt_local_entry = NULL; | 190 | struct tt_local_entry *tt_local_entry = NULL; |
@@ -207,6 +208,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) | |||
207 | memcpy(tt_local_entry->addr, addr, ETH_ALEN); | 208 | memcpy(tt_local_entry->addr, addr, ETH_ALEN); |
208 | tt_local_entry->last_seen = jiffies; | 209 | tt_local_entry->last_seen = jiffies; |
209 | tt_local_entry->flags = NO_FLAGS; | 210 | tt_local_entry->flags = NO_FLAGS; |
211 | if (is_wifi_iface(ifindex)) | ||
212 | tt_local_entry->flags |= TT_CLIENT_WIFI; | ||
210 | atomic_set(&tt_local_entry->refcount, 2); | 213 | atomic_set(&tt_local_entry->refcount, 2); |
211 | 214 | ||
212 | /* the batman interface mac address should never be purged */ | 215 | /* the batman interface mac address should never be purged */ |
@@ -495,7 +498,8 @@ static void tt_changes_list_free(struct bat_priv *bat_priv) | |||
495 | 498 | ||
496 | /* caller must hold orig_node refcount */ | 499 | /* caller must hold orig_node refcount */ |
497 | int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | 500 | int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, |
498 | const unsigned char *tt_addr, uint8_t ttvn, bool roaming) | 501 | const unsigned char *tt_addr, uint8_t ttvn, bool roaming, |
502 | bool wifi) | ||
499 | { | 503 | { |
500 | struct tt_global_entry *tt_global_entry; | 504 | struct tt_global_entry *tt_global_entry; |
501 | struct orig_node *orig_node_tmp; | 505 | struct orig_node *orig_node_tmp; |
@@ -537,6 +541,9 @@ int tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node, | |||
537 | tt_global_entry->roam_at = 0; | 541 | tt_global_entry->roam_at = 0; |
538 | } | 542 | } |
539 | 543 | ||
544 | if (wifi) | ||
545 | tt_global_entry->flags |= TT_CLIENT_WIFI; | ||
546 | |||
540 | bat_dbg(DBG_TT, bat_priv, | 547 | bat_dbg(DBG_TT, bat_priv, |
541 | "Creating new global tt entry: %pM (via %pM)\n", | 548 | "Creating new global tt entry: %pM (via %pM)\n", |
542 | tt_global_entry->addr, orig_node->orig); | 549 | tt_global_entry->addr, orig_node->orig); |
@@ -1363,7 +1370,9 @@ static void _tt_update_changes(struct bat_priv *bat_priv, | |||
1363 | (tt_change + i)->flags & TT_CLIENT_ROAM); | 1370 | (tt_change + i)->flags & TT_CLIENT_ROAM); |
1364 | else | 1371 | else |
1365 | if (!tt_global_add(bat_priv, orig_node, | 1372 | if (!tt_global_add(bat_priv, orig_node, |
1366 | (tt_change + i)->addr, ttvn, false)) | 1373 | (tt_change + i)->addr, ttvn, false, |
1374 | (tt_change + i)->flags & | ||
1375 | TT_CLIENT_WIFI)) | ||
1367 | /* In case of problem while storing a | 1376 | /* In case of problem while storing a |
1368 | * global_entry, we stop the updating | 1377 | * global_entry, we stop the updating |
1369 | * procedure without committing the | 1378 | * procedure without committing the |