All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arvin Schnell <arvin@suse.de>
To: linux-ppp@vger.kernel.org
Subject: rename ppp interface
Date: Fri, 16 Jul 2004 09:59:08 +0000	[thread overview]
Message-ID: <20040716095908.GA32556@suse.de> (raw)

[-- 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;
 }
 

             reply	other threads:[~2004-07-16  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-16  9:59 Arvin Schnell [this message]
2004-07-19  0:10 ` rename ppp interface 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040716095908.GA32556@suse.de \
    --to=arvin@suse.de \
    --cc=linux-ppp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.