mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
Fix "delete all".
PR: 3913
This commit is contained in:
parent
b1d8279802
commit
9b5a20e10a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26754
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user