Skip to content

Commit 39620a3

Browse files
committed
Merge tag 'batadv-next-pullrequest-20231115' of git://git.open-mesh.org/linux-merge
This feature/cleanup patchset includes the following patches: - bump version strings, by Simon Wunderlich - Implement new multicast packet type, including its transmission, forwarding and parsing, by Linus Lüssing (3 patches) - Switch to new headers for sprintf and array size, by Sven Eckelmann (2 patches) Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 72a813a + c3ed16a commit 39620a3

17 files changed

+1572
-32
lines changed

include/uapi/linux/batadv_packet.h

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,17 @@ enum batadv_icmp_packettype {
116116
* only need routable IPv4 multicast packets we signed up for explicitly
117117
* @BATADV_MCAST_WANT_NO_RTR6: we have no IPv6 multicast router and therefore
118118
* only need routable IPv6 multicast packets we signed up for explicitly
119+
* @BATADV_MCAST_HAVE_MC_PTYPE_CAPA: we can parse, receive and forward
120+
* batman-adv multicast packets with a multicast tracker TVLV. And all our
121+
* hard interfaces have an MTU of at least 1280 bytes.
119122
*/
120123
enum batadv_mcast_flags {
121124
BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
122125
BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
123126
BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
124127
BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
125128
BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
129+
BATADV_MCAST_HAVE_MC_PTYPE_CAPA = 1UL << 5,
126130
};
127131

128132
/* tt data subtypes */
@@ -174,14 +178,16 @@ enum batadv_bla_claimframe {
174178
* @BATADV_TVLV_TT: translation table tvlv
175179
* @BATADV_TVLV_ROAM: roaming advertisement tvlv
176180
* @BATADV_TVLV_MCAST: multicast capability tvlv
181+
* @BATADV_TVLV_MCAST_TRACKER: multicast tracker tvlv
177182
*/
178183
enum batadv_tvlv_type {
179-
BATADV_TVLV_GW = 0x01,
180-
BATADV_TVLV_DAT = 0x02,
181-
BATADV_TVLV_NC = 0x03,
182-
BATADV_TVLV_TT = 0x04,
183-
BATADV_TVLV_ROAM = 0x05,
184-
BATADV_TVLV_MCAST = 0x06,
184+
BATADV_TVLV_GW = 0x01,
185+
BATADV_TVLV_DAT = 0x02,
186+
BATADV_TVLV_NC = 0x03,
187+
BATADV_TVLV_TT = 0x04,
188+
BATADV_TVLV_ROAM = 0x05,
189+
BATADV_TVLV_MCAST = 0x06,
190+
BATADV_TVLV_MCAST_TRACKER = 0x07,
185191
};
186192

187193
#pragma pack(2)
@@ -487,6 +493,25 @@ struct batadv_bcast_packet {
487493
*/
488494
};
489495

496+
/**
497+
* struct batadv_mcast_packet - multicast packet for network payload
498+
* @packet_type: batman-adv packet type, part of the general header
499+
* @version: batman-adv protocol version, part of the general header
500+
* @ttl: time to live for this packet, part of the general header
501+
* @reserved: reserved byte for alignment
502+
* @tvlv_len: length of the appended tvlv buffer (in bytes)
503+
*/
504+
struct batadv_mcast_packet {
505+
__u8 packet_type;
506+
__u8 version;
507+
__u8 ttl;
508+
__u8 reserved;
509+
__be16 tvlv_len;
510+
/* "4 bytes boundary + 2 bytes" long to make the payload after the
511+
* following ethernet header again 4 bytes boundary aligned
512+
*/
513+
};
514+
490515
/**
491516
* struct batadv_coded_packet - network coded packet
492517
* @packet_type: batman-adv packet type, part of the general header
@@ -628,6 +653,14 @@ struct batadv_tvlv_mcast_data {
628653
__u8 reserved[3];
629654
};
630655

656+
/**
657+
* struct batadv_tvlv_mcast_tracker - payload of a multicast tracker tvlv
658+
* @num_dests: number of subsequent destination originator MAC addresses
659+
*/
660+
struct batadv_tvlv_mcast_tracker {
661+
__be16 num_dests;
662+
};
663+
631664
#pragma pack()
632665

633666
#endif /* _UAPI_LINUX_BATADV_PACKET_H_ */

net/batman-adv/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ batman-adv-y += hash.o
2020
batman-adv-$(CONFIG_BATMAN_ADV_DEBUG) += log.o
2121
batman-adv-y += main.o
2222
batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast.o
23+
batman-adv-$(CONFIG_BATMAN_ADV_MCAST) += multicast_forw.o
2324
batman-adv-y += netlink.o
2425
batman-adv-$(CONFIG_BATMAN_ADV_NC) += network-coding.o
2526
batman-adv-y += originator.o

net/batman-adv/bridge_loop_avoidance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/if_vlan.h>
2121
#include <linux/jhash.h>
2222
#include <linux/jiffies.h>
23-
#include <linux/kernel.h>
2423
#include <linux/kref.h>
2524
#include <linux/list.h>
2625
#include <linux/lockdep.h>
@@ -31,6 +30,7 @@
3130
#include <linux/skbuff.h>
3231
#include <linux/slab.h>
3332
#include <linux/spinlock.h>
33+
#include <linux/sprintf.h>
3434
#include <linux/stddef.h>
3535
#include <linux/string.h>
3636
#include <linux/workqueue.h>

net/batman-adv/fragmentation.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
#include "hard-interface.h"
2727
#include "originator.h"
28-
#include "routing.h"
2928
#include "send.h"
3029

3130
/**
@@ -351,18 +350,14 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
351350
struct batadv_orig_node *orig_node_src)
352351
{
353352
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
354-
struct batadv_orig_node *orig_node_dst;
355353
struct batadv_neigh_node *neigh_node = NULL;
356354
struct batadv_frag_packet *packet;
357355
u16 total_size;
358356
bool ret = false;
359357

360358
packet = (struct batadv_frag_packet *)skb->data;
361-
orig_node_dst = batadv_orig_hash_find(bat_priv, packet->dest);
362-
if (!orig_node_dst)
363-
goto out;
364359

365-
neigh_node = batadv_find_router(bat_priv, orig_node_dst, recv_if);
360+
neigh_node = batadv_orig_to_router(bat_priv, packet->dest, recv_if);
366361
if (!neigh_node)
367362
goto out;
368363

@@ -381,7 +376,6 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb,
381376
}
382377

383378
out:
384-
batadv_orig_node_put(orig_node_dst);
385379
batadv_neigh_node_put(neigh_node);
386380
return ret;
387381
}

net/batman-adv/gateway_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <linux/in.h>
1919
#include <linux/ip.h>
2020
#include <linux/ipv6.h>
21-
#include <linux/kernel.h>
2221
#include <linux/kref.h>
2322
#include <linux/list.h>
2423
#include <linux/lockdep.h>
@@ -29,6 +28,7 @@
2928
#include <linux/skbuff.h>
3029
#include <linux/slab.h>
3130
#include <linux/spinlock.h>
31+
#include <linux/sprintf.h>
3232
#include <linux/stddef.h>
3333
#include <linux/udp.h>
3434
#include <net/sock.h>

net/batman-adv/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "main.h"
88

9+
#include <linux/array_size.h>
910
#include <linux/atomic.h>
1011
#include <linux/build_bug.h>
1112
#include <linux/byteorder/generic.h>
@@ -20,7 +21,6 @@
2021
#include <linux/init.h>
2122
#include <linux/ip.h>
2223
#include <linux/ipv6.h>
23-
#include <linux/kernel.h>
2424
#include <linux/kobject.h>
2525
#include <linux/kref.h>
2626
#include <linux/list.h>
@@ -33,6 +33,7 @@
3333
#include <linux/skbuff.h>
3434
#include <linux/slab.h>
3535
#include <linux/spinlock.h>
36+
#include <linux/sprintf.h>
3637
#include <linux/stddef.h>
3738
#include <linux/string.h>
3839
#include <linux/workqueue.h>
@@ -532,6 +533,8 @@ static void batadv_recv_handler_init(void)
532533

533534
/* broadcast packet */
534535
batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
536+
/* multicast packet */
537+
batadv_rx_handler[BATADV_MCAST] = batadv_recv_mcast_packet;
535538

536539
/* unicast packets ... */
537540
/* unicast with 4 addresses packet */

net/batman-adv/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#define BATADV_DRIVER_DEVICE "batman-adv"
1414

1515
#ifndef BATADV_SOURCE_VERSION
16-
#define BATADV_SOURCE_VERSION "2023.3"
16+
#define BATADV_SOURCE_VERSION "2024.0"
1717
#endif
1818

1919
/* B.A.T.M.A.N. parameters */

0 commit comments

Comments
 (0)