diff --git a/sys/net/if.h b/sys/net/if.h index 5873dffaf80f..323181eb960f 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $Id: if.h,v 1.9 1994/11/15 14:41:34 bde Exp $ + * $Id: if.h,v 1.10 1994/11/16 02:16:18 phk Exp $ */ #ifndef _NET_IF_H_ @@ -101,6 +101,7 @@ struct ifnet { struct if_data { /* generic interface information */ u_char ifi_type; /* ethernet, tokenring, etc */ + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ u_char ifi_addrlen; /* media address length */ u_char ifi_hdrlen; /* media header length */ u_long ifi_mtu; /* maximum transmission unit */ @@ -146,6 +147,7 @@ struct ifnet { }; #define if_mtu if_data.ifi_mtu #define if_type if_data.ifi_type +#define if_physical if_data.ifi_physical #define if_addrlen if_data.ifi_addrlen #define if_hdrlen if_data.ifi_hdrlen #define if_metric if_data.ifi_metric @@ -186,6 +188,16 @@ struct ifnet { (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) + +/* + * These really don't belong here, but there's no other obviously appropriate + * location. + */ +#define IFP_AUI 0 +#define IFP_10BASE2 1 +#define IFP_10BASET 2 +/* etc. */ + /* * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) * input routines have queues of messages stored on ifqueue structures diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index b1dea7707ce7..978557b74a53 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 - * $Id: if_ethersubr.c,v 1.3 1994/10/11 23:16:24 wollman Exp $ + * $Id: if_ethersubr.c,v 1.4 1994/11/24 14:29:38 davidg Exp $ */ #include @@ -114,7 +114,7 @@ ether_output(ifp, m0, dst, rt0) ifp->if_lastchange = time; if (rt = rt0) { if ((rt->rt_flags & RTF_UP) == 0) { - if (rt0 = rt = rtalloc1(dst, 1)) + if (rt0 = rt = rtalloc1(dst, 1, 0UL)) rt->rt_refcnt--; else senderr(EHOSTUNREACH); @@ -124,7 +124,8 @@ ether_output(ifp, m0, dst, rt0) goto lookup; if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) { rtfree(rt); rt = rt0; - lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1); + lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, + 0UL); if ((rt = rt->rt_gwroute) == 0) senderr(EHOSTUNREACH); } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index a45f5aaa3d95..caf643ee9735 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -380,6 +380,7 @@ int sppp_output (struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct h->protocol = htons (PPP_ISO); break; #endif +nosupport: default: m_freem (m); splx (s); diff --git a/sys/net/route.c b/sys/net/route.c index 7e9cffbca35a..f5f5350f59c4 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)route.c 8.2 (Berkeley) 11/15/93 - * $Id: route.c,v 1.10 1994/11/02 04:41:25 wollman Exp $ + * $Id: route.c,v 1.11 1994/11/03 01:04:30 wollman Exp $ */ #include @@ -88,25 +88,28 @@ rtalloc(ro) { if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) return; /* XXX */ - ro->ro_rt = rtalloc1(&ro->ro_dst, 1); + ro->ro_rt = rtalloc1(&ro->ro_dst, 1, 0UL); } struct rtentry * -rtalloc1(dst, report) +rtalloc1(dst, report, ignflags) register struct sockaddr *dst; int report; + u_long ignflags; { register struct radix_node_head *rnh = rt_tables[dst->sa_family]; register struct rtentry *rt; register struct radix_node *rn; struct rtentry *newrt = 0; struct rt_addrinfo info; + u_long nflags; int s = splnet(), err = 0, msgtype = RTM_MISS; if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = rt = (struct rtentry *)rn; - if (report && (rt->rt_flags & RTF_CLONING)) { + nflags = rt->rt_flags & ~ignflags; + if (report && (nflags & (RTF_CLONING | RTF_PRCLONING))) { err = rtrequest(RTM_RESOLVE, dst, SA(0), SA(0), 0, &newrt); if (err) { @@ -199,7 +202,7 @@ rtredirect(dst, gateway, netmask, flags, src, rtp) error = ENETUNREACH; goto out; } - rt = rtalloc1(dst, 0); + rt = rtalloc1(dst, 0, 0UL); /* * If the redirect isn't from our current router for this dst, * it's either old or wrong. If it redirects us to ourselves, @@ -319,7 +322,7 @@ ifa_ifwithroute(flags, dst, gateway) if (ifa == 0) ifa = ifa_ifwithnet(gateway); if (ifa == 0) { - struct rtentry *rt = rtalloc1(dst, 0); + struct rtentry *rt = rtalloc1(dst, 0, 0UL); if (rt == 0) return (0); rt->rt_refcnt--; @@ -383,8 +386,8 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt) if (ret_nrt == 0 || (rt = *ret_nrt) == 0) senderr(EINVAL); ifa = rt->rt_ifa; - flags = rt->rt_flags & ~RTF_CLONING; - prflags = rt->rt_prflags | RTPRF_WASCLONED; + flags = rt->rt_flags & ~(RTF_CLONING | RTF_PRCLONING); + flags |= RTF_WASCLONED; gateway = rt->rt_gateway; if ((netmask = rt->rt_genmask) == 0) flags |= RTF_HOST; @@ -407,7 +410,6 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt) senderr(ENOBUFS); Bzero(rt, sizeof(*rt)); rt->rt_flags = RTF_UP | flags; - rt->rt_prflags = prflags; if (rt_setgate(rt, dst, gateway)) { Free(rt); senderr(ENOBUFS); @@ -473,7 +475,7 @@ rt_setgate(rt0, dst, gate) rt = rt0; rt->rt_gwroute = 0; } if (rt->rt_flags & RTF_GATEWAY) { - rt->rt_gwroute = rtalloc1(gate, 1); + rt->rt_gwroute = rtalloc1(gate, 1, 0UL); } return 0; } @@ -522,7 +524,7 @@ rtinit(ifa, cmd, flags) rt_maskedcopy(dst, deldst, ifa->ifa_netmask); dst = deldst; } - rt = rtalloc1(dst, 0); + rt = rtalloc1(dst, 0, 0UL); if (rt) { rt->rt_refcnt--; if (rt->rt_ifa != ifa) { diff --git a/sys/net/route.h b/sys/net/route.h index 03ac9a5e3ffb..67711137a478 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)route.h 8.3 (Berkeley) 4/19/94 - * $Id: route.h,v 1.4 1994/08/21 05:11:46 paul Exp $ + * $Id: route.h,v 1.5 1994/11/03 01:04:32 wollman Exp $ */ #ifndef _NET_ROUTE_H_ @@ -69,6 +69,8 @@ struct rt_metrics { u_long rmx_rtt; /* estimated round trip time */ u_long rmx_rttvar; /* estimated rtt variance */ u_long rmx_pksent; /* packets sent using this route */ + u_long rmx_ttcp_cc; /* cached last T/TCP CC option rcvd */ + u_long rmx_ttcp_ccsent; /* cached last T/TCP CC option sent */ }; /* @@ -96,15 +98,16 @@ struct rtentry { #define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) struct sockaddr *rt_gateway; /* value */ /* XXX - rt_flags should be unified with rt_prflags */ - short rt_flags; /* up/down?, host/net */ + short rt_filler; /* up/down?, host/net */ short rt_refcnt; /* # held references */ - u_long rt_prflags; /* protocol-specific flags */ + u_long rt_flags; /* protocol-specific flags */ struct ifnet *rt_ifp; /* the answer: interface to use */ struct ifaddr *rt_ifa; /* the answer: interface to use */ struct sockaddr *rt_genmask; /* for generation of cloned routes */ caddr_t rt_llinfo; /* pointer to link level info cache */ struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ + int (*rt_output) __P(()); /* output routine for this (rt,if) */ }; /* @@ -139,7 +142,10 @@ struct ortentry { #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ -#define RTPRF_WASCLONED 0x1 /* route generated through cloning */ +#define RTF_PRCLONING 0x10000 /* protocol requires cloning */ +#define RTF_WASCLONED 0x20000 /* route generated through cloning */ +#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ + /* 0x80000 and up unassigned */ /* * Routing statistics. @@ -169,7 +175,7 @@ struct rt_msghdr { struct rt_metrics rtm_rmx; /* metrics themselves */ }; -#define RTM_VERSION 3 /* Up the ante and ignore older versions */ +#define RTM_VERSION 4 /* Up the ante and ignore older versions */ #define RTM_ADD 0x1 /* Add Route */ #define RTM_DELETE 0x2 /* Delete Route */ @@ -257,8 +263,9 @@ int rt_setgate __P((struct rtentry *, void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *)); void rtable_init __P((void **)); void rtalloc __P((struct route *)); +void rtalloc_ign __P((struct route *, unsigned long)); struct rtentry * - rtalloc1 __P((struct sockaddr *, int)); + rtalloc1 __P((struct sockaddr *, int, unsigned long)); void rtfree __P((struct rtentry *)); int rtinit __P((struct ifaddr *, int, int)); int rtioctl __P((int, caddr_t, struct proc *)); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index d482a9796ee0..d73604e269dd 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)rtsock.c 8.3 (Berkeley) 1/4/94 - * $Id: rtsock.c,v 1.6 1994/10/08 22:38:26 phk Exp $ + * $Id: rtsock.c,v 1.7 1994/10/11 23:16:29 wollman Exp $ */ #include @@ -196,7 +196,7 @@ route_output(m, so) case RTM_GET: case RTM_CHANGE: case RTM_LOCK: - rt = rtalloc1(dst, 0); + rt = rtalloc1(dst, 0, 0UL); if (rt == 0) senderr(ESRCH); if (rtm->rtm_type != RTM_GET) {/* XXX: too grotty */