[PATCH] Change rtnl_link_af_ops.ao_override_rtm behavior
Thomas Haller
thaller at redhat.com
Wed Nov 29 08:15:10 PST 2017
On Tue, 2017-11-28 at 13:10 -0800, jef.oliver at intel.com wrote:
> From: Jef Oliver <jef.oliver at intel.com>
>
> rtnl_link_af_ops.ao_override_rtm allows for a link module to
> override the change request type being sent to the kernel. More
> specifically, the default change request type is RTM_NEWLINK.
> Some link change requests require the reqeust type to be set to
> RTM_SETLINK. This is the case for IFLA_PROTINFO specific
> attributes for a link that is slave to a bridge.
>
> Currently, ao_override_rtm is static to the address family type.
> So, all changes submitted to AF_BRIDGE override the link change
> request type. The override only needs to happen if IFLA_PROTINFO
> attributes are appended to the link change request.
>
> This patch changes ao_override_rtm from a const integer to a
> function pointer that allows for a link module to determine if
> the override needs to actually happen.
>
> Currently, only the bridge module uses this functionality. If
> bridge flags are applied to a link (bdpu blocking, learning,
> fast leave, etc...), these flags are nested in IFLA_PROTINFO. If
> the flags are present, the link change request type will be
> overridden as RTM_SETLINK.
>
> This fixes the ability to set a bridge link up or down by using
> the correct RTM_NEWLINK link change request type.
>
> $ sudo src/nl-link-set -n br2 --state=down
> Changed bridge br2 ether a6:e6:94:8c:61:ec
> <broadcast,multicast,up,running,lowerup> group 0
>
> $ ip link show
> br2: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue
> state DOWN mode DEFAULT group default qlen 1000
>
> $ sudo src/nl-link-set -n br2 --state=up
> Changed bridge br2 ether a6:e6:94:8c:61:ec
> <broadcast,multicast> group 0
>
> $ ip link show
> br2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> state UNKNOWN mode DEFAULT group default qlen 1000
>
> Signed-off-by: Jef Oliver <jef.oliver at intel.com>
> ---
Hi Jef,
thanks for the fast fix!!
Patch lgtm. Merged as
https://github.com/thom311/libnl/commit/3c427d0f4fcca91a661d85d21cdea89d41271c6c
best,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20171129/4826b9f2/attachment.sig>
More information about the libnl
mailing list