Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pppd: Add noresolvconf option #512

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pppd/ipcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 },

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion pppd/pppd.8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down