]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Add noresolvconf option (#512)
authorTomas Paukrt <44699103+tpaukrt@users.noreply.github.com>
Tue, 10 Sep 2024 10:14:57 +0000 (12:14 +0200)
committerGitHub <noreply@github.com>
Tue, 10 Sep 2024 10:14:57 +0000 (20:14 +1000)
This option allows a user to specify that they do not want to
create the /etc/ppp/resolv.conf file with the DNS server addresses.
This can be useful when running on a read-only root filesystem.

Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz>
pppd/ipcp.c
pppd/pppd.8

index 06dfd894065753af2cdeabd68a624981065ebe05..ded4370783e32a9a1ce1e3ffd35af02d9d1bc4ba 100644 (file)
@@ -88,6 +88,7 @@ static int default_route_set[NUM_PPP];        /* Have set up a default route */
 static int proxy_arp_set[NUM_PPP];     /* Have created proxy arp entry */
 static bool usepeerdns;                        /* Ask peer for DNS addrs */
 static bool usepeerwins;               /* Ask peer for WINS addrs */
+static bool noresolvconf;              /* Do not create resolv.conf */
 static int ipcp_is_up;                 /* have called np_up() */
 static int ipcp_is_open;               /* haven't called np_finished() */
 static bool ask_for_local;             /* request our address from peer */
@@ -219,6 +220,9 @@ static struct option ipcp_option_list[] = {
     { "usepeerwins", o_bool, &usepeerwins,
       "Ask peer for WINS address(es)", 1 },
 
+    { "noresolvconf", o_bool, &noresolvconf,
+      "Do not create resolv.conf", 1 },
+
     { "netmask", o_special, (void *)setnetmask,
       "set netmask", OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, netmask_str },
 
@@ -2152,6 +2156,9 @@ create_resolv(u_int32_t peerdns1, u_int32_t peerdns2)
 {
     FILE *f;
 
+    if (noresolvconf)
+       return;
+
     f = fopen(PPP_PATH_RESOLV, "w");
     if (f == NULL) {
        error("Failed to create %s: %m", PPP_PATH_RESOLV);
index 317549b2084f2a76eef805412b9c52dfe46d628a..c028c22cad7a7d67dbf0bdc7af588b604a34f248 100644 (file)
@@ -1200,7 +1200,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.
+the address(es) supplied by the peer (unless the \fInoresolvconf\fR
+option is given).
 .TP
 .B usepeerwins
 Ask the peer for up to 2 WINS server addresses.  The addresses supplied
@@ -1212,6 +1213,9 @@ Please note that some modems (like the Huawei E220) requires this option in
 order to avoid a race condition that results in the incorrect DNS servers
 being assigned.
 .TP
+.B noresolvconf
+Do not create the /etc/ppp/resolv.conf file.
+.TP
 .B user \fIname
 Sets the name used for authenticating the local system to the peer to
 \fIname\fR.