linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rename ppp interface
@ 2004-07-16  9:59 Arvin Schnell
  2004-07-19  0:10 ` James Cameron
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Arvin Schnell @ 2004-07-16  9:59 UTC (permalink / raw)
  To: linux-ppp

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]


Hi,

as you might know with the linux kernel 2.6 it is possible to
rename network interfaces.  I have made a small patch to allow
the pppd to rename it is ppp interface.  The patch is only to
demonstrate the issue - it is far from complete (no option, no
documentation, pppstats needs adaption).  If there is willingness
to include this feature in the mainline I can make a complete
patch.

Besides that, does anybody see problems with renaming of ppp
interfaces?

ciao Arvin

-- 
Dipl.-Phys. Arvin Schnell
SuSE Linux AG
Research & Development
email: arvin@suse.de

[-- Attachment #2: ppp-2.4.2-nameif.diff --]
[-- Type: text/plain, Size: 1026 bytes --]

--- ./pppd/main.c.orig	2004-07-15 14:16:09.000000000 +0000
+++ ./pppd/main.c	2004-07-15 15:01:24.000000000 +0000
@@ -777,8 +777,11 @@
 set_ifunit(iskey)
     int iskey;
 {
-    info("Using interface %s%d", PPP_DRV_NAME, ifunit);
+    if (1)
+	slprintf(ifname, sizeof(ifname), "modem");
+    else
     slprintf(ifname, sizeof(ifname), "%s%d", PPP_DRV_NAME, ifunit);
+    info("Using interface %s", ifname);
     script_setenv("IFNAME", ifname, iskey);
     if (iskey) {
 	create_pidfile(getpid());	/* write pid to file */
--- ./pppd/sys-linux.c.orig	2004-07-15 14:16:18.000000000 +0000
+++ ./pppd/sys-linux.c	2004-07-16 09:36:24.373838222 +0000
@@ -647,6 +647,17 @@
 	}
 	if (x < 0)
 		error("Couldn't create new ppp unit: %m");
+
+	if (1) {
+		struct ifreq ifr;
+		memset(&ifr, 0, sizeof(struct ifreq));
+		strcpy(ifr.ifr_name, "ppp0");
+		strcpy(ifr.ifr_newname, "modem");
+		x = ioctl(sock_fd, SIOCSIFNAME, &ifr);
+		if (x < 0)
+		    error("Couldn't rename interface %s to %s: %m", "ppp0", "modem");
+	}
+
 	return x;
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-01 23:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-16  9:59 rename ppp interface Arvin Schnell
2004-07-19  0:10 ` James Cameron
2004-07-19 15:35 ` Arvin Schnell
2004-07-21 13:47 ` Michael Tokarev
2004-07-21 13:54 ` Michael Tokarev
2004-07-21 14:38 ` Arvin Schnell
2004-08-01 23:10 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).