From: Antonio Quartulli <antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
Marek Lindner
<mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>,
Antonio Quartulli
<antonio-2BnEqQcu77q1Z/+hSey0Gg@public.gmane.org>
Subject: [PATCH 13/16] batman-adv: improve the TT component to support runtime flag changes
Date: Wed, 23 Oct 2013 18:05:00 +0200 [thread overview]
Message-ID: <1382544303-2694-14-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1382544303-2694-1-git-send-email-antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
From: Antonio Quartulli <antonio-2BnEqQcu77q1Z/+hSey0Gg@public.gmane.org>
Some flags (i.e. the WIFI flag) may change after that the
related client has already been announced. However it is
useful to informa the rest of the network about this change.
Add a runtime-flag-switch detection mechanism and
re-announce the related TT entry to advertise the new flag
value.
This mechanism can be easily exploited by future flags that
may need the same treatment.
Signed-off-by: Antonio Quartulli <antonio-2BnEqQcu77q1Z/+hSey0Gg@public.gmane.org>
Signed-off-by: Marek Lindner <mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org>
---
net/batman-adv/translation-table.c | 25 ++++++++++++++++++++++++-
net/batman-adv/types.h | 6 ++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index b0fe177..267780f 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -358,6 +358,13 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv,
goto del;
if (del_op_requested && !del_op_entry)
goto del;
+
+ /* this is a second add in the same originator interval. It
+ * means that flags have been changed: update them!
+ */
+ if (!del_op_requested && !del_op_entry)
+ entry->change.flags = flags;
+
continue;
del:
list_del(&entry->list);
@@ -482,6 +489,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
struct batadv_tt_orig_list_entry *orig_entry;
int hash_added, table_size, packet_size_max;
bool ret = false, roamed_back = false;
+ uint8_t remote_flags;
if (ifindex != BATADV_NULL_IFINDEX)
in_dev = dev_get_by_index(&init_net, ifindex);
@@ -596,8 +604,23 @@ check_roaming:
}
}
- ret = true;
+ /* store the current remote flags before altering them. This helps
+ * understanding is flags are changing or not
+ */
+ remote_flags = tt_local->common.flags & BATADV_TT_REMOTE_MASK;
+
+ if (batadv_is_wifi_netdev(in_dev))
+ tt_local->common.flags |= BATADV_TT_CLIENT_WIFI;
+ else
+ tt_local->common.flags &= ~BATADV_TT_CLIENT_WIFI;
+ /* if any "dynamic" flag has been modified, resend an ADD event for this
+ * entry so that all the nodes can get the new flags
+ */
+ if (remote_flags ^ (tt_local->common.flags & BATADV_TT_REMOTE_MASK))
+ batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
+
+ ret = true;
out:
if (in_dev)
dev_put(in_dev);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 04b6b0b..61297b6 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -36,6 +36,12 @@
#endif /* CONFIG_BATMAN_ADV_DAT */
/**
+ * BATADV_TT_REMOTE_MASK - bitmask selecting the flags that are sent over the
+ * wire only
+ */
+#define BATADV_TT_REMOTE_MASK 0x00FF
+
+/**
* struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data
* @ogm_buff: buffer holding the OGM packet
* @ogm_buff_len: length of the OGM packet buffer
--
1.8.4
next prev parent reply other threads:[~2013-10-23 16:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 16:04 pull request: batman-adv 2013-10-23 Antonio Quartulli
[not found] ` <1382544303-2694-1-git-send-email-antonio-x4xJYDvStAgysxA8WJXlww@public.gmane.org>
2013-10-23 16:04 ` [PATCH 01/16] batman-adv: make struct batadv_neigh_node algorithm agnostic Antonio Quartulli
2013-10-23 16:05 ` Antonio Quartulli [this message]
2013-10-23 16:04 ` [PATCH 02/16] batman-adv: make struct batadv_orig_node " Antonio Quartulli
2013-10-23 16:04 ` [PATCH 03/16] batman-adv: add bat_orig_print API function Antonio Quartulli
2013-10-23 17:00 ` Joe Perches
2013-10-23 17:18 ` Antonio Quartulli
[not found] ` <20131023171810.GB2651-rVWd3aGhH2zPj3vggD0kEA@public.gmane.org>
2013-10-23 17:27 ` Joe Perches
2013-10-23 17:37 ` Antonio Quartulli
2013-10-23 16:04 ` [PATCH 04/16] batman-adv: add bat_neigh_cmp " Antonio Quartulli
2013-10-23 16:04 ` [PATCH 05/16] batman-adv: add bat_neigh_is_equiv_or_better " Antonio Quartulli
2013-10-23 16:04 ` [PATCH 06/16] batman-adv: adapt bonding to use the new API functions Antonio Quartulli
2013-10-23 16:04 ` [PATCH 07/16] batman-adv: adapt the neighbor purging routine " Antonio Quartulli
2013-10-23 16:04 ` [PATCH 08/16] batman-adv: provide orig_node routing API Antonio Quartulli
2013-10-23 16:04 ` [PATCH 09/16] batman-adv: adapt the TT component to use the new API functions Antonio Quartulli
2013-10-23 16:04 ` [PATCH 10/16] batman-adv: limit local translation table max size Antonio Quartulli
2013-10-23 16:04 ` [PATCH 11/16] batman-adv: send GW_DEL event in case of soft-iface destruction Antonio Quartulli
2013-10-23 16:04 ` [PATCH 12/16] batman-adv: invoke dev_get_by_index() outside of is_wifi_iface() Antonio Quartulli
2013-10-23 16:05 ` [PATCH 14/16] batman-adv: include the sync-flags when compute the global/local table CRC Antonio Quartulli
2013-10-23 16:05 ` [PATCH 15/16] batman-adv: Start new development cycle Antonio Quartulli
2013-10-23 16:05 ` [PATCH 16/16] batman-adv: generalize batman-adv icmp packet handling Antonio Quartulli
2013-10-23 21:13 ` pull request: batman-adv 2013-10-23 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382544303-2694-14-git-send-email-antonio@meshcoding.com \
--to=antonio-x4xjydvstagysxa8wjxlww@public.gmane.org \
--cc=antonio-2BnEqQcu77q1Z/+hSey0Gg@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).