summaryrefslogtreecommitdiff
path: root/accel-pppd/ifcfg.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-05-12 17:44:20 +0400
committerDmitry Kozlov <xeb@mail.ru>2014-05-12 17:44:20 +0400
commitc0cf8924783347c4f4b4faccba88247f3cd6accd (patch)
tree8ba9631e36d54fc7da8d644a879b2af1b9820c1e /accel-pppd/ifcfg.c
parentd0fa7ad6fb1d0ace4c292c7084ff1752ef5c45b7 (diff)
downloadaccel-ppp-c0cf8924783347c4f4b4faccba88247f3cd6accd.tar.gz
accel-ppp-c0cf8924783347c4f4b4faccba88247f3cd6accd.zip
radius: use NAS-Port-Id in Access-Accept for interface renaming
Diffstat (limited to 'accel-pppd/ifcfg.c')
-rw-r--r--accel-pppd/ifcfg.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c
index ea1ac2f9..bbbcc02d 100644
--- a/accel-pppd/ifcfg.c
+++ b/accel-pppd/ifcfg.c
@@ -230,3 +230,28 @@ void __export ap_session_ifdown(struct ap_session *ses)
}
}
+void __export ap_session_rename(struct ap_session *ses, const char *ifname, int len)
+{
+ struct ifreq ifr;
+
+ if (len == -1)
+ len = strlen(ifname);
+
+ if (len >= IFNAMSIZ - 1) {
+ log_ppp_warn("cannot rename interface (name it too long)\n");
+ return;
+ }
+
+ ifr.ifr_ifindex = ses->ifindex;
+ strcpy(ifr.ifr_name, ses->ifname);
+ memcpy(ifr.ifr_newname, ifname, len);
+ ifr.ifr_newname[len] = 0;
+
+ if (ioctl(sock_fd, SIOCSIFNAME, &ifr))
+ log_ppp_warn("interface rename failed: %s\n", strerror(errno));
+ else {
+ memcpy(ses->ifname, ifname, len);
+ ses->ifname[len] = 0;
+ }
+}
+