On Tuesday, 27 December 2022 20:34:08 CET Linus Lüssing wrote:
Implement the preparation of a batman-adv multicast packet and use this under certain conditions.
For one thing this implements the capability to push a complete batman-adv multicast packet header, including a tracker TVLV with all originator destinations that have signaled interest in it, onto a given ethernet frame with an IP multicast packet inside.
For another checks are implemented to determine if encapsulating a multicast packet in this new batman-adv multicast packet type and using it is feasible. Those checks are:
- Have all nodes signaled that they are capable of handling the new batman-adv multicast packet type?
- Do all active hard interfaces of all nodes, including us, have an MTU of at least 1280 bytes?
- Does a complete multicast packet header with all its destination addresses fit onto the given multicast packet / ethernet frame and does not exceed 1280 bytes?
If all checks passed then the new batman-adv multicast packet type will be used for transmission and distribution. Otherwise we fall back to one or more batman-adv unicast packet transmissions, if possible. Or if not possible we will fall back to classic flooding through a batman-adv broadcast packet.
Signed-off-by: Linus Lüssing linus.luessing@c0d3.blue
net/batman-adv/multicast.c | 79 ++++- net/batman-adv/multicast.h | 25 +- net/batman-adv/multicast_forw.c | 513 ++++++++++++++++++++++++++++++++ net/batman-adv/soft-interface.c | 6 +- net/batman-adv/types.h | 6 + 5 files changed, 621 insertions(+), 8 deletions(-)
Acked-by: Sven Eckelmann sven@narfation.org
Btw. it is spelled "outer" and not "outter"
[...]
+/**
- batadv_mcast_forw_expand_head() - expand headroom for an mcast packet
- @bat_priv: the bat priv with all the soft interface information
- @skb: the multicast packet to send
- Tries to expand an skb's headroom so that its head to tail is 1298
- bytes (minimum IPv6 MTU + vlan ethernet header size) large.
- Return: -EINVAL if the given skb's length is too large or -ENOMEM on memory
- allocation failure. Otherwise, on success, zero is returned.
- */
+static int batadv_mcast_forw_expand_head(struct batadv_priv *bat_priv,
struct sk_buff *skb)
+{
- int hdr_size = VLAN_ETH_HLEN + IPV6_MIN_MTU - skb->len;
/* TODO: Could be tightened to actual number of destination nodes?
* But it's tricky, number of destinations might have increased since
* we last checked.
*/
But it might at least be a good start. So basically a "we can at least guarantee that there is enough room for what we've seen in our precheck"
And you could make sure that we still have enough headroom for our lower devices. Not that we steal from the headroom which they need - because your headroom is not part of the needed_headroom which we report. But of course, we don't know the outgoing device (yet) - so this makes it harder to figure out how large we need to allocate it.
Kind regards, Sven