public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <lindner_marek@yahoo.de>,
	Antonio Quartulli <antonio@open-mesh.com>
Subject: [B.A.T.M.A.N.] [PATCH 08/18] batman-adv: make the GW module correctly talk to the new VLAN-TT
Date: Sun, 20 Oct 2013 00:22:00 +0200	[thread overview]
Message-ID: <1382221330-3769-9-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1382221330-3769-1-git-send-email-antonio@meshcoding.com>

From: Antonio Quartulli <antonio@open-mesh.com>

The gateway code is now adapted in order to correctly
interact with the Translation Table component by using the
vlan ID

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 net/batman-adv/gateway_client.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index a920946..4ed410f 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -726,7 +726,20 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len)
 	return true;
 }
 
-/* this call might reallocate skb data */
+/**
+ * batadv_gw_out_of_range - check if the dhcp request destination is the best gw
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: the outgoing packet
+ *
+ * Check if the skb is a DHCP request and if it is sent to the current best GW
+ * server. Due to topology changes it may be the case that the GW server
+ * previously selected is not the best one anymore.
+ *
+ * Returns true if the packet destination is unicast and it is not the best gw,
+ * false otherwise.
+ *
+ * This call might reallocate skb data.
+ */
 bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 			    struct sk_buff *skb)
 {
@@ -737,6 +750,9 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 	bool ret, out_of_range = false;
 	unsigned int header_len = 0;
 	uint8_t curr_tq_avg;
+	unsigned short vid;
+
+	vid = batadv_get_vid(skb, 0);
 
 	ret = batadv_gw_is_dhcp_target(skb, &header_len);
 	if (!ret)
@@ -744,8 +760,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
 
 	ethhdr = (struct ethhdr *)skb->data;
 	orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
-						 ethhdr->h_dest,
-						 BATADV_NO_FLAGS);
+						 ethhdr->h_dest, vid);
 	if (!orig_dst_node)
 		goto out;
 
-- 
1.8.4


  parent reply	other threads:[~2013-10-19 22:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-19 22:21 [B.A.T.M.A.N.] (no subject) Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 01/18] batman-adv: check skb preparation return value Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 02/18] batman-adv: update email address for Simon Wunderlich Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 03/18] batman-adv: update email address for Antonio Quartulli Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 04/18] batman-adv: update email address for Marek Lindner Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 05/18] batman-adv: add the VLAN ID attribute to the TT entry Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 06/18] batman-adv: use vid when computing local and global TT CRC Antonio Quartulli
2013-10-19 22:21 ` [B.A.T.M.A.N.] [PATCH 07/18] batman-adv: print the VID together with the TT entries Antonio Quartulli
2013-10-19 22:22 ` Antonio Quartulli [this message]
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 09/18] batman-adv: make the Distributed ARP Table vlan aware Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 10/18] batman-adv: add per VLAN interface attribute framework Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 11/18] batman-adv: add sysfs framework for VLAN Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 12/18] batman-adv: make the AP isolation attribute VLAN specific Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 13/18] batman-adv: refine API calls for unicast transmissions of SKBs Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 14/18] batman-adv: remove bogus comment Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 15/18] batman-adv: lock around TT operations to avoid sending inconsistent data Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 16/18] batman-adv: make the TT CRC logic VLAN specific Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 17/18] batman-adv: make the TT global purge routine " Antonio Quartulli
2013-10-19 22:22 ` [B.A.T.M.A.N.] [PATCH 18/18] batman-adv: make the backbone gw check " Antonio Quartulli
2013-10-20  0:15 ` [B.A.T.M.A.N.] (no subject) David Miller
2013-10-20  7:57   ` [B.A.T.M.A.N.] your mail Antonio Quartulli

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=1382221330-3769-9-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=antonio@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=lindner_marek@yahoo.de \
    --cc=netdev@vger.kernel.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