summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-04-04 16:53:12 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-04-04 16:53:12 +0300
commit38277ffc234acaae8fa0d2832cc7ce5b05c32395 (patch)
tree2815af038d783e1a5edeaec34d80bfac66dfb521 /accel-pppd
parentf67292499b20f599f2bd744d2dcf0f6779581787 (diff)
downloadaccel-ppp-38277ffc234acaae8fa0d2832cc7ce5b05c32395.tar.gz
accel-ppp-38277ffc234acaae8fa0d2832cc7ce5b05c32395.zip
vlan_mon: make possible to work other module after message "vlan not started"
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c3
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c1
-rw-r--r--accel-pppd/include/vlan_mon.h1
-rw-r--r--accel-pppd/vlan-mon/vlan_mon.c41
4 files changed, 44 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index bb1f9629..3edf7f00 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1913,8 +1913,6 @@ void ipoe_recv_up(int ifindex, struct ethhdr *eth, struct iphdr *iph, struct _ar
struct ipoe_session *ses;
in_addr_t saddr = arph ? arph->ar_spa : iph->saddr;
- log_debug("ipoe: recv up %08x\n", saddr);
-
pthread_mutex_lock(&serv_lock);
list_for_each_entry(serv, &serv_list, entry) {
if (serv->ifindex != ifindex)
@@ -2423,6 +2421,7 @@ void ipoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex)
log_warn("ipoe: vlan %s not started\n", ifname);
iplink_vlan_del(ifr.ifr_ifindex);
+ vlan_mon_del_vid(ifindex, ETH_P_IP, vid);
}
static void ipoe_serv_timeout(struct triton_timer_t *t)
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index 70978cf3..4e4b3811 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -1721,6 +1721,7 @@ void pppoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex)
log_warn("pppoe: vlan %s not started\n", ifname);
iplink_vlan_del(ifr.ifr_ifindex);
+ vlan_mon_del_vid(ifindex, ETH_P_PPP_DISC, vid);
}
static void add_vlan_mon(const char *opt, long *mask)
diff --git a/accel-pppd/include/vlan_mon.h b/accel-pppd/include/vlan_mon.h
index ebcfdc6c..23d5e60d 100644
--- a/accel-pppd/include/vlan_mon.h
+++ b/accel-pppd/include/vlan_mon.h
@@ -7,6 +7,7 @@ void vlan_mon_register_proto(uint16_t proto, vlan_mon_notify cb);
int vlan_mon_add(int ifindex, uint16_t proto, long *mask, int len);
int vlan_mon_add_vid(int ifindex, uint16_t proto, uint16_t vid);
+int vlan_mon_del_vid(int ifindex, uint16_t proto, uint16_t vid);
int vlan_mon_del(int ifindex, uint16_t proto);
int vlan_mon_check_busy(int ifindex, uint16_t vid);
diff --git a/accel-pppd/vlan-mon/vlan_mon.c b/accel-pppd/vlan-mon/vlan_mon.c
index 0f1b12a9..102f6f41 100644
--- a/accel-pppd/vlan-mon/vlan_mon.c
+++ b/accel-pppd/vlan-mon/vlan_mon.c
@@ -129,6 +129,47 @@ int __export vlan_mon_add_vid(int ifindex, uint16_t proto, uint16_t vid)
return r;
}
+int __export vlan_mon_del_vid(int ifindex, uint16_t proto, uint16_t vid)
+{
+ struct rtnl_handle rth;
+ struct nlmsghdr *nlh;
+ struct genlmsghdr *ghdr;
+ struct {
+ struct nlmsghdr n;
+ char buf[1024];
+ } req;
+ int r = 0;
+
+ if (vlan_mon_genl_id < 0)
+ return -1;
+
+ if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC)) {
+ log_error("vlan_mon: cannot open generic netlink socket\n");
+ return -1;
+ }
+
+ nlh = &req.n;
+ nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
+ nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
+ nlh->nlmsg_type = vlan_mon_genl_id;
+
+ ghdr = NLMSG_DATA(&req.n);
+ ghdr->cmd = VLAN_MON_CMD_DEL_VID;
+
+ addattr32(nlh, 1024, VLAN_MON_ATTR_IFINDEX, ifindex);
+ addattr_l(nlh, 1024, VLAN_MON_ATTR_VID, &vid, 2);
+ addattr_l(nlh, 1024, VLAN_MON_ATTR_PROTO, &proto, 2);
+
+ if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) {
+ log_error("vlan_mon: nl_add_vlan_mon_vid: error talking to kernel\n");
+ r = -1;
+ }
+
+ rtnl_close(&rth);
+
+ return r;
+}
+
int __export vlan_mon_del(int ifindex, uint16_t proto)
{
struct rtnl_handle rth;