Page MenuHome Accel-ppp
Authored By
Dimka88
Jan 5 2022, 12:41
Size
2 KB
Referenced Files
None
Subscribers
None

ctrl_ipoe.c.patch

--- a/accel-pppd/ctrl/ipoe/ipoe.c.orig 2022-01-03 19:49:00.000000000 +0300
+++ b/accel-pppd/ctrl/ipoe/ipoe.c 2022-01-03 18:07:26.867186076 +0300
@@ -1144,7 +1141,7 @@
//ipaddr_add_peer(ses->ses.ifindex, ses->router, ses->yiaddr); // breaks quagga
iproute_add(ses->ses.ifindex, ses->router, ses->yiaddr, 0, conf_proto, 32, 0);
- if (ses->ifindex != -1 && ses->xid) {
+ if (ses->ses.net == def_net && ses->ifindex != -1 && ses->xid) {
ses->dhcpv4 = dhcpv4_create(ses->ctrl.ctx, ses->ses.ifname, "");
if (!ses->dhcpv4) {
//terminate
@@ -1200,6 +1200,16 @@
log_ppp_info1("ipoe: session finished\n");
if (ses->ifindex != -1) {
+ if (s->net != def_net) {
+ if (net->move_link(def_net, s->ifindex))
+ log_ppp_warn("failed to attach to default namespace\n");
+ else {
+ s->net = def_net;
+ net = def_net;
+ s->ifindex = net->get_ifindex(s->ifname);
+ ses->ifindex = s->ifindex;
+ }
+ }
if (uc_size < conf_unit_cache) {
strcpy(ifr.ifr_name, s->ifname);
ioctl(sock_fd, SIOCGIFFLAGS, &ifr);
--- a/accel-pppd/ifcfg.c.orig 2022-01-04 10:11:16.541404886 +0300
+++ b/accel-pppd/ifcfg.c 2022-01-04 10:57:11.176984455 +0300
@@ -324,6 +324,18 @@
}
if (ns) {
+ if (!len && strstr(ses->ifname, "ipoe")) {
+ strcpy(ifr.ifr_name, ses->ifname);
+ sprintf(ses->ifname, "ipoe%d", ses->ifindex);
+ len = strlen(ses->ifname);
+ memcpy(ifr.ifr_newname, ses->ifname, len);
+ ifr.ifr_newname[len] = 0;
+
+ log_ppp_info2("rename interface to '%s'\n", ses->ifname);
+
+ r = net->sock_ioctl(SIOCSIFNAME, &ifr);
+ }
+
if (net->move_link(ns, ses->ifindex)) {
log_ppp_error("failed to attach namespace\n");
ns->release(ns);
--- a/accel-pppd/session.c.orig 2022-01-04 17:53:03.223884189 +0300
+++ b/accel-pppd/session.c 2022-01-05 14:28:01.148693337 +0300
@@ -73,6 +73,8 @@
{
struct rtnl_link_stats stats;
+ net = ses->net;
+
if (iplink_get_stats(ses->ifindex, &stats))
log_ppp_warn("failed to get interface statistics\n");
else {
@@ -386,6 +388,8 @@
if (!stats)
stats = &lstats;
+ net = ses->net;
+
if (iplink_get_stats(ses->ifindex, stats)) {
log_ppp_warn("failed to get interface statistics\n");
return -1;

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/4y/hp/eocd4tn62ogzwxhs
Default Alt Text
ctrl_ipoe.c.patch (2 KB)

Event Timeline