aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/aggregation.c2
-rw-r--r--net/batman-adv/bat_sysfs.c14
-rw-r--r--net/batman-adv/gateway_client.c6
-rw-r--r--net/batman-adv/gateway_common.c4
-rw-r--r--net/batman-adv/hard-interface.c2
-rw-r--r--net/batman-adv/hard-interface.h14
-rw-r--r--net/batman-adv/main.h19
-rw-r--r--net/batman-adv/packet.h47
-rw-r--r--net/batman-adv/routing.c9
-rw-r--r--net/batman-adv/send.c2
10 files changed, 72 insertions, 47 deletions
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c
index b41f25b5947..4080970ade7 100644
--- a/net/batman-adv/aggregation.c
+++ b/net/batman-adv/aggregation.c
@@ -151,7 +151,7 @@ static void new_aggregated_packet(const unsigned char *packet_buff,
151 forw_packet_aggr->own = own_packet; 151 forw_packet_aggr->own = own_packet;
152 forw_packet_aggr->if_incoming = if_incoming; 152 forw_packet_aggr->if_incoming = if_incoming;
153 forw_packet_aggr->num_packets = 0; 153 forw_packet_aggr->num_packets = 0;
154 forw_packet_aggr->direct_link_flags = 0; 154 forw_packet_aggr->direct_link_flags = NO_FLAGS;
155 forw_packet_aggr->send_time = send_time; 155 forw_packet_aggr->send_time = send_time;
156 156
157 /* save packet direct link flag status */ 157 /* save packet direct link flag status */
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 6f70560ef50..924d5773da2 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -28,9 +28,17 @@
28#include "gateway_client.h" 28#include "gateway_client.h"
29#include "vis.h" 29#include "vis.h"
30 30
31#define to_dev(obj) container_of(obj, struct device, kobj) 31static struct net_device *kobj_to_netdev(struct kobject *obj)
32#define kobj_to_netdev(obj) to_net_dev(to_dev(obj->parent)) 32{
33#define kobj_to_batpriv(obj) netdev_priv(kobj_to_netdev(obj)) 33 struct device *dev = container_of(obj->parent, struct device, kobj);
34 return to_net_dev(dev);
35}
36
37static struct bat_priv *kobj_to_batpriv(struct kobject *obj)
38{
39 struct net_device *net_dev = kobj_to_netdev(obj);
40 return netdev_priv(net_dev);
41}
34 42
35/* Use this, if you have customized show and store functions */ 43/* Use this, if you have customized show and store functions */
36#define BAT_ATTR(_name, _mode, _show, _store) \ 44#define BAT_ATTR(_name, _mode, _show, _store) \
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index ab597c4f9dd..24aee561f3d 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -322,7 +322,7 @@ void gw_node_update(struct bat_priv *bat_priv,
322 322
323 gw_node->deleted = 0; 323 gw_node->deleted = 0;
324 324
325 if (new_gwflags == 0) { 325 if (new_gwflags == NO_FLAGS) {
326 gw_node->deleted = jiffies; 326 gw_node->deleted = jiffies;
327 bat_dbg(DBG_BATMAN, bat_priv, 327 bat_dbg(DBG_BATMAN, bat_priv,
328 "Gateway %pM removed from gateway list\n", 328 "Gateway %pM removed from gateway list\n",
@@ -335,7 +335,7 @@ void gw_node_update(struct bat_priv *bat_priv,
335 goto unlock; 335 goto unlock;
336 } 336 }
337 337
338 if (new_gwflags == 0) 338 if (new_gwflags == NO_FLAGS)
339 goto unlock; 339 goto unlock;
340 340
341 gw_node_add(bat_priv, orig_node, new_gwflags); 341 gw_node_add(bat_priv, orig_node, new_gwflags);
@@ -352,7 +352,7 @@ unlock:
352 352
353void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node) 353void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node)
354{ 354{
355 return gw_node_update(bat_priv, orig_node, 0); 355 gw_node_update(bat_priv, orig_node, 0);
356} 356}
357 357
358void gw_node_purge(struct bat_priv *bat_priv) 358void gw_node_purge(struct bat_priv *bat_priv)
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c
index ed3bd366a2a..e74307be8e0 100644
--- a/net/batman-adv/gateway_common.c
+++ b/net/batman-adv/gateway_common.c
@@ -97,7 +97,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
97 *tmp_ptr = '\0'; 97 *tmp_ptr = '\0';
98 } 98 }
99 99
100 ret = strict_strtoul(buff, 10, &ldown); 100 ret = strict_strtol(buff, 10, &ldown);
101 if (ret) { 101 if (ret) {
102 bat_err(net_dev, 102 bat_err(net_dev,
103 "Download speed of gateway mode invalid: %s\n", 103 "Download speed of gateway mode invalid: %s\n",
@@ -122,7 +122,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
122 *tmp_ptr = '\0'; 122 *tmp_ptr = '\0';
123 } 123 }
124 124
125 ret = strict_strtoul(slash_ptr + 1, 10, &lup); 125 ret = strict_strtol(slash_ptr + 1, 10, &lup);
126 if (ret) { 126 if (ret) {
127 bat_err(net_dev, 127 bat_err(net_dev,
128 "Upload speed of gateway mode invalid: " 128 "Upload speed of gateway mode invalid: "
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 57190870d8b..abb490106f3 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -337,7 +337,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
337 batman_packet = (struct batman_packet *)(hard_iface->packet_buff); 337 batman_packet = (struct batman_packet *)(hard_iface->packet_buff);
338 batman_packet->packet_type = BAT_PACKET; 338 batman_packet->packet_type = BAT_PACKET;
339 batman_packet->version = COMPAT_VERSION; 339 batman_packet->version = COMPAT_VERSION;
340 batman_packet->flags = 0; 340 batman_packet->flags = NO_FLAGS;
341 batman_packet->ttl = 2; 341 batman_packet->ttl = 2;
342 batman_packet->tq = TQ_MAX_VALUE; 342 batman_packet->tq = TQ_MAX_VALUE;
343 batman_packet->num_tt = 0; 343 batman_packet->num_tt = 0;
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index 79e25cbb800..442eacbc9e3 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -22,12 +22,14 @@
22#ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ 22#ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
23#define _NET_BATMAN_ADV_HARD_INTERFACE_H_ 23#define _NET_BATMAN_ADV_HARD_INTERFACE_H_
24 24
25#define IF_NOT_IN_USE 0 25enum hard_if_state {
26#define IF_TO_BE_REMOVED 1 26 IF_NOT_IN_USE,
27#define IF_INACTIVE 2 27 IF_TO_BE_REMOVED,
28#define IF_ACTIVE 3 28 IF_INACTIVE,
29#define IF_TO_BE_ACTIVATED 4 29 IF_ACTIVE,
30#define IF_I_WANT_YOU 5 30 IF_TO_BE_ACTIVATED,
31 IF_I_WANT_YOU
32};
31 33
32extern struct notifier_block hard_if_notifier; 34extern struct notifier_block hard_if_notifier;
33 35
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 610eaf0759a..ed488cbae80 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -51,6 +51,8 @@
51#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1 51#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1
52#define TQ_TOTAL_BIDRECT_LIMIT 1 52#define TQ_TOTAL_BIDRECT_LIMIT 1
53 53
54#define NO_FLAGS 0
55
54#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE) 56#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
55 57
56#define LOG_BUF_LEN 8192 /* has to be a power of 2 */ 58#define LOG_BUF_LEN 8192 /* has to be a power of 2 */
@@ -72,9 +74,11 @@
72#define RESET_PROTECTION_MS 30000 74#define RESET_PROTECTION_MS 30000
73#define EXPECTED_SEQNO_RANGE 65536 75#define EXPECTED_SEQNO_RANGE 65536
74 76
75#define MESH_INACTIVE 0 77enum mesh_state {
76#define MESH_ACTIVE 1 78 MESH_INACTIVE,
77#define MESH_DEACTIVATING 2 79 MESH_ACTIVE,
80 MESH_DEACTIVATING
81};
78 82
79#define BCAST_QUEUE_LEN 256 83#define BCAST_QUEUE_LEN 256
80#define BATMAN_QUEUE_LEN 256 84#define BATMAN_QUEUE_LEN 256
@@ -89,10 +93,11 @@
89#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 93#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
90 94
91/* all messages related to routing / flooding / broadcasting / etc */ 95/* all messages related to routing / flooding / broadcasting / etc */
92#define DBG_BATMAN 1 96enum dbg_level {
93/* route or tt entry added / changed / deleted */ 97 DBG_BATMAN = 1 << 0,
94#define DBG_ROUTES 2 98 DBG_ROUTES = 1 << 1, /* route added / changed / deleted */
95#define DBG_ALL 3 99 DBG_ALL = 3
100};
96 101
97 102
98/* 103/*
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index eda99650e9f..9f77086a546 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -24,33 +24,44 @@
24 24
25#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ 25#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
26 26
27#define BAT_PACKET 0x01 27enum bat_packettype {
28#define BAT_ICMP 0x02 28 BAT_PACKET = 0x01,
29#define BAT_UNICAST 0x03 29 BAT_ICMP = 0x02,
30#define BAT_BCAST 0x04 30 BAT_UNICAST = 0x03,
31#define BAT_VIS 0x05 31 BAT_BCAST = 0x04,
32#define BAT_UNICAST_FRAG 0x06 32 BAT_VIS = 0x05,
33 BAT_UNICAST_FRAG = 0x06
34};
33 35
34/* this file is included by batctl which needs these defines */ 36/* this file is included by batctl which needs these defines */
35#define COMPAT_VERSION 12 37#define COMPAT_VERSION 12
36#define DIRECTLINK 0x40 38
37#define VIS_SERVER 0x20 39enum batman_flags {
38#define PRIMARIES_FIRST_HOP 0x10 40 PRIMARIES_FIRST_HOP = 1 << 4,
41 VIS_SERVER = 1 << 5,
42 DIRECTLINK = 1 << 6
43};
39 44
40/* ICMP message types */ 45/* ICMP message types */
41#define ECHO_REPLY 0 46enum icmp_packettype {
42#define DESTINATION_UNREACHABLE 3 47 ECHO_REPLY = 0,
43#define ECHO_REQUEST 8 48 DESTINATION_UNREACHABLE = 3,
44#define TTL_EXCEEDED 11 49 ECHO_REQUEST = 8,
45#define PARAMETER_PROBLEM 12 50 TTL_EXCEEDED = 11,
51 PARAMETER_PROBLEM = 12
52};
46 53
47/* vis defines */ 54/* vis defines */
48#define VIS_TYPE_SERVER_SYNC 0 55enum vis_packettype {
49#define VIS_TYPE_CLIENT_UPDATE 1 56 VIS_TYPE_SERVER_SYNC = 0,
57 VIS_TYPE_CLIENT_UPDATE = 1
58};
50 59
51/* fragmentation defines */ 60/* fragmentation defines */
52#define UNI_FRAG_HEAD 0x01 61enum unicast_frag_flags {
53#define UNI_FRAG_LARGETAIL 0x02 62 UNI_FRAG_HEAD = 1 << 0,
63 UNI_FRAG_LARGETAIL = 1 << 1
64};
54 65
55struct batman_packet { 66struct batman_packet {
56 uint8_t packet_type; 67 uint8_t packet_type;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 368ceeba814..934f1f2f86c 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -698,17 +698,16 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
698 698
699 /* neighbor has to indicate direct link and it has to 699 /* neighbor has to indicate direct link and it has to
700 * come via the corresponding interface */ 700 * come via the corresponding interface */
701 /* if received seqno equals last send seqno save new 701 /* save packet seqno for bidirectional check */
702 * seqno for bidirectional check */
703 if (has_directlink_flag && 702 if (has_directlink_flag &&
704 compare_eth(if_incoming->net_dev->dev_addr, 703 compare_eth(if_incoming->net_dev->dev_addr,
705 batman_packet->orig) && 704 batman_packet->orig)) {
706 (batman_packet->seqno - if_incoming_seqno + 2 == 0)) {
707 offset = if_incoming->if_num * NUM_WORDS; 705 offset = if_incoming->if_num * NUM_WORDS;
708 706
709 spin_lock_bh(&orig_neigh_node->ogm_cnt_lock); 707 spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
710 word = &(orig_neigh_node->bcast_own[offset]); 708 word = &(orig_neigh_node->bcast_own[offset]);
711 bit_mark(word, 0); 709 bit_mark(word,
710 if_incoming_seqno - batman_packet->seqno - 2);
712 orig_neigh_node->bcast_own_sum[if_incoming->if_num] = 711 orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
713 bit_packet_count(word); 712 bit_packet_count(word);
714 spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock); 713 spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index d0cfa95e303..a1b8c3173a3 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -289,7 +289,7 @@ void schedule_own_packet(struct hard_iface *hard_iface)
289 batman_packet->gw_flags = 289 batman_packet->gw_flags =
290 (uint8_t)atomic_read(&bat_priv->gw_bandwidth); 290 (uint8_t)atomic_read(&bat_priv->gw_bandwidth);
291 else 291 else
292 batman_packet->gw_flags = 0; 292 batman_packet->gw_flags = NO_FLAGS;
293 293
294 atomic_inc(&hard_iface->seqno); 294 atomic_inc(&hard_iface->seqno);
295 295