File ppp-var_run_resolv_conf.patch of Package ppp

Tue Jul 22 14:16:29 CEST 2008 - hvogel@suse.de

Move the resolv.conf written by pppd to /var/run [bnc#401648]


diff -Nur ppp-2.4.9/Changes-2.3 new/Changes-2.3
--- ppp-2.4.9/Changes-2.3	2021-01-05 00:06:37.000000000 +0100
+++ new/Changes-2.3	2022-05-23 18:30:08.827773633 +0200
@@ -262,10 +262,10 @@
 
 * Added new option `usepeerdns', thanks to Nick Walker
   <nickwalker@email.com>.  If the peer supplies DNS addresses, these
-  will be written to /etc/ppp/resolv.conf.  The ip-up script can then
-  be used to add these addresses to /etc/resolv.conf if desired (see
-  the ip-up.local.add and ip-down.local.add files in the scripts
-  directory).
+  will be written to /var/run/ppp_resolv.conf.$INTERFACE_NAME.
+  The ip-up script can then be used to add these addresses to
+  /etc/resolv.conf if desired (see the ip-up.local.add and
+  ip-down.local.add files in the scripts directory).
 
 * The Solaris ppp driver should now work correctly on SMP systems.
 
diff -Nur ppp-2.4.9/pppd/ipcp.c new/pppd/ipcp.c
--- ppp-2.4.9/pppd/ipcp.c	2021-01-05 00:06:37.000000000 +0100
+++ new/pppd/ipcp.c	2022-05-23 18:30:08.827773633 +0200
@@ -2090,10 +2090,13 @@
 create_resolv(u_int32_t peerdns1, u_int32_t peerdns2)
 {
     FILE *f;
+    char rcfilename[MAXIFNAMELEN];
 
-    f = fopen(_PATH_RESOLV, "w");
+    slprintf(rcfilename, sizeof(rcfilename), "%s.%s",
+                 _PATH_RESOLV, ifname);
+    f = fopen(rcfilename, "w");
     if (f == NULL) {
-	error("Failed to create %s: %m", _PATH_RESOLV);
+	error("Failed to create %s: %m", rcfilename);
 	return;
     }
 
@@ -2104,7 +2107,7 @@
 	fprintf(f, "nameserver %s\n", ip_ntoa(peerdns2));
 
     if (ferror(f))
-	error("Write failed to %s: %m", _PATH_RESOLV);
+	error("Write failed to %s: %m", rcfilename);
 
     fclose(f);
 }
diff -Nur ppp-2.4.9/pppd/pathnames.h new/pppd/pathnames.h
--- ppp-2.4.9/pppd/pathnames.h	2021-01-05 00:06:37.000000000 +0100
+++ new/pppd/pathnames.h	2022-05-23 18:30:08.827773633 +0200
@@ -35,7 +35,7 @@
 #define _PATH_TTYOPT	 _ROOT_PATH "/etc/ppp/options."
 #define _PATH_CONNERRS	 _ROOT_PATH "/etc/ppp/connect-errors"
 #define _PATH_PEERFILES	 _ROOT_PATH "/etc/ppp/peers/"
-#define _PATH_RESOLV	 _ROOT_PATH "/etc/ppp/resolv.conf"
+#define _PATH_RESOLV	 _ROOT_PATH "/var/run/ppp_resolv.conf"
 
 #define _PATH_USEROPT	 ".ppprc"
 #define	_PATH_PSEUDONYM	 ".ppp_pseudonym"
diff -Nur ppp-2.4.9/pppd/pppd.8 new/pppd/pppd.8
--- ppp-2.4.9/pppd/pppd.8	2021-01-05 00:06:37.000000000 +0100
+++ new/pppd/pppd.8	2022-05-23 18:30:08.827773633 +0200
@@ -1196,8 +1196,8 @@
 by the peer (if any) are passed to the /etc/ppp/ip\-up script in the
 environment variables DNS1 and DNS2, and the environment variable
 USEPEERDNS will be set to 1.  In addition, pppd will create an
-/etc/ppp/resolv.conf file containing one or two nameserver lines with
-the address(es) supplied by the peer.
+/var/run/ppp_resolv.conf.$INTERFACE file containing one or two nameserver
+lines with the address(es) supplied by the peer.
 .TP
 .B user \fIname
 Sets the name used for authenticating the local system to the peer to
openSUSE Build Service is sponsored by