diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-05 22:45:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-05 22:45:12 -0400 |
commit | f8bae99ee5030625a4e7f0d87784191882292f0e (patch) | |
tree | 991cd2aff1ec1b74d1e3c658eb2ea09b0f93e5bd /net/batman-adv | |
parent | 994635a137f637466d36a7c6272dae014a46a11c (diff) | |
parent | 44c4349a2a117b22a5c4087f2ac9faf10c575e17 (diff) |
Merge branch 'batman-adv/next' of git://git.open-mesh.org/linux-merge
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/aggregation.c | 25 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 5 | ||||
-rw-r--r-- | net/batman-adv/main.c | 9 | ||||
-rw-r--r-- | net/batman-adv/main.h | 11 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 5 | ||||
-rw-r--r-- | net/batman-adv/packet.h | 11 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 2 | ||||
-rw-r--r-- | net/batman-adv/send.c | 21 | ||||
-rw-r--r-- | net/batman-adv/send.h | 2 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 2 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 30 | ||||
-rw-r--r-- | net/batman-adv/translation-table.h | 3 | ||||
-rw-r--r-- | net/batman-adv/types.h | 4 |
13 files changed, 71 insertions, 59 deletions
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c index c583e049f421..69467fe71ff2 100644 --- a/net/batman-adv/aggregation.c +++ b/net/batman-adv/aggregation.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | /* return true if new_packet can be aggregated with forw_packet */ | 29 | /* return true if new_packet can be aggregated with forw_packet */ |
30 | static bool can_aggregate_with(const struct batman_packet *new_batman_packet, | 30 | static bool can_aggregate_with(const struct batman_packet *new_batman_packet, |
31 | struct bat_priv *bat_priv, | ||
31 | int packet_len, | 32 | int packet_len, |
32 | unsigned long send_time, | 33 | unsigned long send_time, |
33 | bool directlink, | 34 | bool directlink, |
@@ -37,6 +38,8 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet, | |||
37 | struct batman_packet *batman_packet = | 38 | struct batman_packet *batman_packet = |
38 | (struct batman_packet *)forw_packet->skb->data; | 39 | (struct batman_packet *)forw_packet->skb->data; |
39 | int aggregated_bytes = forw_packet->packet_len + packet_len; | 40 | int aggregated_bytes = forw_packet->packet_len + packet_len; |
41 | struct hard_iface *primary_if = NULL; | ||
42 | bool res = false; | ||
40 | 43 | ||
41 | /** | 44 | /** |
42 | * we can aggregate the current packet to this aggregated packet | 45 | * we can aggregate the current packet to this aggregated packet |
@@ -61,6 +64,10 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet, | |||
61 | * packet | 64 | * packet |
62 | */ | 65 | */ |
63 | 66 | ||
67 | primary_if = primary_if_get_selected(bat_priv); | ||
68 | if (!primary_if) | ||
69 | goto out; | ||
70 | |||
64 | /* packets without direct link flag and high TTL | 71 | /* packets without direct link flag and high TTL |
65 | * are flooded through the net */ | 72 | * are flooded through the net */ |
66 | if ((!directlink) && | 73 | if ((!directlink) && |
@@ -70,8 +77,10 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet, | |||
70 | /* own packets originating non-primary | 77 | /* own packets originating non-primary |
71 | * interfaces leave only that interface */ | 78 | * interfaces leave only that interface */ |
72 | ((!forw_packet->own) || | 79 | ((!forw_packet->own) || |
73 | (forw_packet->if_incoming->if_num == 0))) | 80 | (forw_packet->if_incoming == primary_if))) { |
74 | return true; | 81 | res = true; |
82 | goto out; | ||
83 | } | ||
75 | 84 | ||
76 | /* if the incoming packet is sent via this one | 85 | /* if the incoming packet is sent via this one |
77 | * interface only - we still can aggregate */ | 86 | * interface only - we still can aggregate */ |
@@ -84,11 +93,16 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet, | |||
84 | * (= secondary interface packets in general) */ | 93 | * (= secondary interface packets in general) */ |
85 | (batman_packet->flags & DIRECTLINK || | 94 | (batman_packet->flags & DIRECTLINK || |
86 | (forw_packet->own && | 95 | (forw_packet->own && |
87 | forw_packet->if_incoming->if_num != 0))) | 96 | forw_packet->if_incoming != primary_if))) { |
88 | return true; | 97 | res = true; |
98 | goto out; | ||
99 | } | ||
89 | } | 100 | } |
90 | 101 | ||
91 | return false; | 102 | out: |
103 | if (primary_if) | ||
104 | hardif_free_ref(primary_if); | ||
105 | return res; | ||
92 | } | 106 | } |
93 | 107 | ||
94 | /* create a new aggregated packet and add this packet to it */ | 108 | /* create a new aggregated packet and add this packet to it */ |
@@ -210,6 +224,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, | |||
210 | hlist_for_each_entry(forw_packet_pos, tmp_node, | 224 | hlist_for_each_entry(forw_packet_pos, tmp_node, |
211 | &bat_priv->forw_bat_list, list) { | 225 | &bat_priv->forw_bat_list, list) { |
212 | if (can_aggregate_with(batman_packet, | 226 | if (can_aggregate_with(batman_packet, |
227 | bat_priv, | ||
213 | packet_len, | 228 | packet_len, |
214 | send_time, | 229 | send_time, |
215 | direct_link, | 230 | direct_link, |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 8b25b52a4764..056180ef9e1a 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -487,10 +487,9 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset) | |||
487 | } | 487 | } |
488 | 488 | ||
489 | seq_printf(seq, " %-12s (%s/%i) %17s [%10s]: gw_class ... " | 489 | seq_printf(seq, " %-12s (%s/%i) %17s [%10s]: gw_class ... " |
490 | "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%pM (%s)]\n", | 490 | "[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n", |
491 | "Gateway", "#", TQ_MAX_VALUE, "Nexthop", | 491 | "Gateway", "#", TQ_MAX_VALUE, "Nexthop", |
492 | "outgoingIF", SOURCE_VERSION, REVISION_VERSION_STR, | 492 | "outgoingIF", SOURCE_VERSION, primary_if->net_dev->name, |
493 | primary_if->net_dev->name, | ||
494 | primary_if->net_dev->dev_addr, net_dev->name); | 493 | primary_if->net_dev->dev_addr, net_dev->name); |
495 | 494 | ||
496 | rcu_read_lock(); | 495 | rcu_read_lock(); |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index e367e690a9f6..b0f9068ade57 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -58,9 +58,8 @@ static int __init batman_init(void) | |||
58 | 58 | ||
59 | register_netdevice_notifier(&hard_if_notifier); | 59 | register_netdevice_notifier(&hard_if_notifier); |
60 | 60 | ||
61 | pr_info("B.A.T.M.A.N. advanced %s%s (compatibility version %i) " | 61 | pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) " |
62 | "loaded\n", SOURCE_VERSION, REVISION_VERSION_STR, | 62 | "loaded\n", SOURCE_VERSION, COMPAT_VERSION); |
63 | COMPAT_VERSION); | ||
64 | 63 | ||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
@@ -184,8 +183,4 @@ MODULE_LICENSE("GPL"); | |||
184 | MODULE_AUTHOR(DRIVER_AUTHOR); | 183 | MODULE_AUTHOR(DRIVER_AUTHOR); |
185 | MODULE_DESCRIPTION(DRIVER_DESC); | 184 | MODULE_DESCRIPTION(DRIVER_DESC); |
186 | MODULE_SUPPORTED_DEVICE(DRIVER_DEVICE); | 185 | MODULE_SUPPORTED_DEVICE(DRIVER_DEVICE); |
187 | #ifdef REVISION_VERSION | ||
188 | MODULE_VERSION(SOURCE_VERSION "-" REVISION_VERSION); | ||
189 | #else | ||
190 | MODULE_VERSION(SOURCE_VERSION); | 186 | MODULE_VERSION(SOURCE_VERSION); |
191 | #endif | ||
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 4f293b594475..a6df61a6933b 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #define DRIVER_DESC "B.A.T.M.A.N. advanced" | 27 | #define DRIVER_DESC "B.A.T.M.A.N. advanced" |
28 | #define DRIVER_DEVICE "batman-adv" | 28 | #define DRIVER_DEVICE "batman-adv" |
29 | 29 | ||
30 | #define SOURCE_VERSION "next" | 30 | #ifndef SOURCE_VERSION |
31 | 31 | #define SOURCE_VERSION "2011.3.0" | |
32 | #endif | ||
32 | 33 | ||
33 | /* B.A.T.M.A.N. parameters */ | 34 | /* B.A.T.M.A.N. parameters */ |
34 | 35 | ||
@@ -144,12 +145,6 @@ enum dbg_level { | |||
144 | #include <linux/seq_file.h> | 145 | #include <linux/seq_file.h> |
145 | #include "types.h" | 146 | #include "types.h" |
146 | 147 | ||
147 | #ifndef REVISION_VERSION | ||
148 | #define REVISION_VERSION_STR "" | ||
149 | #else | ||
150 | #define REVISION_VERSION_STR " "REVISION_VERSION | ||
151 | #endif | ||
152 | |||
153 | extern struct list_head hardif_list; | 148 | extern struct list_head hardif_list; |
154 | 149 | ||
155 | extern unsigned char broadcast_addr[]; | 150 | extern unsigned char broadcast_addr[]; |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 338b3c597e4a..4cc94d4ba890 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -430,9 +430,8 @@ int orig_seq_print_text(struct seq_file *seq, void *offset) | |||
430 | goto out; | 430 | goto out; |
431 | } | 431 | } |
432 | 432 | ||
433 | seq_printf(seq, "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%pM (%s)]\n", | 433 | seq_printf(seq, "[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n", |
434 | SOURCE_VERSION, REVISION_VERSION_STR, | 434 | SOURCE_VERSION, primary_if->net_dev->name, |
435 | primary_if->net_dev->name, | ||
436 | primary_if->net_dev->dev_addr, net_dev->name); | 435 | primary_if->net_dev->dev_addr, net_dev->name); |
437 | seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", | 436 | seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", |
438 | "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop", | 437 | "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop", |
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index c5f081dfc6d1..590e4a66089f 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h | |||
@@ -78,10 +78,13 @@ enum tt_query_flags { | |||
78 | TT_FULL_TABLE = 1 << 2 | 78 | TT_FULL_TABLE = 1 << 2 |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /* TT_CHANGE flags */ | 81 | /* TT_CLIENT flags. |
82 | enum tt_change_flags { | 82 | * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to |
83 | TT_CHANGE_DEL = 0x01, | 83 | * 1 << 15 are used for local computation only */ |
84 | TT_CLIENT_ROAM = 0x02 | 84 | enum tt_client_flags { |
85 | TT_CLIENT_DEL = 1 << 0, | ||
86 | TT_CLIENT_ROAM = 1 << 1, | ||
87 | TT_CLIENT_NOPURGE = 1 << 8 | ||
85 | }; | 88 | }; |
86 | 89 | ||
87 | struct batman_packet { | 90 | struct batman_packet { |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 0ce090c9fe86..2cb98bed1586 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -1677,7 +1677,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | |||
1677 | spin_unlock_bh(&orig_node->bcast_seqno_lock); | 1677 | spin_unlock_bh(&orig_node->bcast_seqno_lock); |
1678 | 1678 | ||
1679 | /* rebroadcast packet */ | 1679 | /* rebroadcast packet */ |
1680 | add_bcast_packet_to_list(bat_priv, skb); | 1680 | add_bcast_packet_to_list(bat_priv, skb, 1); |
1681 | 1681 | ||
1682 | /* broadcast for me */ | 1682 | /* broadcast for me */ |
1683 | interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size); | 1683 | interface_rx(recv_if->soft_iface, skb, recv_if, hdr_size); |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 7a2f0823f1c2..4b8e11bc14fa 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet) | |||
163 | struct hard_iface *hard_iface; | 163 | struct hard_iface *hard_iface; |
164 | struct net_device *soft_iface; | 164 | struct net_device *soft_iface; |
165 | struct bat_priv *bat_priv; | 165 | struct bat_priv *bat_priv; |
166 | struct hard_iface *primary_if = NULL; | ||
166 | struct batman_packet *batman_packet = | 167 | struct batman_packet *batman_packet = |
167 | (struct batman_packet *)(forw_packet->skb->data); | 168 | (struct batman_packet *)(forw_packet->skb->data); |
168 | int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); | 169 | int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); |
@@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet) | |||
170 | if (!forw_packet->if_incoming) { | 171 | if (!forw_packet->if_incoming) { |
171 | pr_err("Error - can't forward packet: incoming iface not " | 172 | pr_err("Error - can't forward packet: incoming iface not " |
172 | "specified\n"); | 173 | "specified\n"); |
173 | return; | 174 | goto out; |
174 | } | 175 | } |
175 | 176 | ||
176 | soft_iface = forw_packet->if_incoming->soft_iface; | 177 | soft_iface = forw_packet->if_incoming->soft_iface; |
177 | bat_priv = netdev_priv(soft_iface); | 178 | bat_priv = netdev_priv(soft_iface); |
178 | 179 | ||
179 | if (forw_packet->if_incoming->if_status != IF_ACTIVE) | 180 | if (forw_packet->if_incoming->if_status != IF_ACTIVE) |
180 | return; | 181 | goto out; |
182 | |||
183 | primary_if = primary_if_get_selected(bat_priv); | ||
184 | if (!primary_if) | ||
185 | goto out; | ||
181 | 186 | ||
182 | /* multihomed peer assumed */ | 187 | /* multihomed peer assumed */ |
183 | /* non-primary OGMs are only broadcasted on their interface */ | 188 | /* non-primary OGMs are only broadcasted on their interface */ |
184 | if ((directlink && (batman_packet->ttl == 1)) || | 189 | if ((directlink && (batman_packet->ttl == 1)) || |
185 | (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { | 190 | (forw_packet->own && (forw_packet->if_incoming != primary_if))) { |
186 | 191 | ||
187 | /* FIXME: what about aggregated packets ? */ | 192 | /* FIXME: what about aggregated packets ? */ |
188 | bat_dbg(DBG_BATMAN, bat_priv, | 193 | bat_dbg(DBG_BATMAN, bat_priv, |
@@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) | |||
199 | broadcast_addr); | 204 | broadcast_addr); |
200 | forw_packet->skb = NULL; | 205 | forw_packet->skb = NULL; |
201 | 206 | ||
202 | return; | 207 | goto out; |
203 | } | 208 | } |
204 | 209 | ||
205 | /* broadcast on every interface */ | 210 | /* broadcast on every interface */ |
@@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet) | |||
211 | send_packet_to_if(forw_packet, hard_iface); | 216 | send_packet_to_if(forw_packet, hard_iface); |
212 | } | 217 | } |
213 | rcu_read_unlock(); | 218 | rcu_read_unlock(); |
219 | |||
220 | out: | ||
221 | if (primary_if) | ||
222 | hardif_free_ref(primary_if); | ||
214 | } | 223 | } |
215 | 224 | ||
216 | static void realloc_packet_buffer(struct hard_iface *hard_iface, | 225 | static void realloc_packet_buffer(struct hard_iface *hard_iface, |
@@ -455,7 +464,7 @@ static void _add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
455 | * The skb is not consumed, so the caller should make sure that the | 464 | * The skb is not consumed, so the caller should make sure that the |
456 | * skb is freed. */ | 465 | * skb is freed. */ |
457 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, | 466 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, |
458 | const struct sk_buff *skb) | 467 | const struct sk_buff *skb, unsigned long delay) |
459 | { | 468 | { |
460 | struct hard_iface *primary_if = NULL; | 469 | struct hard_iface *primary_if = NULL; |
461 | struct forw_packet *forw_packet; | 470 | struct forw_packet *forw_packet; |
@@ -492,7 +501,7 @@ int add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
492 | /* how often did we send the bcast packet ? */ | 501 | /* how often did we send the bcast packet ? */ |
493 | forw_packet->num_packets = 0; | 502 | forw_packet->num_packets = 0; |
494 | 503 | ||
495 | _add_bcast_packet_to_list(bat_priv, forw_packet, 1); | 504 | _add_bcast_packet_to_list(bat_priv, forw_packet, delay); |
496 | return NETDEV_TX_OK; | 505 | return NETDEV_TX_OK; |
497 | 506 | ||
498 | packet_free: | 507 | packet_free: |
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h index 633224ab028a..1f2d1e877663 100644 --- a/net/batman-adv/send.h +++ b/net/batman-adv/send.h | |||
@@ -31,7 +31,7 @@ void schedule_forward_packet(struct orig_node *orig_node, | |||
31 | int directlink, | 31 | int directlink, |
32 | struct hard_iface *if_outgoing); | 32 | struct hard_iface *if_outgoing); |
33 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, | 33 | int add_bcast_packet_to_list(struct bat_priv *bat_priv, |
34 | const struct sk_buff *skb); | 34 | const struct sk_buff *skb, unsigned long delay); |
35 | void send_outstanding_bat_packet(struct work_struct *work); | 35 | void send_outstanding_bat_packet(struct work_struct *work); |
36 | void purge_outstanding_packets(struct bat_priv *bat_priv, | 36 | void purge_outstanding_packets(struct bat_priv *bat_priv, |
37 | const struct hard_iface *hard_iface); | 37 | const struct hard_iface *hard_iface); |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 2dcdbb7a236c..3f20332e1d38 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -634,7 +634,7 @@ static int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
634 | bcast_packet->seqno = | 634 | bcast_packet->seqno = |
635 | htonl(atomic_inc_return(&bat_priv->bcast_seqno)); | 635 | htonl(atomic_inc_return(&bat_priv->bcast_seqno)); |
636 | 636 | ||
637 | add_bcast_packet_to_list(bat_priv, skb); | 637 | add_bcast_packet_to_list(bat_priv, skb, 1); |
638 | 638 | ||
639 | /* a copy is stored in the bcast list, therefore removing | 639 | /* a copy is stored in the bcast list, therefore removing |
640 | * the original skb. */ | 640 | * the original skb. */ |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 5f1fcd573633..06d361d4ac4b 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) | |||
143 | kfree_rcu(tt_global_entry, rcu); | 143 | kfree_rcu(tt_global_entry, rcu); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, | 146 | static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr, |
147 | const uint8_t *addr, bool roaming) | 147 | uint8_t flags) |
148 | { | 148 | { |
149 | struct tt_change_node *tt_change_node; | 149 | struct tt_change_node *tt_change_node; |
150 | 150 | ||
@@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, | |||
153 | if (!tt_change_node) | 153 | if (!tt_change_node) |
154 | return; | 154 | return; |
155 | 155 | ||
156 | tt_change_node->change.flags = op; | 156 | tt_change_node->change.flags = flags; |
157 | if (roaming) | ||
158 | tt_change_node->change.flags |= TT_CLIENT_ROAM; | ||
159 | |||
160 | memcpy(tt_change_node->change.addr, addr, ETH_ALEN); | 157 | memcpy(tt_change_node->change.addr, addr, ETH_ALEN); |
161 | 158 | ||
162 | spin_lock_bh(&bat_priv->tt_changes_list_lock); | 159 | spin_lock_bh(&bat_priv->tt_changes_list_lock); |
@@ -203,21 +200,20 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) | |||
203 | if (!tt_local_entry) | 200 | if (!tt_local_entry) |
204 | goto out; | 201 | goto out; |
205 | 202 | ||
206 | tt_local_event(bat_priv, NO_FLAGS, addr, false); | ||
207 | |||
208 | bat_dbg(DBG_TT, bat_priv, | 203 | bat_dbg(DBG_TT, bat_priv, |
209 | "Creating new local tt entry: %pM (ttvn: %d)\n", addr, | 204 | "Creating new local tt entry: %pM (ttvn: %d)\n", addr, |
210 | (uint8_t)atomic_read(&bat_priv->ttvn)); | 205 | (uint8_t)atomic_read(&bat_priv->ttvn)); |
211 | 206 | ||
212 | memcpy(tt_local_entry->addr, addr, ETH_ALEN); | 207 | memcpy(tt_local_entry->addr, addr, ETH_ALEN); |
213 | tt_local_entry->last_seen = jiffies; | 208 | tt_local_entry->last_seen = jiffies; |
209 | tt_local_entry->flags = NO_FLAGS; | ||
214 | atomic_set(&tt_local_entry->refcount, 2); | 210 | atomic_set(&tt_local_entry->refcount, 2); |
215 | 211 | ||
216 | /* the batman interface mac address should never be purged */ | 212 | /* the batman interface mac address should never be purged */ |
217 | if (compare_eth(addr, soft_iface->dev_addr)) | 213 | if (compare_eth(addr, soft_iface->dev_addr)) |
218 | tt_local_entry->never_purge = 1; | 214 | tt_local_entry->flags |= TT_CLIENT_NOPURGE; |
219 | else | 215 | |
220 | tt_local_entry->never_purge = 0; | 216 | tt_local_event(bat_priv, addr, tt_local_entry->flags); |
221 | 217 | ||
222 | hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig, | 218 | hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig, |
223 | tt_local_entry, &tt_local_entry->hash_entry); | 219 | tt_local_entry, &tt_local_entry->hash_entry); |
@@ -387,7 +383,9 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, | |||
387 | if (!tt_local_entry) | 383 | if (!tt_local_entry) |
388 | goto out; | 384 | goto out; |
389 | 385 | ||
390 | tt_local_event(bat_priv, TT_CHANGE_DEL, tt_local_entry->addr, roaming); | 386 | tt_local_event(bat_priv, tt_local_entry->addr, |
387 | tt_local_entry->flags | TT_CLIENT_DEL | | ||
388 | (roaming ? TT_CLIENT_ROAM : NO_FLAGS)); | ||
391 | tt_local_del(bat_priv, tt_local_entry, message); | 389 | tt_local_del(bat_priv, tt_local_entry, message); |
392 | out: | 390 | out: |
393 | if (tt_local_entry) | 391 | if (tt_local_entry) |
@@ -410,15 +408,15 @@ static void tt_local_purge(struct bat_priv *bat_priv) | |||
410 | spin_lock_bh(list_lock); | 408 | spin_lock_bh(list_lock); |
411 | hlist_for_each_entry_safe(tt_local_entry, node, node_tmp, | 409 | hlist_for_each_entry_safe(tt_local_entry, node, node_tmp, |
412 | head, hash_entry) { | 410 | head, hash_entry) { |
413 | if (tt_local_entry->never_purge) | 411 | if (tt_local_entry->flags & TT_CLIENT_NOPURGE) |
414 | continue; | 412 | continue; |
415 | 413 | ||
416 | if (!is_out_of_time(tt_local_entry->last_seen, | 414 | if (!is_out_of_time(tt_local_entry->last_seen, |
417 | TT_LOCAL_TIMEOUT * 1000)) | 415 | TT_LOCAL_TIMEOUT * 1000)) |
418 | continue; | 416 | continue; |
419 | 417 | ||
420 | tt_local_event(bat_priv, TT_CHANGE_DEL, | 418 | tt_local_event(bat_priv, tt_local_entry->addr, |
421 | tt_local_entry->addr, false); | 419 | tt_local_entry->flags | TT_CLIENT_DEL); |
422 | atomic_dec(&bat_priv->num_local_tt); | 420 | atomic_dec(&bat_priv->num_local_tt); |
423 | bat_dbg(DBG_TT, bat_priv, "Deleting local " | 421 | bat_dbg(DBG_TT, bat_priv, "Deleting local " |
424 | "tt entry (%pM): timed out\n", | 422 | "tt entry (%pM): timed out\n", |
@@ -1335,7 +1333,7 @@ static void _tt_update_changes(struct bat_priv *bat_priv, | |||
1335 | int i; | 1333 | int i; |
1336 | 1334 | ||
1337 | for (i = 0; i < tt_num_changes; i++) { | 1335 | for (i = 0; i < tt_num_changes; i++) { |
1338 | if ((tt_change + i)->flags & TT_CHANGE_DEL) | 1336 | if ((tt_change + i)->flags & TT_CLIENT_DEL) |
1339 | tt_global_del(bat_priv, orig_node, | 1337 | tt_global_del(bat_priv, orig_node, |
1340 | (tt_change + i)->addr, | 1338 | (tt_change + i)->addr, |
1341 | "tt removed by changes", | 1339 | "tt removed by changes", |
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 1cd2d39529fe..460e5839cdd6 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -30,8 +30,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr); | |||
30 | void tt_local_remove(struct bat_priv *bat_priv, | 30 | void tt_local_remove(struct bat_priv *bat_priv, |
31 | const uint8_t *addr, const char *message, bool roaming); | 31 | const uint8_t *addr, const char *message, bool roaming); |
32 | int tt_local_seq_print_text(struct seq_file *seq, void *offset); | 32 | int tt_local_seq_print_text(struct seq_file *seq, void *offset); |
33 | void tt_global_add_orig(struct bat_priv *bat_priv, | 33 | void tt_global_add_orig(struct bat_priv *bat_priv, struct orig_node *orig_node, |
34 | struct orig_node *orig_node, | ||
35 | const unsigned char *tt_buff, int tt_buff_len); | 34 | const unsigned char *tt_buff, int tt_buff_len); |
36 | int tt_global_add(struct bat_priv *bat_priv, | 35 | int tt_global_add(struct bat_priv *bat_priv, |
37 | struct orig_node *orig_node, const unsigned char *addr, | 36 | struct orig_node *orig_node, const unsigned char *addr, |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 85cf1224881e..25bd1db35370 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -224,7 +224,7 @@ struct socket_packet { | |||
224 | struct tt_local_entry { | 224 | struct tt_local_entry { |
225 | uint8_t addr[ETH_ALEN]; | 225 | uint8_t addr[ETH_ALEN]; |
226 | unsigned long last_seen; | 226 | unsigned long last_seen; |
227 | char never_purge; | 227 | uint16_t flags; |
228 | atomic_t refcount; | 228 | atomic_t refcount; |
229 | struct rcu_head rcu; | 229 | struct rcu_head rcu; |
230 | struct hlist_node hash_entry; | 230 | struct hlist_node hash_entry; |
@@ -234,7 +234,7 @@ struct tt_global_entry { | |||
234 | uint8_t addr[ETH_ALEN]; | 234 | uint8_t addr[ETH_ALEN]; |
235 | struct orig_node *orig_node; | 235 | struct orig_node *orig_node; |
236 | uint8_t ttvn; | 236 | uint8_t ttvn; |
237 | uint8_t flags; /* only TT_GLOBAL_ROAM is used */ | 237 | uint16_t flags; /* only TT_GLOBAL_ROAM is used */ |
238 | unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ | 238 | unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */ |
239 | atomic_t refcount; | 239 | atomic_t refcount; |
240 | struct rcu_head rcu; | 240 | struct rcu_head rcu; |