From b343b7c6246a48a1bd84bf71438e193cefec3c04 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Tue, 29 Mar 2016 14:05:58 +0300 Subject: ipoe: populate existing vlan interfaces by vlan info when vlan monitor event occurs --- accel-pppd/ctrl/ipoe/ipoe.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'accel-pppd/ctrl/ipoe/ipoe.c') diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 1a50154..cdaab92 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; } -- cgit v1.2.3