[B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Use proper name for fragments list head
by Sven Eckelmann
The batman-adv codebase is using "list" for the list node (prev/next) and
<list content descriptor>+"_list" for the head of a list. Not using this
naming scheme can up in confusions because list_head is used for both the
head of the list and the list node (prev/next) in each item of the list.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/fragmentation.c | 14 +++++++-------
net/batman-adv/fragmentation.h | 2 +-
net/batman-adv/originator.c | 2 +-
net/batman-adv/types.h | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 0934730..f725918 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,
spin_lock_bh(&chain->lock);
if (!check_cb || check_cb(chain)) {
- batadv_frag_clear_chain(&chain->head);
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
}
@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain,
if (chain->seqno == seqno)
return false;
- if (!hlist_empty(&chain->head))
- batadv_frag_clear_chain(&chain->head);
+ if (!hlist_empty(&chain->fragment_list))
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
chain->seqno = seqno;
@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
chain = &orig_node->fragments[bucket];
spin_lock_bh(&chain->lock);
if (batadv_frag_init_chain(chain, seqno)) {
- hlist_add_head(&frag_entry_new->list, &chain->head);
+ hlist_add_head(&frag_entry_new->list, &chain->fragment_list);
chain->size = skb->len - hdr_size;
chain->timestamp = jiffies;
chain->total_size = ntohs(frag_packet->total_size);
@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node,
}
/* Find the position for the new fragment. */
- hlist_for_each_entry(frag_entry_curr, &chain->head, list) {
+ hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) {
/* Drop packet if fragment already exists. */
if (frag_entry_curr->no == frag_entry_new->no)
goto err_unlock;
@@ -220,11 +220,11 @@ out:
* exceeds the maximum size of one merged packet. Don't allow
* packets to have different total_size.
*/
- batadv_frag_clear_chain(&chain->head);
+ batadv_frag_clear_chain(&chain->fragment_list);
chain->size = 0;
} else if (ntohs(frag_packet->total_size) == chain->size) {
/* All fragments received. Hand over chain to caller. */
- hlist_move_list(&chain->head, chain_out);
+ hlist_move_list(&chain->fragment_list, chain_out);
chain->size = 0;
}
diff --git a/net/batman-adv/fragmentation.h b/net/batman-adv/fragmentation.h
index 3202fe3..b95f619 100644
--- a/net/batman-adv/fragmentation.h
+++ b/net/batman-adv/fragmentation.h
@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb,
static inline bool
batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
{
- if (!hlist_empty(&frags_entry->head) &&
+ if (!hlist_empty(&frags_entry->fragment_list) &&
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
return true;
return false;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 5f3bfc4..c6e07d6 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
batadv_orig_node_vlan_put(vlan);
for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
- INIT_HLIST_HEAD(&orig_node->fragments[i].head);
+ INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list);
spin_lock_init(&orig_node->fragments[i].lock);
orig_node->fragments[i].size = 0;
}
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index b3dd1a3..02d1d32 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo {
/**
* struct batadv_frag_table_entry - head in the fragment buffer table
- * @head: head of list with fragments
+ * @fragment_list: head of list with fragments
* @lock: lock to protect the list of fragments
* @timestamp: time (jiffie) of last received fragment
* @seqno: sequence number of the fragments in the list
@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo {
* @total_size: expected size of the assembled packet
*/
struct batadv_frag_table_entry {
- struct hlist_head head;
- spinlock_t lock; /* protects head */
+ struct hlist_head fragment_list;
+ spinlock_t lock; /* protects fragment_list */
unsigned long timestamp;
u16 seqno;
u16 size;
--
2.8.1
5 years, 7 months
[B.A.T.M.A.N.] [PATCH] batman-adv: Remove needless init of variables on stack
by Sven Eckelmann
Some variables are overwritten immediatelly in a functions. These don't
have to be initialized to a specific value on the stack because the value
will be overwritten before they will be used anywhere.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
net/batman-adv/bat_v.c | 2 +-
net/batman-adv/bat_v_ogm.c | 4 ++--
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/originator.c | 8 ++++----
net/batman-adv/send.c | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index e79f6f0..57c795c 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -787,7 +787,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv,
struct batadv_orig_node *curr_gw_orig,
struct batadv_orig_node *orig_node)
{
- struct batadv_gw_node *curr_gw = NULL, *orig_gw = NULL;
+ struct batadv_gw_node *curr_gw, *orig_gw = NULL;
u32 gw_throughput, orig_throughput, threshold;
bool ret = false;
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
index 1aeeadc..61ff5f8 100644
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -401,7 +401,7 @@ static int batadv_v_ogm_metric_update(struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_incoming,
struct batadv_hard_iface *if_outgoing)
{
- struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+ struct batadv_orig_ifinfo *orig_ifinfo;
struct batadv_neigh_ifinfo *neigh_ifinfo = NULL;
bool protection_started = false;
int ret = -EINVAL;
@@ -486,7 +486,7 @@ static bool batadv_v_ogm_route_update(struct batadv_priv *bat_priv,
struct batadv_hard_iface *if_outgoing)
{
struct batadv_neigh_node *router = NULL;
- struct batadv_orig_node *orig_neigh_node = NULL;
+ struct batadv_orig_node *orig_neigh_node;
struct batadv_neigh_node *orig_neigh_router = NULL;
struct batadv_neigh_ifinfo *router_ifinfo = NULL, *neigh_ifinfo = NULL;
u32 router_throughput, neigh_throughput;
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index de055d6..69bfe98 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -704,7 +704,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
{
struct batadv_neigh_node *neigh_curr = NULL;
struct batadv_neigh_node *neigh_old = NULL;
- struct batadv_orig_node *orig_dst_node = NULL;
+ struct batadv_orig_node *orig_dst_node;
struct batadv_gw_node *gw_node = NULL;
struct batadv_gw_node *curr_gw = NULL;
struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 5f3bfc4..6af87c9 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -364,7 +364,7 @@ struct batadv_orig_ifinfo *
batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *if_outgoing)
{
- struct batadv_orig_ifinfo *orig_ifinfo = NULL;
+ struct batadv_orig_ifinfo *orig_ifinfo;
unsigned long reset_time;
spin_lock_bh(&orig_node->neigh_list_lock);
@@ -520,7 +520,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr)
{
struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+ struct batadv_hardif_neigh_node *hardif_neigh;
spin_lock_bh(&hard_iface->neigh_list_lock);
@@ -563,7 +563,7 @@ static struct batadv_hardif_neigh_node *
batadv_hardif_neigh_get_or_create(struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr)
{
- struct batadv_hardif_neigh_node *hardif_neigh = NULL;
+ struct batadv_hardif_neigh_node *hardif_neigh;
/* first check without locking to avoid the overhead */
hardif_neigh = batadv_hardif_neigh_get(hard_iface, neigh_addr);
@@ -683,7 +683,7 @@ batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr)
{
- struct batadv_neigh_node *neigh_node = NULL;
+ struct batadv_neigh_node *neigh_node;
/* first check without locking to avoid the overhead */
neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 8d4e1f5..e1e9136 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -562,7 +562,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv,
const struct sk_buff *skb,
unsigned long delay)
{
- struct batadv_hard_iface *primary_if = NULL;
+ struct batadv_hard_iface *primary_if;
struct batadv_forw_packet *forw_packet;
struct batadv_bcast_packet *bcast_packet;
struct sk_buff *newskb;
--
2.8.1
5 years, 7 months
[B.A.T.M.A.N.] [PATCH 0/3] batman-adv: Deletion of a few unnecessary checks
by SF Markus Elfring
From: Markus Elfring <elfring(a)users.sourceforge.net>
Date: Tue, 3 Nov 2015 21:34:29 +0100
Further update suggestions were taken into account after a patch
was applied from static source code analysis.
Markus Elfring (3):
Delete an unnecessary check before the function call "batadv_softif_vlan_free_ref"
Split a condition check
Less function calls in batadv_is_ap_isolated() after error detection
net/batman-adv/translation-table.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
--
2.6.2
5 years, 7 months
[B.A.T.M.A.N.] [PATCH] batctl: optchar variable uses wrong type
by Andreas Pape
The variable "optchar" used char instead of int leading to a non
working batctl tp command as the while loop parsing the tp
arguments with the getopt command is only left via the "default"
case leaving the tp subcommand unusable. Using type char also
lead to a compiler warning.
Signed-off-by: Andreas Pape <apape(a)phoenixcontact.com>
---
tp_meter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tp_meter.c b/tp_meter.c
index 7fe0d56..10dc2b9 100644
--- a/tp_meter.c
+++ b/tp_meter.c
@@ -395,7 +395,7 @@ int tp_meter(char *mesh_iface, int argc, char **argv)
int ret = EXIT_FAILURE;
int found_args = 1, read_opt = USE_BAT_HOSTS;
uint32_t time = 0;
- char optchar;
+ int optchar;
struct nl_sock *listen_sock = NULL;
struct tp_result result = {
.error = 0,
--
1.7.0.4
..................................................................
PHOENIX CONTACT ELECTRONICS GmbH
Sitz der Gesellschaft / registered office of the company: 31812 Bad Pyrmont
USt-Id-Nr.: DE811742156
Amtsgericht Hannover HRB 100528 / district court Hannover HRB 100528
Geschäftsführer / Executive Board: Ulrich Leidecker, Christoph Leifer
__________________________________________________________________
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
----------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
___________________________________________________________________
5 years, 7 months
[B.A.T.M.A.N.] [PATCH] batctl: Work around uclibc collision for __unused
by Sven Eckelmann
uclibc on 64 bit systems uses struct members called __unused. These
conflict with the definition of __unused in batctl. Such a conflict results
in a build error because the struct member will be replaced with the
__attribute__((unused)).
This can be avoided by renaming it to the Linux kernel name
"__maybe_unused".
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
genl.c | 4 ++--
main.h | 2 +-
netlink.c | 10 +++++-----
tp_meter.c | 5 +++--
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/genl.c b/genl.c
index b6f66fd..36fc27e 100644
--- a/genl.c
+++ b/genl.c
@@ -34,7 +34,7 @@
#include "batman_adv.h"
-static int mcast_error_handler(struct sockaddr_nl *nla __unused,
+static int mcast_error_handler(struct sockaddr_nl *nla __maybe_unused,
struct nlmsgerr *err, void *arg)
{
int *ret = arg;
@@ -42,7 +42,7 @@ static int mcast_error_handler(struct sockaddr_nl *nla __unused,
return NL_STOP;
}
-static int mcast_ack_handler(struct nl_msg *msg __unused, void *arg)
+static int mcast_ack_handler(struct nl_msg *msg __maybe_unused, void *arg)
{
int *ret = arg;
*ret = 0;
diff --git a/main.h b/main.h
index 6365cdb..dbde6dd 100644
--- a/main.h
+++ b/main.h
@@ -47,7 +47,7 @@
#endif
#define __packed __attribute((packed)) /* linux kernel compat */
-#define __unused __attribute__((unused))
+#define __maybe_unused __attribute__((unused))
#define BIT(nr) (1UL << (nr)) /* linux kernel compat */
typedef uint8_t u8; /* linux kernel compat */
diff --git a/netlink.c b/netlink.c
index e8e94b2..8fce3d8 100644
--- a/netlink.c
+++ b/netlink.c
@@ -134,9 +134,9 @@ static int missing_mandatory_attrs(struct nlattr *attrs[],
return 0;
}
-static int print_error(struct sockaddr_nl *nla __unused,
+static int print_error(struct sockaddr_nl *nla __maybe_unused,
struct nlmsgerr *nlerr,
- void *arg __unused)
+ void *arg __maybe_unused)
{
if (nlerr->error != -EOPNOTSUPP)
fprintf(stderr, "Error received: %s\n",
@@ -147,7 +147,7 @@ static int print_error(struct sockaddr_nl *nla __unused,
return NL_STOP;
}
-static int stop_callback(struct nl_msg *msg, void *arg __unused)
+static int stop_callback(struct nl_msg *msg, void *arg __maybe_unused)
{
struct nlmsghdr *nlh = nlmsg_hdr(msg);
int *error = nlmsg_data(nlh);
@@ -345,7 +345,7 @@ static const int routing_algos_mandatory[] = {
BATADV_ATTR_ALGO_NAME,
};
-static int routing_algos_callback(struct nl_msg *msg, void *arg __unused)
+static int routing_algos_callback(struct nl_msg *msg, void *arg __maybe_unused)
{
struct nlattr *attrs[BATADV_ATTR_MAX+1];
struct nlmsghdr *nlh = nlmsg_hdr(msg);
@@ -1286,7 +1286,7 @@ int netlink_print_bla_backbone(char *mesh_iface, char *orig_iface, int read_opts
bla_backbone_callback);
}
-static int nlquery_error_cb(struct sockaddr_nl *nla __unused,
+static int nlquery_error_cb(struct sockaddr_nl *nla __maybe_unused,
struct nlmsgerr *nlerr, void *arg)
{
struct nlquery_opts *query_opts = arg;
diff --git a/tp_meter.c b/tp_meter.c
index 43c19da..a402e45 100644
--- a/tp_meter.c
+++ b/tp_meter.c
@@ -66,7 +66,7 @@ struct tp_cookie {
uint32_t cookie;
};
-static int tpmeter_nl_print_error(struct sockaddr_nl *nla __unused,
+static int tpmeter_nl_print_error(struct sockaddr_nl *nla __maybe_unused,
struct nlmsgerr *nlerr,
void *arg)
{
@@ -236,7 +236,8 @@ out:
return err;
}
-static int no_seq_check(struct nl_msg *msg __unused, void *arg __unused)
+static int no_seq_check(struct nl_msg *msg __maybe_unused,
+ void *arg __maybe_unused)
{
return NL_OK;
}
--
2.9.3
5 years, 7 months
[B.A.T.M.A.N.] [PATCH 1/2] batctl: Fix minor typos in manpage
by Sven Eckelmann
* s/criterias/criteria/
* s/succesful/successful/
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---
man/batctl.8 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/batctl.8 b/man/batctl.8
index 8bac727..17549c0 100644
--- a/man/batctl.8
+++ b/man/batctl.8
@@ -129,7 +129,7 @@ examples: 5000 \-> 5.0/1.0 MBit
5mbit/1mbit
.RE
.RS 7
-If the node is a gateway client the parameter will decide which criterias to consider when the batman-adv module has to choose
+If the node is a gateway client the parameter will decide which criteria to consider when the batman-adv module has to choose
between different internet connections announced by the aforementioned servers.
.RE
.RS 17
@@ -337,7 +337,7 @@ protocol used to transfer the data is somehow similar to TCP, but simpler: some
TCP features are still missing, thus protocol performances could be worst. Since
a fixed amount of data is transferred the experiment duration depends on the
network conditions. The experiment can be interrupted with CTRL + C. At the end
-of a succesful experiment the throughput in KBytes per second is returned,
+of a successful experiment the throughput in KBytes per second is returned,
togheter with the experiment duration in millisecond and the amount of bytes
transferred. If too many packets are lost or the specified MAC address is not
reachable, a message notifing the error is returned instead of the result.
--
2.9.3
5 years, 7 months
[B.A.T.M.A.N.] [PATCH 0/4] batctl: Userspace batadv_icmp endpoints
by Sven Eckelmann
Hi,
The current endpoint for batadv_icmp* is implemented in the kernel module and
can be accessed via debugfs. But the debugfs cannot be accessed from non-
default netns or when debugfs is disabled. Thus it has be possible to use it
via the netlink infrastructure to make it compatible with future
setups.
The use of the socket file is completely removed and instead raw sockets with
BPF filters are used to send/receive batadv_icmp_packet* directly. All
information about interfaces and available originators are received via
rtnetlink and the batman-adv netlink.
The originators debugfs file is used when the batman-adv netlink commands are
not available. The routing of batadv_icmp_packets is still done inside the
kernel module.
The patchset is based on the netlink and rtnl patchset for batctl.
Kind regards,
Sven
Sven Eckelmann (4):
batctl: Replace list implementation with linux-like-list
batctl: Use monotonic time source for icmp timing
batctl: Add helper to generate instant random bytes
batctl: Implement non-routing batadv_icmp in userspace
Makefile | 4 +-
bisect_iv.c | 40 ++-
bisect_iv.h | 10 +-
functions.c | 82 +++++-
functions.h | 2 +
icmp_helper.c | 633 ++++++++++++++++++++++++++++++++++++++++++++
icmp_helper.h | 58 ++++
list-batman.c | 123 ---------
list-batman.h | 120 ---------
list.h | 834 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
netlink.c | 178 ++++++++++++-
netlink.h | 3 +
ping.c | 42 +--
tcpdump.c | 7 +-
tcpdump.h | 2 +-
traceroute.c | 42 +--
16 files changed, 1832 insertions(+), 348 deletions(-)
create mode 100644 icmp_helper.c
create mode 100644 icmp_helper.h
delete mode 100644 list-batman.c
delete mode 100644 list-batman.h
create mode 100644 list.h
5 years, 7 months
[B.A.T.M.A.N.] [PATCH maint] batman-adv: Modify neigh_list only with rcu-list functions
by Sven Eckelmann
The batadv_hard_iface::neigh_list is accessed via rcu based primitives.
Thus all operations done on it have to fulfill the requirements by RCU. So
using non-RCU mechanisms like hlist_add_head is not allowed because it
misses the barriers required to protect concurrent readers when accessing
the data behind the pointer.
Fixes: fed2826b490c ("batman-adv: add list of unique single hop neighbors per hard-interface")
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)open-mesh.com>
---
net/batman-adv/originator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 3940b5d..3e9667e 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -537,7 +537,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
if (bat_priv->algo_ops->neigh.hardif_init)
bat_priv->algo_ops->neigh.hardif_init(hardif_neigh);
- hlist_add_head(&hardif_neigh->list, &hard_iface->neigh_list);
+ hlist_add_head_rcu(&hardif_neigh->list, &hard_iface->neigh_list);
out:
spin_unlock_bh(&hard_iface->neigh_list_lock);
--
2.9.3
5 years, 7 months
[B.A.T.M.A.N.] [PATCH] batman-adv: remove unsed argument from batadv_dbg_arp() function
by Antonio Quartulli
The argument "type" passed to the batadv_dbg_arp() function is
never used. Remove it.
Signed-off-by: Antonio Quartulli <a(a)unstable.cc>
---
net/batman-adv/distributed-arp-table.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index e257efd..cbb4f32 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -369,12 +369,11 @@ out:
* batadv_dbg_arp - print a debug message containing all the ARP packet details
* @bat_priv: the bat priv with all the soft interface information
* @skb: ARP packet
- * @type: ARP type
* @hdr_size: size of the possible header before the ARP packet
* @msg: message to print together with the debugging information
*/
static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
- u16 type, int hdr_size, char *msg)
+ int hdr_size, char *msg)
{
struct batadv_unicast_4addr_packet *unicast_4addr_packet;
struct batadv_bcast_packet *bcast_pkt;
@@ -441,7 +440,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
#else
static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb,
- u16 type, int hdr_size, char *msg)
+ int hdr_size, char *msg)
{
}
@@ -983,8 +982,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
if (type != ARPOP_REQUEST)
goto out;
- batadv_dbg_arp(bat_priv, skb, type, hdr_size,
- "Parsing outgoing ARP REQUEST");
+ batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REQUEST");
ip_src = batadv_arp_ip_src(skb, hdr_size);
hw_src = batadv_arp_hw_src(skb, hdr_size);
@@ -1075,8 +1073,7 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
ip_src = batadv_arp_ip_src(skb, hdr_size);
ip_dst = batadv_arp_ip_dst(skb, hdr_size);
- batadv_dbg_arp(bat_priv, skb, type, hdr_size,
- "Parsing incoming ARP REQUEST");
+ batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REQUEST");
batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid);
@@ -1149,8 +1146,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
if (type != ARPOP_REPLY)
return;
- batadv_dbg_arp(bat_priv, skb, type, hdr_size,
- "Parsing outgoing ARP REPLY");
+ batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing outgoing ARP REPLY");
hw_src = batadv_arp_hw_src(skb, hdr_size);
ip_src = batadv_arp_ip_src(skb, hdr_size);
@@ -1195,8 +1191,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
if (type != ARPOP_REPLY)
goto out;
- batadv_dbg_arp(bat_priv, skb, type, hdr_size,
- "Parsing incoming ARP REPLY");
+ batadv_dbg_arp(bat_priv, skb, hdr_size, "Parsing incoming ARP REPLY");
hw_src = batadv_arp_hw_src(skb, hdr_size);
ip_src = batadv_arp_ip_src(skb, hdr_size);
--
2.10.0
5 years, 7 months
[B.A.T.M.A.N.] [PATCH] batman-adv: Allow selecting BATMAN V if CFG80211 is not built
by Linus Lüssing
With the new stub for cfg80211_get_station(), we can now build the
BATMAN V protocol even with a kernel that was built without any
wireless support.
Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue>
---
compat-include/net/cfg80211.h | 24 ++++++++++++++++++++++++
net/batman-adv/Kconfig | 2 +-
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 compat-include/net/cfg80211.h
diff --git a/compat-include/net/cfg80211.h b/compat-include/net/cfg80211.h
new file mode 100644
index 0000000..8dbbf0e
--- /dev/null
+++ b/compat-include/net/cfg80211.h
@@ -0,0 +1,24 @@
+#ifndef _NET_BATMAN_ADV_COMPAT_NET_CFG80211_H_
+#define _NET_BATMAN_ADV_COMPAT_NET_CFG80211_H_
+
+#include <linux/version.h>
+#include_next <net/cfg80211.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
+
+#if !IS_ENABLED(CONFIG_CFG80211)
+
+#define cfg80211_get_station(dev, mac_addr, sinfo) \
+ batadv_cfg80211_get_station(dev, mac_addr, sinfo)
+
+static inline int batadv_cfg80211_get_station(struct net_device *dev,
+ const u8 *mac_addr,
+ struct station_info *sinfo)
+{
+ return -ENOENT;
+}
+#endif
+
+#endif /* < KERNEL_VERSION(4, 8, 0) */
+
+#endif /* _NET_BATMAN_ADV_COMPAT_NET_CFG80211_H_ */
diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index f20742c..b73b96a 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -17,7 +17,7 @@ config BATMAN_ADV
config BATMAN_ADV_BATMAN_V
bool "B.A.T.M.A.N. V protocol (experimental)"
- depends on BATMAN_ADV && CFG80211=y || (CFG80211=m && BATMAN_ADV=m)
+ depends on BATMAN_ADV && !(CFG80211=m && BATMAN_ADV=y)
default n
help
This option enables the B.A.T.M.A.N. V protocol, the successor
--
2.1.4
5 years, 7 months