Commit 5332174a authored by David S. Miller's avatar David S. Miller

Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge

Antonio Quartulli says:

====================
pull request: batman-adv 20160504

In this pull request you have:
- two changes to the MAINTAINERS file where one marks our mailing list
  as moderated and the other adds a missing documentation file
- kernel-doc fixes
- code refactoring and various cleanups
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e98a3aab 64ae7445
...@@ -2203,10 +2203,13 @@ BATMAN ADVANCED ...@@ -2203,10 +2203,13 @@ BATMAN ADVANCED
M: Marek Lindner <mareklindner@neomailbox.ch> M: Marek Lindner <mareklindner@neomailbox.ch>
M: Simon Wunderlich <sw@simonwunderlich.de> M: Simon Wunderlich <sw@simonwunderlich.de>
M: Antonio Quartulli <a@unstable.cc> M: Antonio Quartulli <a@unstable.cc>
L: b.a.t.m.a.n@lists.open-mesh.org L: b.a.t.m.a.n@lists.open-mesh.org (moderated for non-subscribers)
W: https://www.open-mesh.org/ W: https://www.open-mesh.org/
Q: https://patchwork.open-mesh.org/project/batman/list/ Q: https://patchwork.open-mesh.org/project/batman/list/
S: Maintained S: Maintained
F: Documentation/ABI/testing/sysfs-class-net-batman-adv
F: Documentation/ABI/testing/sysfs-class-net-mesh
F: Documentation/networking/batman-adv.txt
F: net/batman-adv/ F: net/batman-adv/
BAYCOM/HDLCDRV DRIVERS FOR AX.25 BAYCOM/HDLCDRV DRIVERS FOR AX.25
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/lockdep.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/pkt_sched.h> #include <linux/pkt_sched.h>
#include <linux/printk.h> #include <linux/printk.h>
...@@ -175,71 +176,107 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node, ...@@ -175,71 +176,107 @@ static int batadv_iv_ogm_orig_add_if(struct batadv_orig_node *orig_node,
} }
/** /**
* batadv_iv_ogm_orig_del_if - change the private structures of the orig_node to * batadv_iv_ogm_drop_bcast_own_entry - drop section of bcast_own
* exclude the removed interface
* @orig_node: the orig_node that has to be changed * @orig_node: the orig_node that has to be changed
* @max_if_num: the current amount of interfaces * @max_if_num: the current amount of interfaces
* @del_if_num: the index of the interface being removed * @del_if_num: the index of the interface being removed
*
* Return: 0 on success, a negative error code otherwise.
*/ */
static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node, static void
batadv_iv_ogm_drop_bcast_own_entry(struct batadv_orig_node *orig_node,
int max_if_num, int del_if_num) int max_if_num, int del_if_num)
{ {
int ret = -ENOMEM; size_t chunk_size;
size_t chunk_size, if_offset; size_t if_offset;
void *data_ptr = NULL; void *data_ptr;
spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
/* last interface was removed */ lockdep_assert_held(&orig_node->bat_iv.ogm_cnt_lock);
if (max_if_num == 0)
goto free_bcast_own;
chunk_size = sizeof(unsigned long) * BATADV_NUM_WORDS; chunk_size = sizeof(unsigned long) * BATADV_NUM_WORDS;
data_ptr = kmalloc_array(max_if_num, chunk_size, GFP_ATOMIC); data_ptr = kmalloc_array(max_if_num, chunk_size, GFP_ATOMIC);
if (!data_ptr) if (!data_ptr)
goto unlock; /* use old buffer when new one could not be allocated */
data_ptr = orig_node->bat_iv.bcast_own;
/* copy first part */ /* copy first part */
memcpy(data_ptr, orig_node->bat_iv.bcast_own, del_if_num * chunk_size); memmove(data_ptr, orig_node->bat_iv.bcast_own, del_if_num * chunk_size);
/* copy second part */ /* copy second part */
if_offset = (del_if_num + 1) * chunk_size; if_offset = (del_if_num + 1) * chunk_size;
memcpy((char *)data_ptr + del_if_num * chunk_size, memmove((char *)data_ptr + del_if_num * chunk_size,
(uint8_t *)orig_node->bat_iv.bcast_own + if_offset, (uint8_t *)orig_node->bat_iv.bcast_own + if_offset,
(max_if_num - del_if_num) * chunk_size); (max_if_num - del_if_num) * chunk_size);
free_bcast_own: /* bcast_own was shrunk down in new buffer; free old one */
if (orig_node->bat_iv.bcast_own != data_ptr) {
kfree(orig_node->bat_iv.bcast_own); kfree(orig_node->bat_iv.bcast_own);
orig_node->bat_iv.bcast_own = data_ptr; orig_node->bat_iv.bcast_own = data_ptr;
}
}
if (max_if_num == 0) /**
goto free_own_sum; * batadv_iv_ogm_drop_bcast_own_sum_entry - drop section of bcast_own_sum
* @orig_node: the orig_node that has to be changed
* @max_if_num: the current amount of interfaces
* @del_if_num: the index of the interface being removed
*/
static void
batadv_iv_ogm_drop_bcast_own_sum_entry(struct batadv_orig_node *orig_node,
int max_if_num, int del_if_num)
{
size_t if_offset;
void *data_ptr;
lockdep_assert_held(&orig_node->bat_iv.ogm_cnt_lock);
data_ptr = kmalloc_array(max_if_num, sizeof(u8), GFP_ATOMIC); data_ptr = kmalloc_array(max_if_num, sizeof(u8), GFP_ATOMIC);
if (!data_ptr) { if (!data_ptr)
kfree(orig_node->bat_iv.bcast_own); /* use old buffer when new one could not be allocated */
goto unlock; data_ptr = orig_node->bat_iv.bcast_own_sum;
}
memcpy(data_ptr, orig_node->bat_iv.bcast_own_sum, memmove(data_ptr, orig_node->bat_iv.bcast_own_sum,
del_if_num * sizeof(u8)); del_if_num * sizeof(u8));
if_offset = (del_if_num + 1) * sizeof(u8); if_offset = (del_if_num + 1) * sizeof(u8);
memcpy((char *)data_ptr + del_if_num * sizeof(u8), memmove((char *)data_ptr + del_if_num * sizeof(u8),
orig_node->bat_iv.bcast_own_sum + if_offset, orig_node->bat_iv.bcast_own_sum + if_offset,
(max_if_num - del_if_num) * sizeof(u8)); (max_if_num - del_if_num) * sizeof(u8));
free_own_sum: /* bcast_own_sum was shrunk down in new buffer; free old one */
if (orig_node->bat_iv.bcast_own_sum != data_ptr) {
kfree(orig_node->bat_iv.bcast_own_sum); kfree(orig_node->bat_iv.bcast_own_sum);
orig_node->bat_iv.bcast_own_sum = data_ptr; orig_node->bat_iv.bcast_own_sum = data_ptr;
}
}
/**
* batadv_iv_ogm_orig_del_if - change the private structures of the orig_node to
* exclude the removed interface
* @orig_node: the orig_node that has to be changed
* @max_if_num: the current amount of interfaces
* @del_if_num: the index of the interface being removed
*
* Return: 0 on success, a negative error code otherwise.
*/
static int batadv_iv_ogm_orig_del_if(struct batadv_orig_node *orig_node,
int max_if_num, int del_if_num)
{
spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
if (max_if_num == 0) {
kfree(orig_node->bat_iv.bcast_own);
kfree(orig_node->bat_iv.bcast_own_sum);
orig_node->bat_iv.bcast_own = NULL;
orig_node->bat_iv.bcast_own_sum = NULL;
} else {
batadv_iv_ogm_drop_bcast_own_entry(orig_node, max_if_num,
del_if_num);
batadv_iv_ogm_drop_bcast_own_sum_entry(orig_node, max_if_num,
del_if_num);
}
ret = 0;
unlock:
spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock); spin_unlock_bh(&orig_node->bat_iv.ogm_cnt_lock);
return ret; return 0;
} }
/** /**
...@@ -1829,9 +1866,8 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv, ...@@ -1829,9 +1866,8 @@ static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv,
int batman_count = 0; int batman_count = 0;
u32 i; u32 i;
seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", seq_puts(seq,
"Originator", "last-seen", "#", BATADV_TQ_MAX_VALUE, " Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ...\n");
"Nexthop", "outgoingIF", "Potential nexthops");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
...@@ -1911,8 +1947,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv, ...@@ -1911,8 +1947,7 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv,
struct batadv_hard_iface *hard_iface; struct batadv_hard_iface *hard_iface;
int batman_count = 0; int batman_count = 0;
seq_printf(seq, " %10s %-13s %s\n", seq_puts(seq, " IF Neighbor last-seen\n");
"IF", "Neighbor", "last-seen");
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
......
...@@ -162,8 +162,8 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv, ...@@ -162,8 +162,8 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv,
struct batadv_hard_iface *hard_iface; struct batadv_hard_iface *hard_iface;
int batman_count = 0; int batman_count = 0;
seq_printf(seq, " %-15s %s (%11s) [%10s]\n", "Neighbor", seq_puts(seq,
"last-seen", "throughput", "IF"); " Neighbor last-seen ( throughput) [ IF]\n");
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) { list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
...@@ -202,9 +202,8 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv, ...@@ -202,9 +202,8 @@ static void batadv_v_orig_print(struct batadv_priv *bat_priv,
int batman_count = 0; int batman_count = 0;
u32 i; u32 i;
seq_printf(seq, " %-15s %s (%11s) %17s [%10s]: %20s ...\n", seq_puts(seq,
"Originator", "last-seen", "throughput", "Nexthop", " Originator last-seen ( throughput) Nexthop [outgoingIF]: Potential nexthops ...\n");
"outgoingIF", "Potential nexthops");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
......
This diff is collapsed.
...@@ -120,7 +120,7 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, ...@@ -120,7 +120,7 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node,
} }
/** /**
* batadv_compare_backbone_gw - compare address and vid of two claims * batadv_compare_claim - compare address and vid of two claims
* @node: list node of the first entry to compare * @node: list node of the first entry to compare
* @data2: pointer to the second claims * @data2: pointer to the second claims
* *
...@@ -200,8 +200,8 @@ static void batadv_claim_put(struct batadv_bla_claim *claim) ...@@ -200,8 +200,8 @@ static void batadv_claim_put(struct batadv_bla_claim *claim)
* *
* Return: claim if found or NULL otherwise. * Return: claim if found or NULL otherwise.
*/ */
static struct batadv_bla_claim static struct batadv_bla_claim *
*batadv_claim_hash_find(struct batadv_priv *bat_priv, batadv_claim_hash_find(struct batadv_priv *bat_priv,
struct batadv_bla_claim *data) struct batadv_bla_claim *data)
{ {
struct batadv_hashtable *hash = bat_priv->bla.claim_hash; struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
...@@ -1303,7 +1303,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) ...@@ -1303,7 +1303,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
struct batadv_hard_iface *primary_if; struct batadv_hard_iface *primary_if;
int i; int i;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
priv_bla = container_of(delayed_work, struct batadv_priv_bla, work); priv_bla = container_of(delayed_work, struct batadv_priv_bla, work);
bat_priv = container_of(priv_bla, struct batadv_priv, bla); bat_priv = container_of(priv_bla, struct batadv_priv, bla);
primary_if = batadv_primary_if_get_selected(bat_priv); primary_if = batadv_primary_if_get_selected(bat_priv);
...@@ -1575,7 +1575,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, ...@@ -1575,7 +1575,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
} }
/** /**
* batadv_bla_init - free all bla structures * batadv_bla_free - free all bla structures
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* for softinterface free or module unload * for softinterface free or module unload
...@@ -1815,8 +1815,8 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1815,8 +1815,8 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
"Claims announced for the mesh %s (orig %pM, group id %#.4x)\n", "Claims announced for the mesh %s (orig %pM, group id %#.4x)\n",
net_dev->name, primary_addr, net_dev->name, primary_addr,
ntohs(bat_priv->bla.claim_dest.group)); ntohs(bat_priv->bla.claim_dest.group));
seq_printf(seq, " %-17s %-5s %-17s [o] (%-6s)\n", seq_puts(seq,
"Client", "VID", "Originator", "CRC"); " Client VID Originator [o] (CRC )\n");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
...@@ -1873,8 +1873,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1873,8 +1873,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
"Backbones announced for the mesh %s (orig %pM, group id %#.4x)\n", "Backbones announced for the mesh %s (orig %pM, group id %#.4x)\n",
net_dev->name, primary_addr, net_dev->name, primary_addr,
ntohs(bat_priv->bla.claim_dest.group)); ntohs(bat_priv->bla.claim_dest.group));
seq_printf(seq, " %-17s %-5s %-9s (%-6s)\n", seq_puts(seq, " Originator VID last seen (CRC )\n");
"Originator", "VID", "last seen", "CRC");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
......
...@@ -365,14 +365,17 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file) ...@@ -365,14 +365,17 @@ static int batadv_nc_nodes_open(struct inode *inode, struct file *file)
#define BATADV_DEBUGINFO(_name, _mode, _open) \ #define BATADV_DEBUGINFO(_name, _mode, _open) \
struct batadv_debuginfo batadv_debuginfo_##_name = { \ struct batadv_debuginfo batadv_debuginfo_##_name = { \
.attr = { .name = __stringify(_name), \ .attr = { \
.mode = _mode, }, \ .name = __stringify(_name), \
.fops = { .owner = THIS_MODULE, \ .mode = _mode, \
}, \
.fops = { \
.owner = THIS_MODULE, \
.open = _open, \ .open = _open, \
.read = seq_read, \ .read = seq_read, \
.llseek = seq_lseek, \ .llseek = seq_lseek, \
.release = single_release, \ .release = single_release, \
} \ }, \
} }
/* the following attributes are general and therefore they will be directly /* the following attributes are general and therefore they will be directly
......
...@@ -152,7 +152,7 @@ static void batadv_dat_purge(struct work_struct *work) ...@@ -152,7 +152,7 @@ static void batadv_dat_purge(struct work_struct *work)
struct batadv_priv_dat *priv_dat; struct batadv_priv_dat *priv_dat;
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
priv_dat = container_of(delayed_work, struct batadv_priv_dat, work); priv_dat = container_of(delayed_work, struct batadv_priv_dat, work);
bat_priv = container_of(priv_dat, struct batadv_priv, dat); bat_priv = container_of(priv_dat, struct batadv_priv, dat);
...@@ -720,7 +720,7 @@ void batadv_dat_status_update(struct net_device *net_dev) ...@@ -720,7 +720,7 @@ void batadv_dat_status_update(struct net_device *net_dev)
} }
/** /**
* batadv_gw_tvlv_ogm_handler_v1 - process incoming dat tvlv container * batadv_dat_tvlv_ogm_handler_v1 - process incoming dat tvlv container
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @orig: the orig_node of the ogm * @orig: the orig_node of the ogm
* @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags)
...@@ -817,8 +817,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset) ...@@ -817,8 +817,8 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
goto out; goto out;
seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name); seq_printf(seq, "Distributed ARP Table (%s):\n", net_dev->name);
seq_printf(seq, " %-7s %-9s %4s %11s\n", "IPv4", seq_puts(seq,
"MAC", "VID", "last-seen"); " IPv4 MAC VID last-seen\n");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
......
...@@ -407,8 +407,8 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb, ...@@ -407,8 +407,8 @@ static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
unsigned int mtu) unsigned int mtu)
{ {
struct sk_buff *skb_fragment; struct sk_buff *skb_fragment;
unsigned header_size = sizeof(*frag_head); unsigned int header_size = sizeof(*frag_head);
unsigned fragment_size = mtu - header_size; unsigned int fragment_size = mtu - header_size;
skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN); skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN);
if (!skb_fragment) if (!skb_fragment)
...@@ -444,15 +444,15 @@ bool batadv_frag_send_packet(struct sk_buff *skb, ...@@ -444,15 +444,15 @@ bool batadv_frag_send_packet(struct sk_buff *skb,
struct batadv_hard_iface *primary_if = NULL; struct batadv_hard_iface *primary_if = NULL;
struct batadv_frag_packet frag_header; struct batadv_frag_packet frag_header;
struct sk_buff *skb_fragment; struct sk_buff *skb_fragment;
unsigned mtu = neigh_node->if_incoming->net_dev->mtu; unsigned int mtu = neigh_node->if_incoming->net_dev->mtu;
unsigned header_size = sizeof(frag_header); unsigned int header_size = sizeof(frag_header);
unsigned max_fragment_size, max_packet_size; unsigned int max_fragment_size, max_packet_size;
bool ret = false; bool ret = false;
/* To avoid merge and refragmentation at next-hops we never send /* To avoid merge and refragmentation at next-hops we never send
* fragments larger than BATADV_FRAG_MAX_FRAG_SIZE * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE
*/ */
mtu = min_t(unsigned, mtu, BATADV_FRAG_MAX_FRAG_SIZE); mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
max_fragment_size = mtu - header_size; max_fragment_size = mtu - header_size;
max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS; max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS;
......
...@@ -104,25 +104,21 @@ static int batadv_socket_open(struct inode *inode, struct file *file) ...@@ -104,25 +104,21 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
static int batadv_socket_release(struct inode *inode, struct file *file) static int batadv_socket_release(struct inode *inode, struct file *file)
{ {
struct batadv_socket_client *socket_client = file->private_data; struct batadv_socket_client *client = file->private_data;
struct batadv_socket_packet *socket_packet; struct batadv_socket_packet *packet, *tmp;
struct list_head *list_pos, *list_pos_tmp;
spin_lock_bh(&socket_client->lock); spin_lock_bh(&client->lock);
/* for all packets in the queue ... */ /* for all packets in the queue ... */
list_for_each_safe(list_pos, list_pos_tmp, &socket_client->queue_list) { list_for_each_entry_safe(packet, tmp, &client->queue_list, list) {
socket_packet = list_entry(list_pos, list_del(&packet->list);
struct batadv_socket_packet, list); kfree(packet);
list_del(list_pos);
kfree(socket_packet);
} }
batadv_socket_client_hash[socket_client->index] = NULL; batadv_socket_client_hash[client->index] = NULL;
spin_unlock_bh(&socket_client->lock); spin_unlock_bh(&client->lock);
kfree(socket_client); kfree(client);
module_put(THIS_MODULE); module_put(THIS_MODULE);
return 0; return 0;
...@@ -337,7 +333,7 @@ int batadv_socket_setup(struct batadv_priv *bat_priv) ...@@ -337,7 +333,7 @@ int batadv_socket_setup(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_socket_receive_packet - schedule an icmp packet to be sent to * batadv_socket_add_packet - schedule an icmp packet to be sent to
* userspace on an icmp socket. * userspace on an icmp socket.
* @socket_client: the socket this packet belongs to * @socket_client: the socket this packet belongs to
* @icmph: pointer to the header of the icmp packet * @icmph: pointer to the header of the icmp packet
......
...@@ -663,8 +663,8 @@ static void batadv_tvlv_handler_put(struct batadv_tvlv_handler *tvlv_handler) ...@@ -663,8 +663,8 @@ static void batadv_tvlv_handler_put(struct batadv_tvlv_handler *tvlv_handler)
* *
* Return: tvlv handler if found or NULL otherwise. * Return: tvlv handler if found or NULL otherwise.
*/ */
static struct batadv_tvlv_handler static struct batadv_tvlv_handler *
*batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version) batadv_tvlv_handler_get(struct batadv_priv *bat_priv, u8 type, u8 version)
{ {
struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL; struct batadv_tvlv_handler *tvlv_handler_tmp, *tvlv_handler = NULL;
...@@ -722,8 +722,8 @@ static void batadv_tvlv_container_put(struct batadv_tvlv_container *tvlv) ...@@ -722,8 +722,8 @@ static void batadv_tvlv_container_put(struct batadv_tvlv_container *tvlv)
* *
* Return: tvlv container if found or NULL otherwise. * Return: tvlv container if found or NULL otherwise.
*/ */
static struct batadv_tvlv_container static struct batadv_tvlv_container *
*batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version) batadv_tvlv_container_get(struct batadv_priv *bat_priv, u8 type, u8 version)
{ {
struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL; struct batadv_tvlv_container *tvlv_tmp, *tvlv = NULL;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define BATADV_DRIVER_DEVICE "batman-adv" #define BATADV_DRIVER_DEVICE "batman-adv"
#ifndef BATADV_SOURCE_VERSION #ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION "2016.1" #define BATADV_SOURCE_VERSION "2016.2"
#endif #endif
/* B.A.T.M.A.N. parameters */ /* B.A.T.M.A.N. parameters */
...@@ -296,7 +296,8 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2) ...@@ -296,7 +296,8 @@ static inline bool batadv_compare_eth(const void *data1, const void *data2)
} }
/** /**
* has_timed_out - compares current time (jiffies) and timestamp + timeout * batadv_has_timed_out - compares current time (jiffies) and timestamp +
* timeout
* @timestamp: base value to compare with (in jiffies) * @timestamp: base value to compare with (in jiffies)
* @timeout: added to base value before comparing (in milliseconds) * @timeout: added to base value before comparing (in milliseconds)
* *
......
...@@ -394,7 +394,8 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv, ...@@ -394,7 +394,8 @@ static int batadv_mcast_forw_mode_check(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_mcast_want_all_ip_count - count nodes with unspecific mcast interest * batadv_mcast_forw_want_all_ip_count - count nodes with unspecific mcast
* interest
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: ethernet header of a packet * @ethhdr: ethernet header of a packet
* *
...@@ -433,7 +434,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, ...@@ -433,7 +434,7 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_mcast_want_forw_ipv4_node_get - get a node with an ipv4 flag * batadv_mcast_forw_ipv4_node_get - get a node with an ipv4 flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV4 flag set and
...@@ -460,7 +461,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) ...@@ -460,7 +461,7 @@ batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_mcast_want_forw_ipv6_node_get - get a node with an ipv6 flag * batadv_mcast_forw_ipv6_node_get - get a node with an ipv6 flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_IPV6 flag set
...@@ -487,7 +488,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) ...@@ -487,7 +488,7 @@ batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv)
} }
/** /**
* batadv_mcast_want_forw_ip_node_get - get a node with an ipv4/ipv6 flag * batadv_mcast_forw_ip_node_get - get a node with an ipv4/ipv6 flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @ethhdr: an ethernet header to determine the protocol family from * @ethhdr: an ethernet header to determine the protocol family from
* *
...@@ -511,7 +512,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv, ...@@ -511,7 +512,7 @@ batadv_mcast_forw_ip_node_get(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_mcast_want_forw_unsnoop_node_get - get a node with an unsnoopable flag * batadv_mcast_forw_unsnoop_node_get - get a node with an unsnoopable flag
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* *
* Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag * Return: an orig_node which has the BATADV_MCAST_WANT_ALL_UNSNOOPABLES flag
......
...@@ -714,7 +714,7 @@ static void batadv_nc_worker(struct work_struct *work) ...@@ -714,7 +714,7 @@ static void batadv_nc_worker(struct work_struct *work)
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
unsigned long timeout; unsigned long timeout;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
priv_nc = container_of(delayed_work, struct batadv_priv_nc, work); priv_nc = container_of(delayed_work, struct batadv_priv_nc, work);
bat_priv = container_of(priv_nc, struct batadv_priv, nc); bat_priv = container_of(priv_nc, struct batadv_priv, nc);
...@@ -793,8 +793,8 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv, ...@@ -793,8 +793,8 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
* *
* Return: the nc_node if found, NULL otherwise. * Return: the nc_node if found, NULL otherwise.
*/ */
static struct batadv_nc_node static struct batadv_nc_node *
*batadv_nc_find_nc_node(struct batadv_orig_node *orig_node, batadv_nc_find_nc_node(struct batadv_orig_node *orig_node,
struct batadv_orig_node *orig_neigh_node, struct batadv_orig_node *orig_neigh_node,
bool in_coding) bool in_coding)
{ {
...@@ -835,8 +835,8 @@ static struct batadv_nc_node ...@@ -835,8 +835,8 @@ static struct batadv_nc_node
* *
* Return: the nc_node if found or created, NULL in case of an error. * Return: the nc_node if found or created, NULL in case of an error.
*/ */
static struct batadv_nc_node static struct batadv_nc_node *
*batadv_nc_get_nc_node(struct batadv_priv *bat_priv, batadv_nc_get_nc_node(struct batadv_priv *bat_priv,
struct batadv_orig_node *orig_node, struct batadv_orig_node *orig_node,
struct batadv_orig_node *orig_neigh_node, struct batadv_orig_node *orig_neigh_node,
bool in_coding) bool in_coding)
......
...@@ -282,7 +282,7 @@ void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node) ...@@ -282,7 +282,7 @@ void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node)
} }
/** /**
* batadv_orig_node_get_router - router to the originator depending on iface * batadv_orig_router_get - router to the originator depending on iface
* @orig_node: the orig node for the router * @orig_node: the orig node for the router
* @if_outgoing: the interface where the payload packet has been received or * @if_outgoing: the interface where the payload packet has been received or
* the OGM should be sent to * the OGM should be sent to
...@@ -1217,7 +1217,7 @@ static void batadv_purge_orig(struct work_struct *work) ...@@ -1217,7 +1217,7 @@ static void batadv_purge_orig(struct work_struct *work)
struct delayed_work *delayed_work; struct delayed_work *delayed_work;
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
bat_priv = container_of(delayed_work, struct batadv_priv, orig_work); bat_priv = container_of(delayed_work, struct batadv_priv, orig_work);
_batadv_purge_orig(bat_priv); _batadv_purge_orig(bat_priv);
queue_delayed_work(batadv_event_workqueue, queue_delayed_work(batadv_event_workqueue,
......
...@@ -501,7 +501,7 @@ struct batadv_coded_packet { ...@@ -501,7 +501,7 @@ struct batadv_coded_packet {
#pragma pack() #pragma pack()
/** /**
* struct batadv_unicast_tvlv - generic unicast packet with tvlv payload * struct batadv_unicast_tvlv_packet - generic unicast packet with tvlv payload
* @packet_type: batman-adv packet type, part of the general header * @packet_type: batman-adv packet type, part of the general header
* @version: batman-adv protocol version, part of the genereal header * @version: batman-adv protocol version, part of the genereal header
* @ttl: time to live for this packet, part of the genereal header * @ttl: time to live for this packet, part of the genereal header
......
...@@ -552,7 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work) ...@@ -552,7 +552,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
struct net_device *soft_iface; struct net_device *soft_iface;
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
forw_packet = container_of(delayed_work, struct batadv_forw_packet, forw_packet = container_of(delayed_work, struct batadv_forw_packet,
delayed_work); delayed_work);
soft_iface = forw_packet->if_incoming->soft_iface; soft_iface = forw_packet->if_incoming->soft_iface;
...@@ -604,7 +604,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work) ...@@ -604,7 +604,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
struct batadv_forw_packet *forw_packet; struct batadv_forw_packet *forw_packet;
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
forw_packet = container_of(delayed_work, struct batadv_forw_packet, forw_packet = container_of(delayed_work, struct batadv_forw_packet,
delayed_work); delayed_work);
bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface); bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface);
......
...@@ -381,6 +381,24 @@ static int batadv_interface_tx(struct sk_buff *skb, ...@@ -381,6 +381,24 @@ static int batadv_interface_tx(struct sk_buff *skb,
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
/**
* batadv_interface_rx - receive ethernet frame on local batman-adv interface
* @soft_iface: local interface which will receive the ethernet frame
* @skb: ethernet frame for @soft_iface
* @recv_if: interface on which the batman-adv packet was received
* @hdr_size: size of already parsed batman-adv header
* @orig_node: originator from which the batman-adv packet was sent
*
* Sends a ethernet frame to the receive path of the local @soft_iface.
* skb->data has still point to the batman-adv header with the size @hdr_size.
* The caller has to have parsed this header already and made sure that at least
* @hdr_size bytes are still available for pull in @skb.
*
* The packet may still get dropped. This can happen when the encapsulated
* ethernet frame is invalid or contains again an batman-adv packet. Also
* unicast packets will be dropped directly when it was sent between two
* isolated clients.
*/
void batadv_interface_rx(struct net_device *soft_iface, void batadv_interface_rx(struct net_device *soft_iface,
struct sk_buff *skb, struct batadv_hard_iface *recv_if, struct sk_buff *skb, struct batadv_hard_iface *recv_if,
int hdr_size, struct batadv_orig_node *orig_node) int hdr_size, struct batadv_orig_node *orig_node)
...@@ -543,7 +561,7 @@ struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv, ...@@ -543,7 +561,7 @@ struct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv,
} }
/** /**
* batadv_create_vlan - allocate the needed resources for a new vlan * batadv_softif_create_vlan - allocate the needed resources for a new vlan
* @bat_priv: the bat priv with all the soft interface information * @bat_priv: the bat priv with all the soft interface information
* @vid: the VLAN identifier * @vid: the VLAN identifier
* *
......
...@@ -1010,8 +1010,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1010,8 +1010,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
seq_printf(seq, seq_printf(seq,
"Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n",
net_dev->name, (u8)atomic_read(&bat_priv->tt.vn)); net_dev->name, (u8)atomic_read(&bat_priv->tt.vn));
seq_printf(seq, " %-13s %s %-8s %-9s (%-10s)\n", "Client", "VID", seq_puts(seq,
"Flags", "Last seen", "CRC"); " Client VID Flags Last seen (CRC )\n");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
...@@ -1680,9 +1680,8 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) ...@@ -1680,9 +1680,8 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
seq_printf(seq, seq_printf(seq,
"Globally announced TT entries received via the mesh %s\n", "Globally announced TT entries received via the mesh %s\n",
net_dev->name); net_dev->name);
seq_printf(seq, " %-13s %s %s %-15s %s (%-10s) %s\n", seq_puts(seq,
"Client", "VID", "(TTVN)", "Originator", "(Curr TTVN)", " Client VID (TTVN) Originator (Curr TTVN) (CRC ) Flags\n");
"CRC", "Flags");
for (i = 0; i < hash->size; i++) { for (i = 0; i < hash->size; i++) {
head = &hash->table[i]; head = &hash->table[i];
...@@ -3201,7 +3200,7 @@ static void batadv_tt_purge(struct work_struct *work) ...@@ -3201,7 +3200,7 @@ static void batadv_tt_purge(struct work_struct *work)
struct batadv_priv_tt *priv_tt; struct batadv_priv_tt *priv_tt;
struct batadv_priv *bat_priv; struct batadv_priv *bat_priv;
delayed_work = container_of(work, struct delayed_work, work); delayed_work = to_delayed_work(work);
priv_tt = container_of(delayed_work, struct batadv_priv_tt, work); priv_tt = container_of(delayed_work, struct batadv_priv_tt, work);
bat_priv = container_of(priv_tt, struct batadv_priv, tt); bat_priv = container_of(priv_tt, struct batadv_priv, tt);
......
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