summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe/ipoe.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-03-29 14:05:58 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-03-29 14:05:58 +0300
commitb343b7c6246a48a1bd84bf71438e193cefec3c04 (patch)
tree5a208034da2255a437fd3ccbca14face50937bc8 /accel-pppd/ctrl/ipoe/ipoe.c
parent0e0e16001130d7614a2c7612e1098d15857698b1 (diff)
downloadaccel-ppp-b343b7c6246a48a1bd84bf71438e193cefec3c04.tar.gz
accel-ppp-b343b7c6246a48a1bd84bf71438e193cefec3c04.zip
ipoe: populate existing vlan interfaces by vlan info when vlan monitor event occurs
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe.c')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 1a501548..cdaab92a 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -199,6 +199,7 @@ static void __ipoe_session_start(struct ipoe_session *ses);
static int ipoe_rad_send_auth_request(struct rad_plugin_t *rad, struct rad_packet_t *pack);
static int ipoe_rad_send_acct_request(struct rad_plugin_t *rad, struct rad_packet_t *pack);
static void ipoe_session_create_auto(struct ipoe_serv *serv);
+static void ipoe_serv_timeout(struct triton_timer_t *t);
static void ipoe_ctx_switch(struct triton_context_t *ctx, void *arg)
{
@@ -2280,6 +2281,17 @@ static int get_offer_delay()
return 0;
}
+static void set_vlan_timeout(struct ipoe_serv *serv)
+{
+ serv->timer.expire = ipoe_serv_timeout;
+ serv->timer.expire_tv.tv_sec = conf_vlan_timeout;
+
+ pthread_mutex_lock(&serv->lock);
+ if (list_empty(&serv->sessions))
+ triton_timer_add(&serv->ctx, &serv->timer, 0);
+ pthread_mutex_unlock(&serv->lock);
+}
+
void ipoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex)
{
struct conf_sect_t *sect = conf_get_section("ipoe");
@@ -2322,6 +2334,13 @@ void ipoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex)
pthread_mutex_lock(&serv_lock);
list_for_each_entry(serv, &serv_list, entry) {
if (serv->ifindex == vlan_ifindex) {
+ if (!serv->vid) {
+ serv->vid = vid;
+ serv->parent_ifindex = ifindex;
+
+ if (conf_vlan_timeout)
+ triton_context_call(&serv->ctx, (triton_event_func)set_vlan_timeout, serv);
+ }
pthread_mutex_unlock(&serv_lock);
return;
}