summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-12-01 13:30:56 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-12-01 13:30:56 +0300
commite6c5b180e9b3fe0afac48bffe80522813a35b405 (patch)
treed761e484a50fe14feb4893b024c322802f22f3db
parent504e7b995913956f71fe76c93e439df63701c0b3 (diff)
downloadaccel-ppp-e6c5b180e9b3fe0afac48bffe80522813a35b405.tar.gz
accel-ppp-e6c5b180e9b3fe0afac48bffe80522813a35b405.zip
ipoe: fixed reload interfaces renamed by NAS-Port-Id
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 7d148b2..9e1a989 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -2661,6 +2661,7 @@ static void load_interface(const char *opt)
{
const char *ptr;
struct ifreq ifr;
+ struct ipoe_serv *serv;
for (ptr = opt; *ptr && *ptr != ','; ptr++);
@@ -2670,6 +2671,16 @@ static void load_interface(const char *opt)
memcpy(ifr.ifr_name, opt, ptr - opt);
ifr.ifr_name[ptr - opt] = 0;
+ list_for_each_entry(serv, &serv_list, entry) {
+ if (serv->active)
+ continue;
+
+ if (!strcmp(serv->ifname, ifr.ifr_name)) {
+ add_interface(serv->ifname, serv->ifindex, opt, 0, 0);
+ return;
+ }
+ }
+
if (ioctl(sock_fd, SIOCGIFINDEX, &ifr)) {
log_error("ipoe: '%s': ioctl(SIOCGIFINDEX): %s\n", ifr.ifr_name, strerror(errno));
return;
@@ -2696,6 +2707,7 @@ static void load_interface_re(const char *opt)
const char *ptr;
int pcre_offset;
struct iplink_arg arg;
+ struct ipoe_serv *serv;
for (ptr = opt; *ptr && *ptr != ','; ptr++);
@@ -2715,6 +2727,14 @@ static void load_interface_re(const char *opt)
iplink_list((iplink_list_func)__load_interface_re, &arg);
+ list_for_each_entry(serv, &serv_list, entry) {
+ if (serv->active)
+ continue;
+
+ if (pcre_exec(re, NULL, serv->ifname, strlen(serv->ifname), 0, 0, NULL, 0) >= 0)
+ add_interface(serv->ifname, serv->ifindex, opt, 0, 0);
+ }
+
pcre_free(re);
_free(pattern);
}