6875276 in.routed dropping default route on s10u6
6885348 in.routed's makefile needs ctf information
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile Thu Sep 24 07:28:12 2009 -0700
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/Makefile Thu Sep 24 11:59:50 2009 -0400
@@ -1,7 +1,6 @@
#
-# ident "%Z%%M% %I% %E% SMI"
#
-# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -57,6 +56,11 @@
# suppression directive on SPARC.
LINTFLAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
+CTFCONVERT_HOOK = && $(CTFCONVERT_O)
+CTFMERGE_HOOK = && $(CTFMERGE) -L VERSION -o $@ $(ROUTEDOBJS)
+$(ROUTEDOBJS) := CFLAGS += $(CTF_FLAGS)
+$(RTQUERYOBJS) := CFLAGS += $(CTF_FLAGS)
+
.KEEP_STATE:
.PARALLEL: $(ROUTEDPROG) $(RTQUERYOBJS)
@@ -68,11 +72,11 @@
cat $(POFILES) > $@
$(ROUTEDPROG): $(ROUTEDOBJS)
- $(LINK.c) -o $@ $(ROUTEDOBJS) $(LDLIBS)
+ $(LINK.c) -o $@ $(ROUTEDOBJS) $(LDLIBS) $(CTFMERGE_HOOK)
$(POST_PROCESS)
$(RTQUERYPROG): $(RTQUERYOBJS)
- $(LINK.c) -o $@ $(RTQUERYOBJS) $(LDLIBS) -lresolv
+ $(LINK.c) -o $@ $(RTQUERYOBJS) $(LDLIBS) -lresolv $(CTFMERGE_HOOK)
$(POST_PROCESS)
lint:
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c Thu Sep 24 07:28:12 2009 -0700
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c Thu Sep 24 11:59:50 2009 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 1983, 1988, 1993
@@ -1228,6 +1228,10 @@
static void
rtm_lose(struct rt_msghdr *rtm, struct rt_addrinfo *info)
{
+ struct rt_spare new, *rts, *losing_rts = NULL;
+ struct rt_entry *rt;
+ int i, spares;
+
if (INFO_GATE(info) == NULL || INFO_GATE(info)->ss_family != AF_INET) {
trace_act("ignore %s without gateway",
rtm_type_name(rtm->rtm_type));
@@ -1235,6 +1239,36 @@
return;
}
+ rt = rtfind(S_ADDR(INFO_DST(info)));
+ if (rt != NULL) {
+ spares = 0;
+ for (i = 0; i < rt->rt_num_spares; i++) {
+ rts = &rt->rt_spares[i];
+ if (rts->rts_gate == S_ADDR(INFO_GATE(info))) {
+ losing_rts = rts;
+ continue;
+ }
+ if (rts->rts_gate != 0 && rts->rts_ifp != &dummy_ifp)
+ spares++;
+ }
+ }
+ if (rt == NULL || losing_rts == NULL) {
+ trace_act("Ignore RTM_LOSING because no route found"
+ " for %s through %s",
+ naddr_ntoa(S_ADDR(INFO_DST(info))),
+ naddr_ntoa(S_ADDR(INFO_GATE(info))));
+ return;
+ }
+ if (spares == 0) {
+ trace_act("Got RTM_LOSING, but no alternatives to gw %s."
+ " deprecating route to metric 15",
+ naddr_ntoa(S_ADDR(INFO_GATE(info))));
+ new = *losing_rts;
+ new.rts_metric = HOPCNT_INFINITY - 1;
+ rtchange(rt, rt->rt_state, &new, 0);
+ return;
+ }
+ trace_act("Got RTM_LOSING. Found a route with %d alternates", spares);
if (rdisc_ok)
rdisc_age(S_ADDR(INFO_GATE(info)));
age(S_ADDR(INFO_GATE(info)));
@@ -2255,7 +2289,6 @@
return ((struct rt_entry *)rhead->rnh_matchaddr(&dst_sock, rhead));
}
-
/* add a route to the table */
void
rtadd(in_addr_t dst,