diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2019-05-13 11:51:17 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2019-05-13 11:51:17 +0300 |
commit | 85ace14ed9976e98081068fe2e797fcf09e08148 (patch) | |
tree | 7daecd3615d17ce70c5d6c492b950d4c360c6d83 | |
parent | 6f433706a152ea987899fd830ff399e257b0f2a6 (diff) | |
parent | e909de9c6afd0581c8847b3676b200f4c0b7237b (diff) | |
download | accel-ppp-85ace14ed9976e98081068fe2e797fcf09e08148.tar.gz accel-ppp-85ace14ed9976e98081068fe2e797fcf09e08148.zip |
Merge branch 'master' of github.com:xebd/accel-ppp
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 53 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/arp.c | 2 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 11 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 1 | ||||
-rw-r--r-- | accel-pppd/extra/ippool.c | 2 | ||||
-rw-r--r-- | accel-pppd/radius/acct.c | 3 | ||||
-rw-r--r-- | accel-pppd/radius/dm_coa.c | 12 |
7 files changed, 60 insertions, 24 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 9ccac7d5..7c4b57af 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -28,6 +28,9 @@ containes list of modules to load .BI log_file This is logging target which logs messages to files. It support per-session/per-user features. .TP +.BI log_syslog +This is logging target which logs messages to syslog. +.TP .BI log_tcp This is logging target which logs messages over TCP/IP. .TP @@ -83,6 +86,39 @@ Path to file for core module error logging. .TP .BI "thread-count=" n number of working threads, optimal - number of processors/cores +.SH [common] +Containes common params for all connection types +.TP +.BI "single-session=" replace|deny +Specifies whether accel-ppp should control sessions count. +.br +If this option is absent session count control is turned off. +.br +If this option is +.B replace +then accel-ppp will terminate first session when second is authorized. +.br +If this option is +.B deny +then accel-ppp will deny second session authorization. +.TP +.BI "sid-case=" upper|lower +Specifies in which case generate session identifier (default lower). +.TP +.BI "sid-source=" urandom|seq +Specifies method assign session id (default urandom). +.br +.B urandom +Assign session id by random method +.br +.B seq +Assign session id by sequence method +.TP +.BI "seq-file=" path +Path to file for sessions sequence number. Start sequence number may be set there (default /var/lib/accel-ppp/seq). +.TP +.BI "max-sessions=" n +Specifies maximum sessions which server may processed (default 0, disabled) .SH [ppp] .br PPP module configuration. @@ -120,23 +156,9 @@ Protocol field compression negotiation. .BI "ccp=" n Disable CCP negotiation if this parameter is zero. .TP -.BI "sid-case=" upper|lower -Specifies in which case generate session identifier (default lower). -.TP .BI "check-ip=" 0|1 Specifies whether accel-ppp should check if IP already assigned to other ppp interface (default 0). .TP -.BI "single-session=" replace|deny -Specifies whether accel-ppp should control sessions count. -.br -If this option is absent session count control is turned off. -If this option is -.B replace -then accel-ppp will terminate first session when second is authorized. -If this option is -.B deny -then accel-ppp will deny second session authorization. -.TP .BI "mppe=" require|prefer|deny Specifies mppe negotioation preference. .br @@ -390,6 +412,9 @@ Specifies delays (also in condition of connection count) to send DHCPOFFER (ms). Last delay in list may be -1 which means don't accept new connections. List must to be sorted by count key. .TP +.BI "offer-timeout=" n +Specified timeout waiting DHCP-Request from client in seconds (default 10). +.TP .BI "vlan-mon=" [re:]name[,filter] Starts vlan monitor on specified interface (requires ipoe kernel module). .br diff --git a/accel-pppd/ctrl/ipoe/arp.c b/accel-pppd/ctrl/ipoe/arp.c index 0698bd1c..1979c762 100644 --- a/accel-pppd/ctrl/ipoe/arp.c +++ b/accel-pppd/ctrl/ipoe/arp.c @@ -59,6 +59,7 @@ static void arp_ctx_read(struct _arphdr *ah) memset(&dst, 0, sizeof(dst)); dst.sll_family = AF_PACKET; dst.sll_ifindex = ipoe->ifindex; + dst.sll_halen = ETH_ALEN; dst.sll_protocol = htons(ETH_P_ARP); ah2.ar_hrd = htons(ARPHRD_ETHER); @@ -136,6 +137,7 @@ void arp_send(int ifindex, struct _arphdr *arph, int broadcast) memset(&dst, 0, sizeof(dst)); dst.sll_family = AF_PACKET; dst.sll_ifindex = ifindex; + dst.sll_halen = ETH_ALEN; dst.sll_protocol = htons(ETH_P_ARP); if (broadcast) memcpy(dst.sll_addr, bc_addr, ETH_ALEN); diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 5b44622d..556bad72 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) { diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 7ab20e35..12b54004 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -748,6 +748,7 @@ static void pppoe_send(struct pppoe_serv_t *serv, const uint8_t *pack) .sll_family = AF_PACKET, .sll_protocol = htons(ETH_P_PPP_DISC), .sll_ifindex = serv->ifindex, + .sll_halen = ETH_ALEN, }; struct pppoe_hdr *hdr = (struct pppoe_hdr *)(pack + ETH_HLEN); diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c index 73ad3987..844981cc 100644 --- a/accel-pppd/extra/ippool.c +++ b/accel-pppd/extra/ippool.c @@ -354,6 +354,8 @@ again: else it->it.addr = 0; + it->it.mask = 0; + return &it->it; } else if (p->next) { p = p->next; diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index e4daedbf..b17016d5 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -88,7 +88,8 @@ static void rad_acct_recv(struct rad_req_t *req) stat_accm_add(req->serv->stat_interim_query_1m, dt); stat_accm_add(req->serv->stat_interim_query_5m, dt); - triton_timer_del(&req->timeout); + if (req->timeout.tpd) + triton_timer_del(&req->timeout); triton_md_unregister_handler(&req->hnd, 1); diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index ea9743d9..f967ec64 100644 --- a/accel-pppd/radius/dm_coa.c +++ b/accel-pppd/radius/dm_coa.c @@ -173,13 +173,13 @@ static void coa_request(struct radius_pd_t *rpd) memcpy(rpd->attr_class, class->val.octets, class->len); rpd->attr_class_len = class->len; - } - if (rpd->acct_req && rpd->acct_req->pack) { - if (prev_class) - rad_packet_change_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len); - else - rad_packet_add_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len); + if (rpd->acct_req && rpd->acct_req->pack) { + if (prev_class) + rad_packet_change_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len); + else + rad_packet_add_octets(rpd->acct_req->pack, NULL, "Class", rpd->attr_class, rpd->attr_class_len); + } } attr = rad_packet_find_attr(rpd->dm_coa_req, NULL, "Session-Timeout"); |