SCCS-vsn: sbin/routed/inet.c 5.4
SCCS-vsn: sbin/routed/input.c 5.6
SCCS-vsn: sbin/routed/startup.c 5.6
-static char sccsid[] = "@(#)inet.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet.c 5.4 (Berkeley) %G%";
host = i & IN_CLASSC_HOST;
}
host = i & IN_CLASSC_HOST;
}
- if (host == 0)
- return (0); /* network */
/*
* Check whether this network is subnetted;
* if so, check whether this is a subnet or a host.
*/
for (ifp = ifnet; ifp; ifp = ifp->int_next)
if (net == ifp->int_net) {
/*
* Check whether this network is subnetted;
* if so, check whether this is a subnet or a host.
*/
for (ifp = ifnet; ifp; ifp = ifp->int_next)
if (net == ifp->int_net) {
- if ((host &~ ifp->int_subnetmask) == 0)
+ if (host &~ ifp->int_subnetmask)
+ return (RTF_HOST);
+ else if (ifp->int_subnetmask != ifp->int_netmask)
return (RTF_SUBNET);
else
return (RTF_SUBNET);
else
+ return (0); /* network */
+ if (host == 0)
+ return (0); /* network */
+ else
+ return (RTF_HOST);
- * Return true if a route to subnet rtsin should be sent to dst.
+ * Return true if a route to subnet of route rt should be sent to dst.
* Send it only if dst is on the same logical network,
* Send it only if dst is on the same logical network,
- * or the route turns out to be for the net (aka subnet 0).
+ * or the route is the "internal" route for the net.
*/
inet_sendsubnet(rt, dst)
struct rt_entry *rt;
*/
inet_sendsubnet(rt, dst)
struct rt_entry *rt;
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
- return ((r & IN_CLASSA_HOST) == 0);
+ if (r & IN_CLASSA_HOST)
+ return (0);
+ return ((rt->rt_state & RTS_INTERNAL) != 0);
} else if (IN_CLASSB(r)) {
if ((r & IN_CLASSB_NET) == (d & IN_CLASSB_NET)) {
if ((r & IN_CLASSB_HOST) == 0)
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
} else if (IN_CLASSB(r)) {
if ((r & IN_CLASSB_NET) == (d & IN_CLASSB_NET)) {
if ((r & IN_CLASSB_HOST) == 0)
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
- return ((r & IN_CLASSB_HOST) == 0);
+ if (r & IN_CLASSB_HOST)
+ return (0);
+ return ((rt->rt_state & RTS_INTERNAL) != 0);
} else {
if ((r & IN_CLASSC_NET) == (d & IN_CLASSC_NET)) {
if ((r & IN_CLASSC_HOST) == 0)
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
} else {
if ((r & IN_CLASSC_NET) == (d & IN_CLASSC_NET)) {
if ((r & IN_CLASSC_HOST) == 0)
return ((rt->rt_state & RTS_INTERNAL) == 0);
return (1);
}
- return ((r & IN_CLASSC_HOST) == 0);
+ if (r & IN_CLASSC_HOST)
+ return (0);
+ return ((rt->rt_state & RTS_INTERNAL) != 0);
-static char sccsid[] = "@(#)input.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)input.c 5.6 (Berkeley) %G%";
continue;
}
rt = rtlookup(&n->rip_dst);
continue;
}
rt = rtlookup(&n->rip_dst);
+ if (rt == 0 ||
+ (rt->rt_state & (RTS_INTERNAL|RTS_INTERFACE)) ==
+ (RTS_INTERNAL|RTS_INTERFACE)) {
rt = rtfind(&n->rip_dst);
if (rt && equal(from, &rt->rt_router) &&
rt->rt_metric == n->rip_metric)
rt = rtfind(&n->rip_dst);
if (rt && equal(from, &rt->rt_router) &&
rt->rt_metric == n->rip_metric)
-static char sccsid[] = "@(#)startup.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)startup.c 5.6 (Berkeley) %G%";
if ((ifp->int_flags & (IFF_SUBNET|IFF_POINTOPOINT)) == IFF_SUBNET) {
net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
rt = rtfind(dst);
if ((ifp->int_flags & (IFF_SUBNET|IFF_POINTOPOINT)) == IFF_SUBNET) {
net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
rt = rtfind(dst);
- if (rt && (rt->rt_state & RTS_INTERFACE))
+ if (rt && (rt->rt_state & (RTS_INTERNAL | RTS_INTERFACE)) ==
+ (RTS_INTERNAL | RTS_INTERFACE))
return;
rtadd(dst, &ifp->int_addr, ifp->int_metric,
return;
rtadd(dst, &ifp->int_addr, ifp->int_metric,
- (ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE) |
- RTS_INTERNAL | RTS_SUBNET));
+ ((ifp->int_flags & (IFF_INTERFACE|IFF_REMOTE)) |
+ RTS_PASSIVE | RTS_INTERNAL | RTS_SUBNET));