pppd: Clarify circumstances where DNS1/DNS2 environment variables are set

Make it clear that the DNS1 and DNS2 environment variables being set
for scripts doesn't depend on whether the usepeerdns option was given,
only on whether the peer provided DNS server addresses.

Reported-by: William McCall
Signed-off-by: Paul Mackerras <paulus@samba.org>
ppp: ignore unrecognised radiusclient configuration directives

New versions of freeradius occasionally add configuration keywords.
There's no reason that the pppd plugin should fail when that occurs.

Signed-off-by:  Charlie Brady <charlieb@budge.apana.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Take out unused %r conversion completely

This just removes some code surrounded by #if 0/#endif, which Fedora
apparently feels the need to patch...

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Arrange to use logwtmp from libutil on Linux

Idea stolen from Fedora ppp patches.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppdump: Eliminate some compiler warnings

gcc lacks the -fyes-actually-I-do-know-the-C-operator-precedence-rules
option, so add some parentheses to shut it up.  Also remove some unused
variables.

Signed-off-by: Paul Mackerras <paulus@samba.org>
chat: Correct spelling errors in the man page

From Fedora patch.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Fix spelling errors in man page

From Fedora patch.

Signed-off-by: Paul Mackerras <paulus@samba.org>
plugins/passprompt: Fix potential out-of-bounds array reference

From Debian BTS, fix suggested by Timo Weingärtner.

Signed-off-by: Paul Mackerras <paulus@samba.org>
chat: Fix *roff errors in the man page

Fixes these errors:

$ nroff -man -ww chat/chat.8
chat/chat.8:227: warning: number register `"' not defined
chat/chat.8:291: warning: macro `'' not defined
chat/chat.8:368: warning: macro `PR' not defined

Patch partly from Debian BTS by Bjarni Ingi Gislason.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Fix man page description of case when remote IP address isn't known

We use a made-up address in the 10.x.x.x range, rather than refusing
to bring up the link.

Reported-by: Matthijs Kooijman
Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Add master_detach option

This adds a new option, master_detach, to allow pppd to detach from
the controlling terminal when it is the multilink bundle master but
its own link has terminated, even if the nodetach option has been
given.

Requested-by: Stephen Marron <sfm@boxfusion.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Default exit status to EXIT_CONNECT_FAILED during connection phase

The rp-pppoe plugin doesn't set the exit status in its connect
function, resulting in pppd exiting with a status of EXIT_OK (0)
if rp-pppoe fails to connect.  This fixes the problem for rp-pppoe
and any other plugins that don't set the exit status explicitly
by making the status default to EXIT_CONNECT_FAILED if the channel's
connect function fails.

Reported-by: Peter Warasin <peter@endian.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
pppstats: Fix undefined macro in man page

This resulted in the word "pppstats" missing at one point.  Fix from
Debian package.

Signed-off-by: Paul Mackerras <paulus@samba.org>
plugins/radius: Handle bindaddr keyword in radiusclient.conf

This adds code to the radius plugin to handle the bindaddr keyword in
/etc/radiusclient/radiusclient.conf, thus allowing the administrator
to specify which local IP address to use when sending packets to the
radius server.

This is very common for setups where the router has multiple
interfaces for upstream and you don't know which connection is active.
In this case sometimes the packet uses the IP of interface 1 and
sometimes uses the IP of interface 2.  With this patch (adapted from
radiusclient-ng) you can specify the IP of the loopback address, and
the plugin will bind to that IP and send the packet with a fixed IP
every time.

Slimmed a little bit at James Carlson's suggestion.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppoatm: Remove explicit loading of pppoatm kernel module

The kernel does this automatically itself.  Patch from debian package.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd: Fix segfault in update_db_entry()

The function update_db_entry() may only be called if pppdb is not NULL;
unfortunately in one situation it is.  Other calls to update_db_entry()
are protected against this, see, e.g., the end of script_setenv().

This is from the Debian pppd patches, and fixes Debian bug 308136
(SEGV in pppd).

Signed-off-by: Paul Mackerras <paulus@samba.org>
chat: Fix some text that was intended to be literal

This escapes a \c and adds a .br so that the "$ \c" comes out in the
nroff output, instead of the \c being interpreted as a line continuation.
This seems to be what was intended and makes sense as part of the chat
script fragment.

Signed-off-by: Paul Mackerras <paulus@samba.org>
README.pppoe: Minor semantic fix

From Debian ppp patch set.

Signed-off-by: Paul Mackerras <paulus@samba.org>
radius: Handle additional attributes

This allows radius plugin to handle additional radius attributes:

- Filter-ID (sets RADIUS_FILTER_ID env. var.)
- Framed-Route (sets RADIUS_FRAMED_ROUTE env. var.)
- Idle-Timeout
- NAS-IP-Address
- MS-Primary-DNS-Server
- MS-Secondary-DNS-Server
- MS-Primary-NBNS-Server
- MS-Secondary-NBNS-Server

[paulus@samba.org: Fixed formatting and simplified code making
 dns-1 and dns-2 default to each other, similarly wins-1 and wins-2]

Signed-off-by: Paul Mackerras <paulus@samba.org>
chat, pppd: Use \e instead of \\ in man pages

This avoids the need to double up the backslashes in some places, and
eliminates some errors reported by doclifter.

Reported-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>