On Wed, 28 Sep 2022 11:22:11 +0800 Hangbin Liu wrote:
Hi Jakub,
On Tue, Sep 27, 2022 at 12:13:03PM +0800, Hangbin Liu wrote:
quoted
@@ -3009,6 +3012,11 @@ static int do_setlink(const struct sk_buff *skb,
}
}
+ nskb = rtmsg_ifinfo_build_skb(RTM_NEWLINK, dev, 0, 0, GFP_KERNEL, NULL,
+ 0, pid, nlh->nlmsg_seq);
+ if (nskb)
+ rtnl_notify(nskb, dev_net(dev), pid, RTNLGRP_LINK, nlh, GFP_KERNEL);
BTW, in do_setlink() I planed to use RTM_SETLINK. But I found iproute2 use
RTM_NEWLINK to set links. And I saw an old doc[1] said
"""
- RTM_SETLINK does not follow the usual rtnetlink conventions and ignores
all netlink flags
The RTM_NEWLINK message type is a superset of RTM_SETLINK, it allows
to change both driver specific and generic attributes of the device.
"""
Interesting, so we actually do use this "NEW as SET" thing.
So I just use RTM_NEWLINK for the notification. Do you think if we should
use RTM_SETLINK?
FWIW I think it's typical for rtnl / classic netlink to generate
"new object" notification whenever object is changed, rather than
a notification about just the change.