- (*output)(sto, sa, (char *)n - packet);
-}
-
-/*
- * Respond to a routing info request.
- */
-rip_respond(from, size)
- struct sockaddr *from;
- int size;
-{
- struct netinfo *np = msg->rip_nets;
- struct rt_entry *rt;
- int newsize = 0;
-
- size -= 4 * sizeof (char);
- while (size > 0) {
- if (size < sizeof (struct netinfo))
- break;
- size -= sizeof (struct netinfo);
- if (np->rip_dst.sa_family == AF_UNSPEC &&
- np->rip_metric == HOPCNT_INFINITY && size == 0) {
- supply(s, from);
- return;
- }
- rt = rtlookup(&np->rip_dst);
- np->rip_metric = rt == 0 ?
- HOPCNT_INFINITY : min(rt->rt_metric+1, HOPCNT_INFINITY);
- np++, newsize += sizeof (struct netinfo);
- }
- if (newsize > 0) {
- msg->rip_cmd = RIPCMD_RESPONSE;
- newsize += sizeof (int);
- (*afswitch[from->sa_family].af_output)(s, from, newsize);
- }