projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rework interface metrics to invert perspective; other misc. fixes
[unix-history]
/
usr
/
src
/
sbin
/
routed
/
output.c
diff --git
a/usr/src/sbin/routed/output.c
b/usr/src/sbin/routed/output.c
index
09ec259
..
0a963b2
100644
(file)
--- a/
usr/src/sbin/routed/output.c
+++ b/
usr/src/sbin/routed/output.c
@@
-5,7
+5,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)output.c 5.
2
(Berkeley) %G%";
+static char sccsid[] = "@(#)output.c 5.
7
(Berkeley) %G%";
#endif not lint
/*
#endif not lint
/*
@@
-60,15
+60,16
@@
sendmsg(dst, flags, ifp)
supply(dst, flags, ifp)
struct sockaddr *dst;
int flags;
supply(dst, flags, ifp)
struct sockaddr *dst;
int flags;
- struct interface *ifp;
+
register
struct interface *ifp;
{
register struct rt_entry *rt;
{
register struct rt_entry *rt;
- struct netinfo *n = msg->rip_nets;
+
register
struct netinfo *n = msg->rip_nets;
register struct rthash *rh;
struct rthash *base = hosthash;
int doinghost = 1, size;
int (*output)() = afswitch[dst->sa_family].af_output;
register struct rthash *rh;
struct rthash *base = hosthash;
int doinghost = 1, size;
int (*output)() = afswitch[dst->sa_family].af_output;
- int (*sendsubnet)() = afswitch[dst->sa_family].af_sendsubnet;
+ int (*sendroute)() = afswitch[dst->sa_family].af_sendroute;
+ int npackets = 0;
msg->rip_cmd = RIPCMD_RESPONSE;
msg->rip_vers = RIPVERSION;
msg->rip_cmd = RIPCMD_RESPONSE;
msg->rip_vers = RIPVERSION;
@@
-76,10
+77,12
@@
again:
for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++)
for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
/*
for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++)
for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
/*
- * Don't resend the information
- * on the network from which it was received.
+ * Don't resend the information on the network
+ * from which it was received (unless sending
+ * in response to a query).
*/
*/
- if (ifp && rt->rt_ifp == ifp)
+ if (ifp && rt->rt_ifp == ifp &&
+ (rt->rt_state & RTS_INTERFACE) == 0)
continue;
if (rt->rt_state & RTS_EXTERNAL)
continue;
continue;
if (rt->rt_state & RTS_EXTERNAL)
continue;
@@
-88,11
+91,9
@@
again:
* to those who are interested.
*/
if (doinghost == 0 && rt->rt_state & RTS_SUBNET) {
* to those who are interested.
*/
if (doinghost == 0 && rt->rt_state & RTS_SUBNET) {
- if (ifp && (ifp->int_flags & IFF_SUBNET) == 0)
- continue;
if (rt->rt_dst.sa_family != dst->sa_family)
continue;
if (rt->rt_dst.sa_family != dst->sa_family)
continue;
- if ((*send
subnet)(&rt->rt_ds
t, dst) == 0)
+ if ((*send
route)(r
t, dst) == 0)
continue;
}
size = (char *)n - packet;
continue;
}
size = (char *)n - packet;
@@
-100,6
+101,7
@@
again:
(*output)(s, flags, dst, size);
TRACE_OUTPUT(ifp, dst, size);
n = msg->rip_nets;
(*output)(s, flags, dst, size);
TRACE_OUTPUT(ifp, dst, size);
n = msg->rip_nets;
+ npackets++;
}
n->rip_dst = rt->rt_dst;
n->rip_dst.sa_family = htons(n->rip_dst.sa_family);
}
n->rip_dst = rt->rt_dst;
n->rip_dst.sa_family = htons(n->rip_dst.sa_family);
@@
-111,7
+113,7
@@
again:
base = nethash;
goto again;
}
base = nethash;
goto again;
}
- if (n != msg->rip_nets) {
+ if (n != msg->rip_nets
|| npackets == 0
) {
size = (char *)n - packet;
(*output)(s, flags, dst, size);
TRACE_OUTPUT(ifp, dst, size);
size = (char *)n - packet;
(*output)(s, flags, dst, size);
TRACE_OUTPUT(ifp, dst, size);