Skip to content

Commit f097e25

Browse files
hundebollordex
authored andcommitted
batman-adv: Remove old fragmentation code
Remove the existing fragmentation code before adding the new version and delete unicast.{h,c}. batadv_unicast_send_skb() is moved to send.c and renamed to batadv_send_skb_unicast(). fragmentation entry in sysfs (bat_priv->fragmentation) is kept for use in the new fragmentation code. BATADV_UNICAST_FRAG packet type is renamed to BATADV_FRAG for use in the new fragmentation code. Signed-off-by: Martin Hundebøll <[email protected]> Signed-off-by: Marek Lindner <[email protected]> Signed-off-by: Antonio Quartulli <[email protected]>
1 parent 2c59866 commit f097e25

File tree

14 files changed

+221
-729
lines changed

14 files changed

+221
-729
lines changed

net/batman-adv/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ batman-adv-y += send.o
3737
batman-adv-y += soft-interface.o
3838
batman-adv-y += sysfs.o
3939
batman-adv-y += translation-table.o
40-
batman-adv-y += unicast.o

net/batman-adv/distributed-arp-table.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "send.h"
3030
#include "types.h"
3131
#include "translation-table.h"
32-
#include "unicast.h"
3332

3433
static void batadv_dat_purge(struct work_struct *work);
3534

@@ -592,9 +591,9 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
592591
goto free_orig;
593592

594593
tmp_skb = pskb_copy(skb, GFP_ATOMIC);
595-
if (!batadv_unicast_4addr_prepare_skb(bat_priv, tmp_skb,
596-
cand[i].orig_node,
597-
packet_subtype)) {
594+
if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, tmp_skb,
595+
cand[i].orig_node,
596+
packet_subtype)) {
598597
kfree_skb(tmp_skb);
599598
goto free_neigh;
600599
}
@@ -990,10 +989,10 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
990989
* that a node not using the 4addr packet format doesn't support it.
991990
*/
992991
if (hdr_size == sizeof(struct batadv_unicast_4addr_packet))
993-
err = batadv_unicast_4addr_send_skb(bat_priv, skb_new,
992+
err = batadv_send_skb_unicast_4addr(bat_priv, skb_new,
994993
BATADV_P_DAT_CACHE_REPLY);
995994
else
996-
err = batadv_unicast_send_skb(bat_priv, skb_new);
995+
err = batadv_send_skb_unicast(bat_priv, skb_new);
997996

998997
if (!err) {
999998
batadv_inc_counter(bat_priv, BATADV_CNT_DAT_CACHED_REPLY_TX);

net/batman-adv/hard-interface.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
444444
hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
445445
dev_add_pack(&hard_iface->batman_adv_ptype);
446446

447-
atomic_set(&hard_iface->frag_seqno, 1);
448447
batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
449448
hard_iface->net_dev->name);
450449

net/batman-adv/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "gateway_client.h"
3737
#include "bridge_loop_avoidance.h"
3838
#include "distributed-arp-table.h"
39-
#include "unicast.h"
4039
#include "gateway_common.h"
4140
#include "hash.h"
4241
#include "bat_algo.h"
@@ -399,7 +398,6 @@ static void batadv_recv_handler_init(void)
399398
/* compile time checks for struct member offsets */
400399
BUILD_BUG_ON(offsetof(struct batadv_unicast_4addr_packet, src) != 10);
401400
BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
402-
BUILD_BUG_ON(offsetof(struct batadv_unicast_frag_packet, dest) != 4);
403401
BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
404402
BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
405403
BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
@@ -412,8 +410,6 @@ static void batadv_recv_handler_init(void)
412410
batadv_rx_handler[BATADV_UNICAST_4ADDR] = batadv_recv_unicast_packet;
413411
/* unicast packet */
414412
batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet;
415-
/* fragmented unicast packet */
416-
batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
417413
/* unicast tvlv packet */
418414
batadv_rx_handler[BATADV_UNICAST_TVLV] = batadv_recv_unicast_tvlv;
419415
/* batman icmp packet */

net/batman-adv/originator.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "routing.h"
2626
#include "gateway_client.h"
2727
#include "hard-interface.h"
28-
#include "unicast.h"
2928
#include "soft-interface.h"
3029
#include "bridge_loop_avoidance.h"
3130
#include "network-coding.h"
@@ -146,7 +145,6 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
146145
/* Free nc_nodes */
147146
batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL);
148147

149-
batadv_frag_list_free(&orig_node->frag_list);
150148
batadv_tt_global_del_orig(orig_node->bat_priv, orig_node,
151149
"originator timed out");
152150

@@ -269,9 +267,6 @@ struct batadv_orig_node *batadv_get_orig_node(struct batadv_priv *bat_priv,
269267
size = bat_priv->num_ifaces * sizeof(uint8_t);
270268
orig_node->bcast_own_sum = kzalloc(size, GFP_ATOMIC);
271269

272-
INIT_LIST_HEAD(&orig_node->frag_list);
273-
orig_node->last_frag_packet = 0;
274-
275270
if (!orig_node->bcast_own_sum)
276271
goto free_bcast_own;
277272

@@ -393,10 +388,6 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv)
393388
batadv_orig_node_free_ref(orig_node);
394389
continue;
395390
}
396-
397-
if (batadv_has_timed_out(orig_node->last_frag_packet,
398-
BATADV_FRAG_TIMEOUT))
399-
batadv_frag_list_free(&orig_node->frag_list);
400391
}
401392
spin_unlock_bh(list_lock);
402393
}

net/batman-adv/packet.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ enum batadv_icmp_packettype {
9191
BATADV_PARAMETER_PROBLEM = 12,
9292
};
9393

94-
/* fragmentation defines */
95-
enum batadv_unicast_frag_flags {
96-
BATADV_UNI_FRAG_HEAD = BIT(0),
97-
BATADV_UNI_FRAG_LARGETAIL = BIT(1),
98-
};
99-
10094
/* tt data subtypes */
10195
#define BATADV_TT_DATA_TYPE_MASK 0x0F
10296

@@ -255,16 +249,6 @@ struct batadv_unicast_4addr_packet {
255249
*/
256250
};
257251

258-
struct batadv_unicast_frag_packet {
259-
struct batadv_header header;
260-
uint8_t ttvn; /* destination translation table version number */
261-
uint8_t dest[ETH_ALEN];
262-
uint8_t flags;
263-
uint8_t align;
264-
uint8_t orig[ETH_ALEN];
265-
__be16 seqno;
266-
} __packed;
267-
268252
struct batadv_bcast_packet {
269253
struct batadv_header header;
270254
uint8_t reserved;

net/batman-adv/routing.c

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "icmp_socket.h"
2626
#include "translation-table.h"
2727
#include "originator.h"
28-
#include "unicast.h"
2928
#include "bridge_loop_avoidance.h"
3029
#include "distributed-arp-table.h"
3130
#include "network-coding.h"
@@ -653,11 +652,9 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
653652
{
654653
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
655654
struct batadv_orig_node *orig_node = NULL;
656-
struct batadv_neigh_node *neigh_node = NULL;
657655
struct batadv_unicast_packet *unicast_packet;
658656
struct ethhdr *ethhdr = eth_hdr(skb);
659657
int res, hdr_len, ret = NET_RX_DROP;
660-
struct sk_buff *new_skb;
661658

662659
unicast_packet = (struct batadv_unicast_packet *)skb->data;
663660

@@ -674,46 +671,12 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
674671
if (!orig_node)
675672
goto out;
676673

677-
/* find_router() increases neigh_nodes refcount if found. */
678-
neigh_node = batadv_find_router(bat_priv, orig_node, recv_if);
679-
680-
if (!neigh_node)
681-
goto out;
682-
683674
/* create a copy of the skb, if needed, to modify it. */
684675
if (skb_cow(skb, ETH_HLEN) < 0)
685676
goto out;
686677

687-
unicast_packet = (struct batadv_unicast_packet *)skb->data;
688-
689-
if (unicast_packet->header.packet_type == BATADV_UNICAST &&
690-
atomic_read(&bat_priv->fragmentation) &&
691-
skb->len > neigh_node->if_incoming->net_dev->mtu) {
692-
ret = batadv_frag_send_skb(skb, bat_priv,
693-
neigh_node->if_incoming,
694-
neigh_node->addr);
695-
goto out;
696-
}
697-
698-
if (unicast_packet->header.packet_type == BATADV_UNICAST_FRAG &&
699-
batadv_frag_can_reassemble(skb,
700-
neigh_node->if_incoming->net_dev->mtu)) {
701-
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
702-
703-
if (ret == NET_RX_DROP)
704-
goto out;
705-
706-
/* packet was buffered for late merge */
707-
if (!new_skb) {
708-
ret = NET_RX_SUCCESS;
709-
goto out;
710-
}
711-
712-
skb = new_skb;
713-
unicast_packet = (struct batadv_unicast_packet *)skb->data;
714-
}
715-
716678
/* decrement ttl */
679+
unicast_packet = (struct batadv_unicast_packet *)skb->data;
717680
unicast_packet->header.ttl--;
718681

719682
switch (unicast_packet->header.packet_type) {
@@ -748,8 +711,6 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
748711
}
749712

750713
out:
751-
if (neigh_node)
752-
batadv_neigh_node_free_ref(neigh_node);
753714
if (orig_node)
754715
batadv_orig_node_free_ref(orig_node);
755716
return ret;
@@ -1003,51 +964,6 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1003964
return batadv_route_unicast_packet(skb, recv_if);
1004965
}
1005966

1006-
int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1007-
struct batadv_hard_iface *recv_if)
1008-
{
1009-
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
1010-
struct batadv_unicast_frag_packet *unicast_packet;
1011-
int hdr_size = sizeof(*unicast_packet);
1012-
struct sk_buff *new_skb = NULL;
1013-
int ret;
1014-
1015-
if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1016-
return NET_RX_DROP;
1017-
1018-
if (!batadv_check_unicast_ttvn(bat_priv, skb, hdr_size))
1019-
return NET_RX_DROP;
1020-
1021-
unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
1022-
1023-
/* packet for me */
1024-
if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
1025-
ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
1026-
1027-
if (ret == NET_RX_DROP)
1028-
return NET_RX_DROP;
1029-
1030-
/* packet was buffered for late merge */
1031-
if (!new_skb)
1032-
return NET_RX_SUCCESS;
1033-
1034-
if (batadv_dat_snoop_incoming_arp_request(bat_priv, new_skb,
1035-
hdr_size))
1036-
goto rx_success;
1037-
if (batadv_dat_snoop_incoming_arp_reply(bat_priv, new_skb,
1038-
hdr_size))
1039-
goto rx_success;
1040-
1041-
batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
1042-
sizeof(struct batadv_unicast_packet), NULL);
1043-
1044-
rx_success:
1045-
return NET_RX_SUCCESS;
1046-
}
1047-
1048-
return batadv_route_unicast_packet(skb, recv_if);
1049-
}
1050-
1051967
/**
1052968
* batadv_recv_unicast_tvlv - receive and process unicast tvlv packets
1053969
* @skb: unicast tvlv packet to process

net/batman-adv/routing.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
3030
struct batadv_hard_iface *recv_if);
3131
int batadv_recv_unicast_packet(struct sk_buff *skb,
3232
struct batadv_hard_iface *recv_if);
33-
int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
34-
struct batadv_hard_iface *recv_if);
3533
int batadv_recv_bcast_packet(struct sk_buff *skb,
3634
struct batadv_hard_iface *recv_if);
3735
int batadv_recv_tt_query(struct sk_buff *skb,

0 commit comments

Comments
 (0)