SCCS-vsn: sbin/routed/main.c 4.11
SCCS-vsn: sbin/routed/startup.c 4.7
SCCS-vsn: sbin/routed/tables.c 4.10
#include <errno.h>
#include <nlist.h>
#include <signal.h>
#include <errno.h>
#include <nlist.h>
#include <signal.h>
int supplier = -1; /* process should supply updates */
extern int gateway;
int supplier = -1; /* process should supply updates */
extern int gateway;
+ openlog("routed", LOG_PID, 0);
sp = getservbyname("router", "udp");
if (sp == NULL) {
fprintf(stderr, "routed: router/udp: unknown service\n");
sp = getservbyname("router", "udp");
if (sp == NULL) {
fprintf(stderr, "routed: router/udp: unknown service\n");
toall(sendmsg);
signal(SIGALRM, timer);
signal(SIGHUP, hup);
toall(sendmsg);
signal(SIGALRM, timer);
signal(SIGHUP, hup);
int domain, type;
struct sockaddr_in *sin;
{
int domain, type;
struct sockaddr_in *sin;
{
retry = 1;
while ((s = socket(domain, type, 0, 0)) < 0 && retry) {
retry = 1;
while ((s = socket(domain, type, 0, 0)) < 0 && retry) {
sleep(5 * retry);
retry <<= 1;
}
sleep(5 * retry);
retry <<= 1;
}
+ if (retry == 0) {
+ syslog(LOG_ERR, "socket: %m");
+ }
+ if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
+ syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m");
+ exit(1);
+ }
while (bind(s, sin, sizeof (*sin), 0) < 0 && retry) {
perror("bind");
sleep(5 * retry);
retry <<= 1;
}
while (bind(s, sin, sizeof (*sin), 0) < 0 && retry) {
perror("bind");
sleep(5 * retry);
retry <<= 1;
}
+ if (retry == 0) {
+ syslog(LOG_ERR, "bind: %m");
-static char sccsid[] = "@(#)startup.c 4.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)startup.c 4.7 (Berkeley) %G%";
#include <sys/ioctl.h>
#include <net/if.h>
#include <nlist.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <nlist.h>
struct interface *ifnet;
int kmem = -1;
struct interface *ifnet;
int kmem = -1;
net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
dst = (struct sockaddr *)&net;
}
net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
dst = (struct sockaddr *)&net;
}
+ if (ifp->int_transitions++ > 0)
+ syslog(LOG_ERR, "re-installing interface %s", ifp->int_name);
rt = rtlookup(dst);
rtadd(dst, &ifp->int_addr, ifp->int_metric,
ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE));
rt = rtlookup(dst);
rtadd(dst, &ifp->int_addr, ifp->int_metric,
ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE));
-static char sccsid[] = "@(#)tables.c 4.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)tables.c 4.10 (Berkeley) %G%";
#include "defs.h"
#include <sys/ioctl.h>
#include <errno.h>
#include "defs.h"
#include <sys/ioctl.h>
#include <errno.h>
#ifndef DEBUG
#define DEBUG 0
#ifndef DEBUG
#define DEBUG 0
rt->rt_router = *gate;
}
rt->rt_metric = metric;
rt->rt_router = *gate;
}
rt->rt_metric = metric;
- rt->rt_state &= ~RTS_INTERFACE;
+ if ((rt->rt_state & RTS_INTERFACE) && metric) {
+ rt->rt_state &= ~RTS_INTERFACE;
+ syslog(LOG_ERR,
+ "deleting route to interface %s (timed out)",
+ rt->rt_ifp->int_name);
+ }
if (metric)
rt->rt_state |= RTF_GATEWAY;
rt->rt_state |= RTS_CHANGED;
if (metric)
rt->rt_state |= RTF_GATEWAY;
rt->rt_state |= RTS_CHANGED;
+ if (rt->rt_state & RTS_INTERFACE)
+ syslog(LOG_ERR, "deleting route to interface %s (timed out)",
+ rt->rt_ifp->int_name);
TRACE_ACTION(DELETE, rt);
if (install && ioctl(s, SIOCDELRT, (char *)&rt->rt_rt))
perror("SIOCDELRT");
TRACE_ACTION(DELETE, rt);
if (install && ioctl(s, SIOCDELRT, (char *)&rt->rt_rt))
perror("SIOCDELRT");