diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-03-09 16:33:13 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-03-09 16:33:13 +0300 |
commit | 553b28fd340722154ad8aa92193e288328cee979 (patch) | |
tree | 034947cbbb209270af445318a74dcbecc224f4f5 /accel-pppd/ctrl/ipoe/ipoe_netlink.c | |
parent | 80eab99d6dc0cedfc97be191349a6dde3f326a5a (diff) | |
download | accel-ppp-553b28fd340722154ad8aa92193e288328cee979.tar.gz accel-ppp-553b28fd340722154ad8aa92193e288328cee979.zip |
ipoe: fixed bringing down non-shared interface
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe_netlink.c')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe_netlink.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe_netlink.c b/accel-pppd/ctrl/ipoe/ipoe_netlink.c index 18542cd..d69decb 100644 --- a/accel-pppd/ctrl/ipoe/ipoe_netlink.c +++ b/accel-pppd/ctrl/ipoe/ipoe_netlink.c @@ -204,6 +204,31 @@ void ipoe_nl_add_interface(int ifindex) log_error("ipoe: nl_add_iface: error talking to kernel\n"); } +void ipoe_nl_del_interface(int ifindex) +{ + struct nlmsghdr *nlh; + struct genlmsghdr *ghdr; + struct { + struct nlmsghdr n; + char buf[1024]; + } req; + + if (rth.fd == -1) + return; + + nlh = &req.n; + nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; + nlh->nlmsg_type = ipoe_genl_id; + + ghdr = NLMSG_DATA(&req.n); + ghdr->cmd = IPOE_CMD_DEL_IF; + + addattr32(nlh, 1024, IPOE_ATTR_IFINDEX, ifindex); + + if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) + log_error("ipoe: nl_del_iface: error talking to kernel\n"); +} int ipoe_nl_create(uint32_t peer_addr, uint32_t addr, const char *ifname, uint8_t *hwaddr) { |