Package: ppp Version: 2.4.5-5.1 Severity: normal The problem is that when you have multiple up-links from PPP concentrator the radius plugin uses the interface IP. If you forget to configure the Radius Server with all outgoing interface you will facing with problems when the main link is down.
The patch add the capability to PPP to bind on a specific IP (for example a loopback IP) and use the outgoing packets whith that IP. This kind of setup simplify the radius configuration (you need only one client in radius server) and also the debuging. -- System Information: Debian Release: 7.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/dash Versions of packages ppp depends on: ii libc6 2.13-38 ii libpam-modules 1.1.3-7.1 ii libpam-runtime 1.1.3-7.1 ii libpam0g 1.1.3-7.1 ii libpcap0.8 1.3.0-1 ii procps 1:3.3.3-3 ppp recommends no packages. ppp suggests no packages. -- no debconf information
This patch fix 2 problems with radius.so: 1. bindaddr from /etc/radiusclient/radiusclient.conf is read and the radius.so doesn't exit with error 2. bindaddr is used to send the radius packet to the server using a specific IP address in system This is very common for setups that the router has multiple interfaces for upstreams and you don't know which connection is active. In this case sometimes packet uses the IP of interface 1 and sometimes uses the IP of interface 2. With this patch (adapted form radiusclient-ng) you can specify the IP of loopback address and the plugin will bind to that IP and send the packet with a fix IP everytime. Slimmed a little bit on James Carlson sugestion. Author: Adrian Ban <[email protected]> diff -Naur ppp-2.4.5/pppd/plugins/radius/ip_util.c ppp-2.4.5-bindaddress/pppd/plugins/radius/ip_util.c --- ppp-2.4.5/pppd/plugins/radius/ip_util.c 2009-11-17 00:26:07.000000000 +0200 +++ ppp-2.4.5-bindaddress/pppd/plugins/radius/ip_util.c 2013-04-03 23:03:32.855233123 +0300 @@ -135,3 +135,32 @@ return this_host_ipaddr; } + +/* + * Function: rc_own_bind_ipaddress + * + * Purpose: get the IP address to be used as a source address + * for sending requests in host order + * + * Returns: IP address + * + */ + +UINT4 rc_own_bind_ipaddress(void) +{ + char *bindaddr; + UINT4 rval = 0; + + if ((bindaddr = rc_conf_str("bindaddr")) == NULL || + strcmp(rc_conf_str("bindaddr"), "*") == 0) { + rval = INADDR_ANY; + } else { + if ((rval = rc_get_ipaddr(bindaddr)) == 0) { + error("rc_own_bind_ipaddress: couldn't get IP address from bindaddr"); + rval = INADDR_ANY; + } + } + + return rval; +} + diff -Naur ppp-2.4.5/pppd/plugins/radius/options.h ppp-2.4.5-bindaddress/pppd/plugins/radius/options.h --- ppp-2.4.5/pppd/plugins/radius/options.h 2009-11-17 00:26:07.000000000 +0200 +++ ppp-2.4.5-bindaddress/pppd/plugins/radius/options.h 2013-04-02 16:18:30.551339169 +0300 @@ -55,6 +55,7 @@ {"radius_timeout", OT_INT, ST_UNDEF, NULL}, {"radius_retries", OT_INT, ST_UNDEF, NULL}, {"nas_identifier", OT_STR, ST_UNDEF, ""}, +{"bindaddr", OT_STR, ST_UNDEF, NULL}, /* local options */ {"login_local", OT_STR, ST_UNDEF, NULL}, }; diff -Naur ppp-2.4.5/pppd/plugins/radius/sendserver.c ppp-2.4.5-bindaddress/pppd/plugins/radius/sendserver.c --- ppp-2.4.5/pppd/plugins/radius/sendserver.c 2009-11-17 00:26:07.000000000 +0200 +++ ppp-2.4.5-bindaddress/pppd/plugins/radius/sendserver.c 2013-04-03 20:20:01.411359661 +0300 @@ -244,7 +244,7 @@ sin = (struct sockaddr_in *) & salocal; memset ((char *) sin, '\0', (size_t) length); sin->sin_family = AF_INET; - sin->sin_addr.s_addr = htonl(INADDR_ANY); + sin->sin_addr.s_addr = htonl(rc_own_bind_ipaddress()); sin->sin_port = htons ((unsigned short) 0); if (bind (sockfd, (struct sockaddr *) sin, length) < 0 || getsockname (sockfd, (struct sockaddr *) sin, &length) < 0)

