summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-07-28 21:54:54 +0000
committerbrian <brian@FreeBSD.org>1998-07-28 21:54:54 +0000
commit9a2438b63a4a38c721d05e02835d87879878a435 (patch)
tree5182da44fc5e58e47102b8e3e5d1833f185a7ccc /usr.sbin/ppp
parenta8040b983130775d11758b3701ec79c170d7ef70 (diff)
downloadFreeBSD-src-9a2438b63a4a38c721d05e02835d87879878a435.zip
FreeBSD-src-9a2438b63a4a38c721d05e02835d87879878a435.tar.gz
Silence ``Network unreachable'' warnings when using
``add .... HISADDR''. The network will never be reachable at this point unless we're in -auto or reading the command from ppp.linkup. We can now run the following lines and get the expected results: set ifaddr 1.2.3.4/0 5.6.7.8/0 add default HISADDR where a route is added immediately in auto mode and the whole thing is delayed 'till the IP numbers have been agreed in other modes. Essentially, ppp.linkup is no longer required.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/bundle.c15
-rw-r--r--usr.sbin/ppp/bundle.h4
-rw-r--r--usr.sbin/ppp/command.c8
-rw-r--r--usr.sbin/ppp/route.c12
4 files changed, 20 insertions, 19 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 990a0c6..49e4c9c 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bundle.c,v 1.26 1998/06/27 14:17:23 brian Exp $
+ * $Id: bundle.c,v 1.27 1998/06/27 14:18:00 brian Exp $
*/
#include <sys/param.h>
@@ -952,7 +952,7 @@ struct rtmsg {
int
bundle_SetRoute(struct bundle *bundle, int cmd, struct in_addr dst,
- struct in_addr gateway, struct in_addr mask, int bang)
+ struct in_addr gateway, struct in_addr mask, int bang, int ssh)
{
struct rtmsg rtmes;
int s, nb, wb;
@@ -1052,12 +1052,13 @@ failed:
if (!bang)
log_Printf(LogWARN, "Del route failed: %s: Non-existent\n",
inet_ntoa(dst));
- } else if (rtmes.m_rtm.rtm_errno == 0)
- log_Printf(LogWARN, "%s route failed: %s: errno: %s\n", cmdstr,
- inet_ntoa(dst), strerror(errno));
- else
+ } else if (rtmes.m_rtm.rtm_errno == 0) {
+ if (!ssh || errno != ENETUNREACH)
+ log_Printf(LogWARN, "%s route failed: %s: errno: %s\n", cmdstr,
+ inet_ntoa(dst), strerror(errno));
+ } else
log_Printf(LogWARN, "%s route failed: %s: %s\n",
- cmdstr, inet_ntoa(dst), strerror(rtmes.m_rtm.rtm_errno));
+ cmdstr, inet_ntoa(dst), strerror(rtmes.m_rtm.rtm_errno));
}
log_Printf(LogDEBUG, "wrote %d: cmd = %s, dst = %x, gateway = %x\n",
wb, cmdstr, (unsigned)dst.s_addr, (unsigned)gateway.s_addr);
diff --git a/usr.sbin/ppp/bundle.h b/usr.sbin/ppp/bundle.h
index a7c8d70..8887f182 100644
--- a/usr.sbin/ppp/bundle.h
+++ b/usr.sbin/ppp/bundle.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bundle.h,v 1.8 1998/06/16 19:40:25 brian Exp $
+ * $Id: bundle.h,v 1.9 1998/06/27 14:17:24 brian Exp $
*/
#define PHASE_DEAD 0 /* Link is dead */
@@ -139,7 +139,7 @@ extern const char *bundle_PhaseName(struct bundle *);
extern void bundle_NewPhase(struct bundle *, u_int);
extern int bundle_LinkIsUp(const struct bundle *);
extern int bundle_SetRoute(struct bundle *, int, struct in_addr,
- struct in_addr, struct in_addr, int);
+ struct in_addr, struct in_addr, int, int);
extern void bundle_Close(struct bundle *, const char *, int);
extern void bundle_Down(struct bundle *, int);
extern void bundle_Open(struct bundle *, const char *, int);
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index ffae13f..69e5365 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.154 1998/07/04 22:03:56 brian Exp $
+ * $Id: command.c,v 1.155 1998/07/12 00:30:18 brian Exp $
*
*/
#include <sys/types.h>
@@ -122,7 +122,7 @@
#define NEG_DNS 50
const char Version[] = "2.0";
-const char VersionDate[] = "$Date: 1998/07/04 22:03:56 $";
+const char VersionDate[] = "$Date: 1998/07/12 00:30:18 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -1617,7 +1617,7 @@ AddCommand(struct cmdargs const *arg)
gateway = GetIpAddr(arg->argv[arg->argn+gw]);
if (bundle_SetRoute(arg->bundle, RTM_ADD, dest, gateway, netmask,
- arg->cmd->args ? 1 : 0))
+ arg->cmd->args ? 1 : 0, (addrs & ROUTE_GWHISADDR) ? 1 : 0))
route_Add(&arg->bundle->ncp.ipcp.route, addrs, dest, netmask, gateway);
return 0;
@@ -1650,7 +1650,7 @@ DeleteCommand(struct cmdargs const *arg)
}
none.s_addr = INADDR_ANY;
bundle_SetRoute(arg->bundle, RTM_DELETE, dest, none, none,
- arg->cmd->args ? 1 : 0);
+ arg->cmd->args ? 1 : 0, 0);
route_Delete(&arg->bundle->ncp.ipcp.route, addrs, dest);
}
} else
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c
index 5dc9061..0f7f019 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.50 1998/06/27 12:03:49 brian Exp $
+ * $Id: route.c,v 1.51 1998/06/27 23:48:53 brian Exp $
*
*/
@@ -410,7 +410,7 @@ route_IfDelete(struct bundle *bundle, int all)
if ((pass == 0 && (rtm->rtm_flags & RTF_WASCLONED)) ||
(pass == 1 && !(rtm->rtm_flags & RTF_WASCLONED))) {
log_Printf(LogDEBUG, "route_IfDelete: Remove it (pass %d)\n", pass);
- bundle_SetRoute(bundle, RTM_DELETE, sa_dst, sa_none, sa_none, 0);
+ bundle_SetRoute(bundle, RTM_DELETE, sa_dst, sa_none, sa_none, 0, 0);
} else
log_Printf(LogDEBUG, "route_IfDelete: Skip it (pass %d)\n", pass);
} else
@@ -448,19 +448,19 @@ route_Change(struct bundle *bundle, struct sticky_route *r,
for (; r; r = r->next) {
if ((r->type & ROUTE_DSTMYADDR) && r->dst.s_addr != me.s_addr) {
del.s_addr = r->dst.s_addr & r->mask.s_addr;
- bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1);
+ bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1, 0);
r->dst = me;
if (r->type & ROUTE_GWHISADDR)
r->gw = peer;
} else if ((r->type & ROUTE_DSTHISADDR) && r->dst.s_addr != peer.s_addr) {
del.s_addr = r->dst.s_addr & r->mask.s_addr;
- bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1);
+ bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1, 0);
r->dst = peer;
if (r->type & ROUTE_GWHISADDR)
r->gw = peer;
} else if ((r->type & ROUTE_GWHISADDR) && r->gw.s_addr != peer.s_addr)
r->gw = peer;
- bundle_SetRoute(bundle, RTM_ADD, r->dst, r->gw, r->mask, 1);
+ bundle_SetRoute(bundle, RTM_ADD, r->dst, r->gw, r->mask, 1, 0);
}
}
@@ -472,7 +472,7 @@ route_Clean(struct bundle *bundle, struct sticky_route *r)
none.s_addr = INADDR_ANY;
for (; r; r = r->next) {
del.s_addr = r->dst.s_addr & r->mask.s_addr;
- bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1);
+ bundle_SetRoute(bundle, RTM_DELETE, del, none, none, 1, 0);
}
}
OpenPOWER on IntegriCloud