diff options
author | DmitriyEshenko <snooppy@mail.ua> | 2019-05-09 12:54:44 +0300 |
---|---|---|
committer | DmitriyEshenko <snooppy@mail.ua> | 2019-05-09 12:54:44 +0300 |
commit | 3761f107ea954021ce2f7c9b7743073c1b92187d (patch) | |
tree | e56efd1cc38274183fe899a58c504df58130af23 | |
parent | 9c40c6df0189a2fb6068cd6f92529d508b8ead7b (diff) | |
download | accel-ppp-3761f107ea954021ce2f7c9b7743073c1b92187d.tar.gz accel-ppp-3761f107ea954021ce2f7c9b7743073c1b92187d.zip |
ipoe: Fix send NAK for REQUEST with 3 same XID for not existing sessions
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index b8082a6..6620b40 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -1646,7 +1646,7 @@ static int ipoe_serv_request_check(struct ipoe_serv *serv, uint32_t xid) list_del(&r->entry); mempool_free(r); } else if (r->xid == xid) { - if (++r->cnt == conf_max_request) { + if (++r->cnt >= conf_max_request) { list_del(&r->entry); mempool_free(r); return 1; @@ -1660,7 +1660,7 @@ static int ipoe_serv_request_check(struct ipoe_serv *serv, uint32_t xid) r = mempool_alloc(req_item_pool); r->xid = xid; r->expire = ts.tv_sec + 30; - r->cnt = 0; + r->cnt = 1; list_add_tail(&r->entry, &serv->req_list); return 0; @@ -1825,7 +1825,12 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet else if (opt82_ses) { dhcpv4_packet_ref(pack); triton_context_call(&opt82_ses->ctx, (triton_event_func)mac_change_detected, pack); - } else if (ipoe_serv_request_check(serv, pack->hdr->xid)) + } + + if (ap_shutdown) + goto out; + + if (ipoe_serv_request_check(serv, pack->hdr->xid)) dhcpv4_send_nak(dhcpv4, pack); } else { if (ses->terminate) { |