diff options
author | Bruce M Simpson <bms@FreeBSD.org> | 2004-02-25 23:20:22 +0000 |
---|---|---|
committer | Bruce M Simpson <bms@FreeBSD.org> | 2004-02-25 23:20:22 +0000 |
commit | caa79e368ec2cd0a6c85c7febfc8b6d26779b6c6 (patch) | |
tree | 6eb0dee436aa933f3e476b972023dbfa6a56b33e /sbin/routed/table.c | |
parent | 8b336df137952a0496f5e8d30747d009c939724e (diff) |
Notes
Diffstat (limited to 'sbin/routed/table.c')
-rw-r--r-- | sbin/routed/table.c | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/sbin/routed/table.c b/sbin/routed/table.c index 325139ff21b01..0c2c37507f7d0 100644 --- a/sbin/routed/table.c +++ b/sbin/routed/table.c @@ -33,12 +33,14 @@ #include "defs.h" -#if !defined(sgi) && !defined(__NetBSD__) -static char sccsid[] __attribute__((unused)) = "@(#)tables.c 8.1 (Berkeley) 6/5/93"; -#elif defined(__NetBSD__) +#ifdef __NetBSD__ __RCSID("$NetBSD$"); +#elif defined(__FreeBSD__) +__RCSID("$FreeBSD$"); +#else +__RCSID("$Revision: 2.27 $"); +#ident "$Revision: 2.27 $" #endif -#ident "$Revision: 2.22 $" static struct rt_spare *rts_better(struct rt_entry *); static struct rt_spare rts_empty = {0,0,0,HOPCNT_INFINITY,0,0,0}; @@ -251,8 +253,6 @@ ag_flush(naddr lim_dst_h, /* flush routes to here */ * then mark the suppressor redundant. */ if (ag_cors->ag_pref <= ag->ag_pref) { - if (ag_cors->ag_seqno > ag->ag_seqno) - ag_cors->ag_seqno = ag->ag_seqno; if (AG_IS_REDUN(ag->ag_state) && ag_cors->ag_mask==ag->ag_mask<<1) { if (ag_cors->ag_dst_h == dst_h) @@ -287,7 +287,7 @@ ag_check(naddr dst, naddr nhop, char metric, char pref, - u_int seqno, + u_int new_seqno, u_short tag, u_short state, void (*out)(struct ag_info *)) /* output using this */ @@ -314,7 +314,7 @@ ag_check(naddr dst, nc_ag.ag_pref = pref; nc_ag.ag_tag = tag; nc_ag.ag_state = state; - nc_ag.ag_seqno = seqno; + nc_ag.ag_seqno = new_seqno; out(&nc_ag); return; } @@ -344,8 +344,6 @@ ag_check(naddr dst, && (ag_cors->ag_gate == ag->ag_gate || (ag->ag_state & AGS_FINE_GATE) || (ag_cors->ag_state & AGS_CORS_GATE))) { - if (ag_cors->ag_seqno > ag->ag_seqno) - ag_cors->ag_seqno = ag->ag_seqno; /* If the suppressed target was redundant, * then mark the suppressor redundant. */ @@ -404,17 +402,13 @@ ag_check(naddr dst, ag->ag_tag = tag; ag->ag_metric = metric; ag->ag_pref = pref; + if (ag->ag_seqno < new_seqno) + ag->ag_seqno = new_seqno; x = ag->ag_state; ag->ag_state = state; state = x; } - /* The sequence number controls flash updating, - * and should be the smaller of the two. - */ - if (ag->ag_seqno > seqno) - ag->ag_seqno = seqno; - /* Some bits are set if they are set on either route, * except when the route is for an interface. */ @@ -454,8 +448,8 @@ ag_check(naddr dst, * * Combine and promote (aggregate) the pair of routes. */ - if (seqno > ag->ag_seqno) - seqno = ag->ag_seqno; + if (new_seqno < ag->ag_seqno) + new_seqno = ag->ag_seqno; if (!AG_IS_REDUN(state)) state &= ~AGS_REDUN1; if (AG_IS_REDUN(ag->ag_state)) @@ -516,10 +510,10 @@ ag_check(naddr dst, pref = x; /* take the newest sequence number */ - if (seqno >= ag->ag_seqno) - seqno = ag->ag_seqno; + if (new_seqno <= ag->ag_seqno) + new_seqno = ag->ag_seqno; else - ag->ag_seqno = seqno; + ag->ag_seqno = new_seqno; } else { if (!(state & AGS_AGGREGATE)) @@ -535,10 +529,10 @@ ag_check(naddr dst, if (!AG_IS_REDUN(state)) state &= ~AGS_REDUN1; state &= ~AGS_REDUN0; - if (seqno > ag->ag_seqno) - seqno = ag->ag_seqno; + if (new_seqno < ag->ag_seqno) + new_seqno = ag->ag_seqno; else - ag->ag_seqno = seqno; + ag->ag_seqno = new_seqno; } mask <<= 1; @@ -599,7 +593,7 @@ ag_check(naddr dst, nag->ag_pref = pref; nag->ag_tag = tag; nag->ag_state = state; - nag->ag_seqno = seqno; + nag->ag_seqno = new_seqno; nag->ag_fine = ag; if (ag != 0) @@ -632,6 +626,9 @@ rtm_type_name(u_char type) "RTM_RESOLVE", "RTM_NEWADDR", "RTM_DELADDR", +#ifdef RTM_OIFINFO + "RTM_OIFINFO", +#endif "RTM_IFINFO", "RTM_NEWMADDR", "RTM_DELMADDR" @@ -1011,7 +1008,7 @@ rtm_lose(struct rt_msghdr *rtm, */ static int get_info_gate(struct sockaddr **sap, - struct sockaddr_in *sin) + struct sockaddr_in *rsin) { struct sockaddr_dl *sdl = (struct sockaddr_dl *)*sap; struct interface *ifp; @@ -1027,12 +1024,12 @@ get_info_gate(struct sockaddr **sap, if (ifp == 0) return 0; - sin->sin_addr.s_addr = ifp->int_addr; + rsin->sin_addr.s_addr = ifp->int_addr; #ifdef _HAVE_SA_LEN - sin->sin_len = sizeof(*sin); + rsin->sin_len = sizeof(*rsin); #endif - sin->sin_family = AF_INET; - *sap = (struct sockaddr*)sin; + rsin->sin_family = AF_INET; + *sap = (struct sockaddr*)rsin; return 1; } @@ -1113,6 +1110,13 @@ flush_kern(void) if (rtm->rtm_flags & RTF_LLINFO) continue; +#if defined(RTF_CLONED) && defined(__bsdi__) + /* ignore cloned routes + */ + if (rtm->rtm_flags & RTF_CLONED) + continue; +#endif + /* ignore multicast addresses */ if (IN_MULTICAST(ntohl(S_ADDR(INFO_DST(&info))))) @@ -1220,6 +1224,10 @@ read_rt(void) ifinit_timer.tv_sec = now.tv_sec; continue; } +#ifdef RTM_OIFINFO + if (m.r.rtm.rtm_type == RTM_OIFINFO) + continue; /* ignore compat message */ +#endif strcpy(str, rtm_type_name(m.r.rtm.rtm_type)); strp = &str[strlen(str)]; @@ -1259,6 +1267,13 @@ read_rt(void) continue; } +#if defined(RTF_CLONED) && defined(__bsdi__) + if (m.r.rtm.rtm_flags & RTF_CLONED) { + trace_act("ignore cloned %s", str); + continue; + } +#endif + if (get_info_gate(&INFO_GATE(&info), &gate_sin)) { gate = S_ADDR(INFO_GATE(&info)); strp += sprintf(strp, " --> %s", naddr_ntoa(gate)); |