提交 e6c5b180 编写于 作者: D Dmitry Kozlov

ipoe: fixed reload interfaces renamed by NAS-Port-Id

上级 504e7b99
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册