diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 11:00:37 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-03-06 11:00:37 +0300 |
commit | c45d48bf3dd7776a41deb8276ef84cf74cbce6d8 (patch) | |
tree | 617f8a78b87dfd99b7f3d73e4a1621909cf3d389 /accel-pppd/ctrl | |
parent | b4d57a162c386ce37544c5f2a1cfc92001e0ff4a (diff) | |
download | accel-ppp-c45d48bf3dd7776a41deb8276ef84cf74cbce6d8.tar.gz accel-ppp-c45d48bf3dd7776a41deb8276ef84cf74cbce6d8.zip |
pppoe: fixed invalid behaviour after changing pado-delay
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/pppoe/dpado.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/accel-pppd/ctrl/pppoe/dpado.c b/accel-pppd/ctrl/pppoe/dpado.c index c7992bc4..71faa130 100644 --- a/accel-pppd/ctrl/pppoe/dpado.c +++ b/accel-pppd/ctrl/pppoe/dpado.c @@ -125,21 +125,25 @@ int dpado_parse(const char *str) _free(r); } + list_splice(&range_list, &dpado_range_list); + dpado_range_next = NULL; dpado_range_prev = NULL; - while (!list_empty(&range_list)) { - r = list_entry(range_list.next, typeof(*r), entry); - list_del(&r->entry); - list_add_tail(&r->entry, &dpado_range_list); - - if (!dpado_range_prev || stat_active >= r->conn_cnt) + list_for_each_entry(r, &dpado_range_list, entry) { + if (!dpado_range_prev || stat_active >= r->conn_cnt) { dpado_range_prev = r; - else if (!dpado_range_next) - dpado_range_next = r; + if (r->entry.next != &dpado_range_list) + dpado_range_next = list_entry(r->entry.next, typeof(*r), entry); + else + dpado_range_next = NULL; + } } - pado_delay = dpado_range_prev->pado_delay; + if (dpado_range_prev) + pado_delay = dpado_range_prev->pado_delay; + else + pado_delay = 0; if (conf_pado_delay) _free(conf_pado_delay); |