Skip to content

Commit

Permalink
batman-adv: split out router from orig_node
Browse files Browse the repository at this point in the history
For the network wide multi interface optimization there are different
routers for each outgoing interface (outgoing from the OGM perspective,
incoming for payload traffic). To reflect this, change the router and
associated data to a list of routers.

While at it, rename batadv_orig_node_get_router() to
batadv_orig_router_get() to follow the new naming scheme.

Signed-off-by: Simon Wunderlich <simon@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
  • Loading branch information
Simon Wunderlich authored and Antonio Quartulli committed Jan 12, 2014
1 parent 8965233 commit 7351a48
Show file tree
Hide file tree
Showing 11 changed files with 605 additions and 219 deletions.
454 changes: 269 additions & 185 deletions net/batman-adv/bat_iv_ogm.c

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion net/batman-adv/distributed-arp-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
if (cand[i].type == BATADV_DAT_CANDIDATE_NOT_FOUND)
continue;

neigh_node = batadv_orig_node_get_router(cand[i].orig_node);
neigh_node = batadv_orig_router_get(cand[i].orig_node,
BATADV_IF_DEFAULT);
if (!neigh_node)
goto free_orig;

Expand Down
11 changes: 6 additions & 5 deletions net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
continue;

orig_node = gw_node->orig_node;
router = batadv_orig_node_get_router(orig_node);
router = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
if (!router)
continue;

Expand Down Expand Up @@ -266,7 +266,8 @@ void batadv_gw_election(struct batadv_priv *bat_priv)
if (next_gw) {
sprintf(gw_addr, "%pM", next_gw->orig_node->orig);

router = batadv_orig_node_get_router(next_gw->orig_node);
router = batadv_orig_router_get(next_gw->orig_node,
BATADV_IF_DEFAULT);
if (!router) {
batadv_gw_reselect(bat_priv);
goto out;
Expand Down Expand Up @@ -335,7 +336,7 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv,
if (!curr_gw_orig)
goto reselect;

router_gw = batadv_orig_node_get_router(curr_gw_orig);
router_gw = batadv_orig_router_get(curr_gw_orig, BATADV_IF_DEFAULT);
if (!router_gw)
goto reselect;

Expand All @@ -348,7 +349,7 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv,
if (curr_gw_orig == orig_node)
goto out;

router_orig = batadv_orig_node_get_router(orig_node);
router_orig = batadv_orig_router_get(orig_node, BATADV_IF_DEFAULT);
if (!router_orig)
goto out;

Expand Down Expand Up @@ -576,7 +577,7 @@ static int batadv_write_buffer_text(struct batadv_priv *bat_priv,
struct batadv_neigh_ifinfo *router_ifinfo = NULL;
int ret = -1;

router = batadv_orig_node_get_router(gw_node->orig_node);
router = batadv_orig_router_get(gw_node->orig_node, BATADV_IF_DEFAULT);
if (!router)
goto out;

Expand Down
3 changes: 2 additions & 1 deletion net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
if (!orig_node)
goto dst_unreach;

neigh_node = batadv_orig_node_get_router(orig_node);
neigh_node = batadv_orig_router_get(orig_node,
BATADV_IF_DEFAULT);
if (!neigh_node)
goto dst_unreach;

Expand Down
25 changes: 21 additions & 4 deletions net/batman-adv/network-coding.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,21 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node,
struct batadv_ogm_packet *ogm_packet)
{
if (orig_node->last_real_seqno != ntohl(ogm_packet->seqno))
struct batadv_orig_ifinfo *orig_ifinfo;
uint32_t last_real_seqno;
uint8_t last_ttl;

orig_ifinfo = batadv_orig_ifinfo_get(orig_node, BATADV_IF_DEFAULT);
if (!orig_ifinfo)
return false;
if (orig_node->last_ttl != ogm_packet->ttl + 1)

last_ttl = orig_ifinfo->last_ttl;
last_real_seqno = orig_ifinfo->last_real_seqno;
batadv_orig_ifinfo_free_ref(orig_ifinfo);

if (last_real_seqno != ntohl(ogm_packet->seqno))
return false;
if (last_ttl != ogm_packet->ttl + 1)
return false;
if (!batadv_compare_eth(ogm_packet->orig, ogm_packet->prev_sender))
return false;
Expand Down Expand Up @@ -1019,7 +1031,11 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
int coded_size = sizeof(*coded_packet);
int header_add = coded_size - unicast_size;

router_neigh = batadv_orig_node_get_router(neigh_node->orig_node);
/* TODO: do we need to consider the outgoing interface for
* coded packets?
*/
router_neigh = batadv_orig_router_get(neigh_node->orig_node,
BATADV_IF_DEFAULT);
if (!router_neigh)
goto out;

Expand All @@ -1029,7 +1045,8 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv,
goto out;

neigh_tmp = nc_packet->neigh_node;
router_coding = batadv_orig_node_get_router(neigh_tmp->orig_node);
router_coding = batadv_orig_router_get(neigh_tmp->orig_node,
BATADV_IF_DEFAULT);
if (!router_coding)
goto out;

Expand Down
Loading

0 comments on commit 7351a48

Please sign in to comment.