summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/command.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-10-26 19:07:36 +0000
committerbrian <brian@FreeBSD.org>1998-10-26 19:07:36 +0000
commit54882479aee399667951dbeca252bd5961bd7bd6 (patch)
treecf6312c9b39d37fdfa2224df915dde9095a1410b /usr.sbin/ppp/command.c
parentde27adfbe9a0cf1453956685ae2a84b1ff7e9947 (diff)
downloadFreeBSD-src-54882479aee399667951dbeca252bd5961bd7bd6.zip
FreeBSD-src-54882479aee399667951dbeca252bd5961bd7bd6.tar.gz
Fix the interface alias code. Previously, I was expecting something
like tun0: flags=blah 10.0.0.1 -> 10.0.0.100 10.0.0.2 -> 10.0.0.100 10.0.0.3 -> 10.0.0.100 to DTRT, despite the SIOCAIFADDR for each new alias returning -1 & EEXIST while adding the alias anyway. In real life, once we have the second alias with the same destination, nothing will route any more ! Also, because I was ignoring EEXIST, the dynamic IP assignment code was assigning duplicate addresses ('cos it was being lied to by iface_inAdd()). Now we have tun0: flags=blah 10.0.0.1 -> 255.255.255.255 10.0.0.2 -> 10.0.0.100 10.0.0.3 -> 255.255.255.255 This works - stuff bound to 10.1 & 10.3 will be considered alive by the kernel, and when they route back to the tun device, the packets get aliased to 10.2 and go out to 10.100 (as with the original plan). We still see the EEXIST in SIOCAIFADDR, but ignore it when our destination is 255.255.255.255, assuming that the alias *was* actually added. Additionally, ``iface add'' may now optionally be given only the interface address. The mask & destination default to 255.255.255.255.
Diffstat (limited to 'usr.sbin/ppp/command.c')
-rw-r--r--usr.sbin/ppp/command.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index a1b1789..f474aca 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.168 1998/10/22 02:32:48 brian Exp $
+ * $Id: command.c,v 1.169 1998/10/24 01:08:45 brian Exp $
*
*/
#include <sys/types.h>
@@ -132,7 +132,7 @@
#define NEG_DNS 50
const char Version[] = "2.0";
-const char VersionDate[] = "$Date: 1998/10/22 02:32:48 $";
+const char VersionDate[] = "$Date: 1998/10/24 01:08:45 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -2321,21 +2321,27 @@ IfaceAddCommand(struct cmdargs const *arg)
int bits, n, how;
struct in_addr ifa, mask, brd;
- if (arg->argc == arg->argn + 2) {
- if (!ParseAddr(NULL, 1, arg->argv + arg->argn, &ifa, &mask, &bits))
- return -1;
- n = 1;
- } else if (arg->argc == arg->argn + 3) {
+ if (arg->argc == arg->argn + 1) {
if (!ParseAddr(NULL, 1, arg->argv + arg->argn, &ifa, NULL, NULL))
return -1;
- if (!ParseAddr(NULL, 1, arg->argv + arg->argn + 1, &mask, NULL, NULL))
+ mask.s_addr = brd.s_addr = INADDR_BROADCAST;
+ } else {
+ if (arg->argc == arg->argn + 2) {
+ if (!ParseAddr(NULL, 1, arg->argv + arg->argn, &ifa, &mask, &bits))
+ return -1;
+ n = 1;
+ } else if (arg->argc == arg->argn + 3) {
+ if (!ParseAddr(NULL, 1, arg->argv + arg->argn, &ifa, NULL, NULL))
+ return -1;
+ if (!ParseAddr(NULL, 1, arg->argv + arg->argn + 1, &mask, NULL, NULL))
+ return -1;
+ n = 2;
+ } else
return -1;
- n = 2;
- } else
- return -1;
- if (!ParseAddr(NULL, 1, arg->argv + arg->argn + n, &brd, NULL, NULL))
- return -1;
+ if (!ParseAddr(NULL, 1, arg->argv + arg->argn + n, &brd, NULL, NULL))
+ return -1;
+ }
how = IFACE_ADD_LAST;
if (arg->cmd->args)
OpenPOWER on IntegriCloud