diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 17:38:50 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 17:38:50 +0300 |
commit | e7d6fe6a72d0e03b1c63d070ff6e2f187a40f02a (patch) | |
tree | 24df97f6b4c6fcf797c99eef123b9dba6872abee /accel-pppd/ctrl | |
parent | 550d631e9aad3ffac3ab4c2953021182ab2eb0c3 (diff) | |
download | accel-ppp-e7d6fe6a72d0e03b1c63d070ff6e2f187a40f02a.tar.gz accel-ppp-e7d6fe6a72d0e03b1c63d070ff6e2f187a40f02a.zip |
ipoe: translate UP session to dhcp session when dhcp request received (for shared=0 interfaces)
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 7fe3967c..79e1de28 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -217,6 +217,15 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d if (opt82_ses) *opt82_ses = NULL; + if (list_empty(&serv->sessions)) + return NULL; + + if (!serv->opt_shared) { + ses = list_entry(serv->sessions.next, typeof(*ses), entry); + ses->UP = 0; + return ses; + } + if (!conf_check_mac_change || (pack->relay_agent && dhcpv4_parse_opt82(pack->relay_agent, &agent_circuit_id, &agent_remote_id))) { agent_circuit_id = NULL; agent_remote_id = NULL; @@ -1152,8 +1161,6 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s ses->xid = pack->hdr->xid; memcpy(ses->hwaddr, pack->hdr->chaddr, 6); ses->giaddr = pack->hdr->giaddr; - ses->lease_time = conf_lease_time; - ses->renew_time = conf_renew_time; if (pack->client_id) dlen += sizeof(struct dhcpv4_option) + pack->client_id->len; @@ -1867,6 +1874,9 @@ struct ipoe_session *ipoe_session_alloc(void) ses->ses.idle_timeout = conf_idle_timeout; ses->ses.session_timeout = conf_session_timeout; + ses->lease_time = conf_lease_time; + ses->renew_time = conf_renew_time; + return ses; } |