diff options
author | brian <brian@FreeBSD.org> | 1997-06-20 23:43:35 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-06-20 23:43:35 +0000 |
commit | c74ce8e38cf1ef18f81b98b15b3f859fc5db5c8c (patch) | |
tree | 74cd18bc8a8856d233f8d85771ccc828635db55e | |
parent | 24968494546dd7b4544d322f1ff342fed30205e6 (diff) | |
download | FreeBSD-src-c74ce8e38cf1ef18f81b98b15b3f859fc5db5c8c.zip FreeBSD-src-c74ce8e38cf1ef18f81b98b15b3f859fc5db5c8c.tar.gz |
Fix "delete all".
PR: 3913
-rw-r--r-- | usr.sbin/ppp/ppp.8 | 36 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp.8.m4 | 36 | ||||
-rw-r--r-- | usr.sbin/ppp/route.c | 16 |
3 files changed, 56 insertions, 32 deletions
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index e5d5a87..7c10112 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.39 1997/06/13 03:59:35 brian Exp $ +.\" $Id: ppp.8,v 1.40 1997/06/16 13:52:10 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1146,29 +1146,39 @@ set ifaddr 10.10.10.10/0 10.10.11.11/0 255.255.255.0 .It In most cases, your ISP will also be your default router. If this is the case, add the lines + .Bd -literal -offset indent delete ALL add 0 0 10.10.11.11 .Ed + .Pp to .Pa ppp.conf . .Pp This tells .Nm -to delete all routing entries already made by -.Nm , -then to add a default route to HISADDR. HISADDR is a macro meaning the -"other side"s IP number. +to delete all non-direct routing entries for the tun interface that +.Nm +is running on, then to add a default route to 10.10.11.11. .Pp If you're using dynamic IP numbers, you must also put these two lines in the .Pa ppp.linkup -file. Then, once the link has been established and +file: + +.Bd -literal -offset indent +delete ALL +add 0 0 HISADDR +.Ed + +HISADDR is a macro meaning the "other side"s IP number, and is +available once an IP number has been agreed (using LCP). +Now, once a connection is established, .Nm ppp -knows the actual IP numbers in use, all previous (and probably incorrect) -entries are deleted and a default to the correct IP number is added. Use -the same label as the one used in +will delete all non-direct interface routes, and add a default route +pointing at the peers IP number. You should use the same label as the +one used in .Pa ppp.conf . .Pp If commands are being typed interactively, the only requirement is @@ -1385,9 +1395,13 @@ Close the current connection (but don't quit). .It delete ALL | dest [gateway [mask]] If .Dq ALL -is specified, all entries in the routing table created by +is specified, all non-direct entries in the routing for the interface +that .Nm -are deleted. Otherwise, any existing route with the given +is using are deleted. This means all entries for tunX, except the entry +representing the actual link. When +.Dq ALL +is not used, any existing route with the given .Dq dest , destination network .Dq mask diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index e5d5a87..7c10112 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.39 1997/06/13 03:59:35 brian Exp $ +.\" $Id: ppp.8,v 1.40 1997/06/16 13:52:10 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1146,29 +1146,39 @@ set ifaddr 10.10.10.10/0 10.10.11.11/0 255.255.255.0 .It In most cases, your ISP will also be your default router. If this is the case, add the lines + .Bd -literal -offset indent delete ALL add 0 0 10.10.11.11 .Ed + .Pp to .Pa ppp.conf . .Pp This tells .Nm -to delete all routing entries already made by -.Nm , -then to add a default route to HISADDR. HISADDR is a macro meaning the -"other side"s IP number. +to delete all non-direct routing entries for the tun interface that +.Nm +is running on, then to add a default route to 10.10.11.11. .Pp If you're using dynamic IP numbers, you must also put these two lines in the .Pa ppp.linkup -file. Then, once the link has been established and +file: + +.Bd -literal -offset indent +delete ALL +add 0 0 HISADDR +.Ed + +HISADDR is a macro meaning the "other side"s IP number, and is +available once an IP number has been agreed (using LCP). +Now, once a connection is established, .Nm ppp -knows the actual IP numbers in use, all previous (and probably incorrect) -entries are deleted and a default to the correct IP number is added. Use -the same label as the one used in +will delete all non-direct interface routes, and add a default route +pointing at the peers IP number. You should use the same label as the +one used in .Pa ppp.conf . .Pp If commands are being typed interactively, the only requirement is @@ -1385,9 +1395,13 @@ Close the current connection (but don't quit). .It delete ALL | dest [gateway [mask]] If .Dq ALL -is specified, all entries in the routing table created by +is specified, all non-direct entries in the routing for the interface +that .Nm -are deleted. Otherwise, any existing route with the given +is using are deleted. This means all entries for tunX, except the entry +representing the actual link. When +.Dq ALL +is not used, any existing route with the given .Dq dest , destination network .Dq mask diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index a88afa3..51c5ee9 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: route.c,v 1.14 1997/06/09 03:27:36 brian Exp $ + * $Id: route.c,v 1.15 1997/06/13 03:59:36 brian Exp $ * */ #include <sys/types.h> @@ -302,12 +302,13 @@ int all; rtm = (struct rt_msghdr *)cp; sa = (struct sockaddr *)(rtm + 1); LogPrintf(LogDEBUG, "DeleteIfRoutes: addrs: %x, index: %d, flags: %x," - " dstnet: %x\n", + " dstnet: %s\n", rtm->rtm_addrs, rtm->rtm_index, rtm->rtm_flags, - ((struct sockaddr_in *)sa)->sin_addr); + inet_ntoa(((struct sockaddr_in *)sa)->sin_addr)); if (rtm->rtm_addrs != RTA_DST && (rtm->rtm_index == IfIndex) && (all || (rtm->rtm_flags & RTF_GATEWAY))) { + LogPrintf(LogDEBUG, "DeleteIfRoutes: Remove it\n"); dstnet = ((struct sockaddr_in *)sa)->sin_addr; wp = (u_char *)cp + rtm->rtm_msglen; if (sa->sa_len == 0) @@ -327,19 +328,14 @@ int all; for (nb = 8 - *lp; nb > 0; nb--) mask <<= 8; } - LogPrintf(LogDEBUG, "DeleteIfRoutes: Dest: %s\n", inet_ntoa(dstnet)); + LogPrintf(LogDEBUG, "DeleteIfRoutes: Dst: %s\n", inet_ntoa(dstnet)); LogPrintf(LogDEBUG, "DeleteIfRoutes: Gw: %s\n", inet_ntoa(gateway)); LogPrintf(LogDEBUG, "DeleteIfRoutes: Index: %d\n", rtm->rtm_index); - if (dstnet.s_addr == INADDR_ANY) { - gateway.s_addr = INADDR_ANY; + if (dstnet.s_addr == INADDR_ANY) mask = INADDR_ANY; - } maddr.s_addr = htonl(mask); OsSetRoute(RTM_DELETE, dstnet, gateway, maddr); } - else if(rtm->rtm_index == IfIndex) - LogPrintf(LogDEBUG, "DeleteIfRoutes: Ignoring (looking for index %d)\n", - IfIndex); } free(sp); } |