summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-03-09 16:33:13 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-03-09 16:33:13 +0300
commit553b28fd340722154ad8aa92193e288328cee979 (patch)
tree034947cbbb209270af445318a74dcbecc224f4f5 /accel-pppd
parent80eab99d6dc0cedfc97be191349a6dde3f326a5a (diff)
downloadaccel-ppp-553b28fd340722154ad8aa92193e288328cee979.tar.gz
accel-ppp-553b28fd340722154ad8aa92193e288328cee979.zip
ipoe: fixed bringing down non-shared interface
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c6
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.h1
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe_netlink.c25
3 files changed, 32 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index a409879f..e7f1ca50 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1152,6 +1152,9 @@ static void ipoe_session_terminated(struct ipoe_session *ses)
if (ses->l4_redirect_set)
ipoe_change_l4_redirect(ses, 1);
+ if (!ses->serv->opt_shared)
+ ses->ctrl.dont_ifcfg = 1;
+
ap_session_finished(&ses->ses);
}
@@ -2123,6 +2126,9 @@ static void ipoe_serv_release(struct ipoe_serv *serv)
if (serv->timer.tpd)
triton_timer_del(&serv->timer);
+ if (serv->opt_up)
+ ipoe_nl_del_interface(serv->ifindex);
+
if (serv->vid) {
log_info2("ipoe: remove vlan %s\n", serv->ifname);
iplink_vlan_del(serv->ifindex);
diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h
index cd1993df..8c647b78 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.h
+++ b/accel-pppd/ctrl/ipoe/ipoe.h
@@ -123,6 +123,7 @@ struct ipoe_serv *ipoe_find_serv(const char *ifname);
void ipoe_nl_add_net(uint32_t addr, int mask);
void ipoe_nl_delete_nets(void);
void ipoe_nl_add_interface(int ifindex);
+void ipoe_nl_del_interface(int ifindex);
void ipoe_nl_delete_interfaces(void);
int ipoe_nl_create(uint32_t peer_addr, uint32_t addr, const char *ifname, uint8_t *hwaddr);
void ipoe_nl_delete(int ifindex);
diff --git a/accel-pppd/ctrl/ipoe/ipoe_netlink.c b/accel-pppd/ctrl/ipoe/ipoe_netlink.c
index 18542cde..d69decbe 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)
{