diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-02-05 22:02:40 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-17 00:27:08 +0000 |
| commit | c3bd894e4d2395d2bc72b0d7a94984f04e93adb1 (patch) | |
| tree | 98d97da198271e7486ad4519328f7bb97f5fae16 /zebra/if_netlink.c | |
| parent | 999668407ea0f9492a93b226e0d06ab970c0ad82 (diff) | |
vrrpd: protodown macvlan in backup state
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra/if_netlink.c')
| -rw-r--r-- | zebra/if_netlink.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index ce0834f190..e7d988cd9f 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -1396,6 +1396,32 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) return 0; } +int netlink_protodown(struct interface *ifp, bool down) +{ + struct zebra_ns *zns = zebra_ns_lookup(NS_DEFAULT); + + struct { + struct nlmsghdr n; + struct ifinfomsg ifa; + char buf[NL_PKT_BUF_SIZE]; + } req; + + memset(&req, 0, sizeof req); + + req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); + req.n.nlmsg_flags = NLM_F_REQUEST; + req.n.nlmsg_type = RTM_SETLINK; + req.n.nlmsg_pid = zns->netlink_cmd.snl.nl_pid; + + req.ifa.ifi_index = ifp->ifindex; + + addattr_l(&req.n, sizeof req, IFLA_PROTO_DOWN, &down, 4); + addattr_l(&req.n, sizeof req, IFLA_LINK, &ifp->ifindex, 4); + + return netlink_talk(netlink_talk_filter, &req.n, &zns->netlink_cmd, zns, + 0); +} + /* Interface information read by netlink. */ void interface_list(struct zebra_ns *zns) { |
