mm-netlink: only change IFF_UP flag

This fixes the missing NOARP flag on the second and following VLAN
sub-interfaces when multiplexing over the cdc_mbim driver.

ifi_change specifies all the flags we want to change. Any listed
flag which isn't set in ifi_flags will be cleared by the kernel:

        if (ifm->ifi_change)
                flags = (flags & ifm->ifi_change) |
                        (rtnl_dev_get_flags(dev) & ~ifm->ifi_change);

Drivers like cdc_mbim set some netdev flags by default, indicating
supported or unsupported features. The driver emulates an ethernet
netdev but it doesn't implement ARP.  Clearing NOARP on cdc_mbim
netdevs will block IP transmissions, waiting for an ARP reply we
never will receive.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
This commit is contained in:
Bjørn Mork
2022-03-28 11:57:42 +02:00
parent b5a0a50040
commit 7bbf6c8a4a

View File

@@ -136,8 +136,6 @@ netlink_message_new (guint ifindex,
hdr->msghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
hdr->ifreq.ifi_family = AF_UNSPEC;
hdr->ifreq.ifi_index = ifindex;
hdr->ifreq.ifi_flags = 0;
hdr->ifreq.ifi_change = 0xFFFFFFFF;
return msg;
}
@@ -154,7 +152,7 @@ netlink_message_new_setlink (guint ifindex,
hdr = netlink_message_header (msg);
hdr->ifreq.ifi_flags = up ? IFF_UP : 0;
hdr->ifreq.ifi_change = 0xFFFFFFFF;
hdr->ifreq.ifi_change = IFF_UP;
if (mtu)
append_netlink_attribute_uint32 (msg, IFLA_MTU, mtu);