Commit fc957275 authored by Marek Lindner's avatar Marek Lindner

batman-adv: agglomerate all batman iv ogm processing functions in a single file

In preparation of the upcoming improved routing algorithm the code based has
to be re-organized to allow choosing the routing algorithm at compile time.
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
parent b6da4bf5
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
obj-$(CONFIG_BATMAN_ADV) += batman-adv.o obj-$(CONFIG_BATMAN_ADV) += batman-adv.o
batman-adv-y += aggregation.o batman-adv-y += aggregation.o
batman-adv-y += bat_debugfs.o batman-adv-y += bat_debugfs.o
batman-adv-y += bat_iv_ogm.o
batman-adv-y += bat_sysfs.o batman-adv-y += bat_sysfs.o
batman-adv-y += bitarray.o batman-adv-y += bitarray.o
batman-adv-y += gateway_client.o batman-adv-y += gateway_client.o
......
...@@ -264,34 +264,3 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, ...@@ -264,34 +264,3 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
spin_unlock_bh(&bat_priv->forw_bat_list_lock); spin_unlock_bh(&bat_priv->forw_bat_list_lock);
} }
} }
/* unpack the aggregated packets and process them one by one */
void receive_aggr_bat_packet(const struct ethhdr *ethhdr,
unsigned char *packet_buff, int packet_len,
struct hard_iface *if_incoming)
{
struct batman_ogm_packet *batman_ogm_packet;
int buff_pos = 0;
unsigned char *tt_buff;
batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
do {
/* network to host order for our 32bit seqno and the
orig_interval */
batman_ogm_packet->seqno = ntohl(batman_ogm_packet->seqno);
batman_ogm_packet->tt_crc = ntohs(batman_ogm_packet->tt_crc);
tt_buff = packet_buff + buff_pos + BATMAN_OGM_LEN;
receive_bat_packet(ethhdr, batman_ogm_packet,
tt_buff, if_incoming);
buff_pos += BATMAN_OGM_LEN +
tt_len(batman_ogm_packet->tt_num_changes);
batman_ogm_packet = (struct batman_ogm_packet *)
(packet_buff + buff_pos);
} while (aggregated_packet(buff_pos, packet_len,
batman_ogm_packet->tt_num_changes));
}
...@@ -38,8 +38,5 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, ...@@ -38,8 +38,5 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len, unsigned char *packet_buff, int packet_len,
struct hard_iface *if_incoming, int own_packet, struct hard_iface *if_incoming, int own_packet,
unsigned long send_time); unsigned long send_time);
void receive_aggr_bat_packet(const struct ethhdr *ethhdr,
unsigned char *packet_buff, int packet_len,
struct hard_iface *if_incoming);
#endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */
This diff is collapsed.
/*
* Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
*
* Marek Lindner, Simon Wunderlich
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
#ifndef _NET_BATMAN_ADV_OGM_H_
#define _NET_BATMAN_ADV_OGM_H_
#include "main.h"
void bat_ogm_receive(const struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct hard_iface *if_incoming);
#endif /* _NET_BATMAN_ADV_OGM_H_ */
...@@ -632,7 +632,7 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -632,7 +632,7 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
switch (batman_ogm_packet->packet_type) { switch (batman_ogm_packet->packet_type) {
/* batman originator packet */ /* batman originator packet */
case BAT_OGM: case BAT_OGM:
ret = recv_bat_packet(skb, hard_iface); ret = recv_bat_ogm_packet(skb, hard_iface);
break; break;
/* batman icmp packet */ /* batman icmp packet */
......
...@@ -336,8 +336,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv, ...@@ -336,8 +336,7 @@ static bool purge_orig_node(struct bat_priv *bat_priv,
} else { } else {
if (purge_orig_neighbors(bat_priv, orig_node, if (purge_orig_neighbors(bat_priv, orig_node,
&best_neigh_node)) { &best_neigh_node)) {
update_routes(bat_priv, orig_node, update_route(bat_priv, orig_node, best_neigh_node);
best_neigh_node);
} }
} }
......
This diff is collapsed.
...@@ -23,19 +23,15 @@ ...@@ -23,19 +23,15 @@
#define _NET_BATMAN_ADV_ROUTING_H_ #define _NET_BATMAN_ADV_ROUTING_H_
void slide_own_bcast_window(struct hard_iface *hard_iface); void slide_own_bcast_window(struct hard_iface *hard_iface);
void receive_bat_packet(const struct ethhdr *ethhdr, void update_route(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct batman_ogm_packet *batman_ogm_packet, struct neigh_node *neigh_node);
const unsigned char *tt_buff,
struct hard_iface *if_incoming);
void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node,
struct neigh_node *neigh_node);
int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if); int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_bat_packet(struct sk_buff *skb, struct hard_iface *recv_if); int recv_bat_ogm_packet(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if); int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if);
int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if); int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if);
struct neigh_node *find_router(struct bat_priv *bat_priv, struct neigh_node *find_router(struct bat_priv *bat_priv,
...@@ -43,5 +39,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv, ...@@ -43,5 +39,12 @@ struct neigh_node *find_router(struct bat_priv *bat_priv,
const struct hard_iface *recv_if); const struct hard_iface *recv_if);
void bonding_candidate_del(struct orig_node *orig_node, void bonding_candidate_del(struct orig_node *orig_node,
struct neigh_node *neigh_node); struct neigh_node *neigh_node);
void bonding_candidate_add(struct orig_node *orig_node,
struct neigh_node *neigh_node);
void bonding_save_primary(const struct orig_node *orig_node,
struct orig_node *orig_neigh_node,
const struct batman_ogm_packet *batman_ogm_packet);
int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
unsigned long *last_reset);
#endif /* _NET_BATMAN_ADV_ROUTING_H_ */ #endif /* _NET_BATMAN_ADV_ROUTING_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment