Date: Thu, 16 Apr 2009 20:30:28 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191148 - in head/sys: contrib/ipfilter/netinet contrib/pf/net dev/iicbus dev/lmc dev/ppbus net net80211 netgraph netinet netinet6 netipx Message-ID: <200904162030.n3GKUSm6090918@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Thu Apr 16 20:30:28 2009 New Revision: 191148 URL: http://svn.freebsd.org/changeset/base/191148 Log: Change if_output to take a struct route as its fourth argument in order to allow passing a cached struct llentry * down to L2 Reviewed by: rwatson Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/pf/net/if_pflog.c head/sys/contrib/pf/net/if_pfsync.c head/sys/contrib/pf/net/pf.c head/sys/dev/iicbus/if_ic.c head/sys/dev/lmc/if_lmc.c head/sys/dev/lmc/if_lmc.h head/sys/dev/ppbus/if_plip.c head/sys/net/ethernet.h head/sys/net/if_arc.h head/sys/net/if_arcsubr.c head/sys/net/if_atm.h head/sys/net/if_atmsubr.c head/sys/net/if_disc.c head/sys/net/if_enc.c head/sys/net/if_ethersubr.c head/sys/net/if_faith.c head/sys/net/if_fddisubr.c head/sys/net/if_fwsubr.c head/sys/net/if_gif.c head/sys/net/if_gif.h head/sys/net/if_gre.c head/sys/net/if_iso88025subr.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h head/sys/net/if_loop.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/net/if_tun.c head/sys/net/if_var.h head/sys/net/iso88025.h head/sys/net/route.h head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h head/sys/net80211/ieee80211_var.h head/sys/netgraph/ng_fec.c head/sys/netgraph/ng_iface.c head/sys/netinet/if_ether.c head/sys/netinet/ip_carp.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_output.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netipx/ipx_outputfl.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Apr 16 20:30:28 2009 (r191148) @@ -1046,7 +1046,7 @@ frdest_t *fdp; if (!ip->ip_sum) ip->ip_sum = in_cksum(m, hlen); error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, - ro->ro_rt); + ro); goto done; } /* @@ -1127,7 +1127,7 @@ sendorfree: m->m_act = 0; if (error == 0) error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); + (struct sockaddr *)dst, ro); else FREE_MB_T(m); } Modified: head/sys/contrib/pf/net/if_pflog.c ============================================================================== --- head/sys/contrib/pf/net/if_pflog.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/contrib/pf/net/if_pflog.c Thu Apr 16 20:30:28 2009 (r191148) @@ -113,7 +113,7 @@ __FBSDID("$FreeBSD$"); void pflogattach(int); int pflogoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); int pflogioctl(struct ifnet *, u_long, caddr_t); void pflogstart(struct ifnet *); #ifdef __FreeBSD__ @@ -287,7 +287,7 @@ pflogstart(struct ifnet *ifp) int pflogoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { m_freem(m); return (0); Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/contrib/pf/net/if_pfsync.c Thu Apr 16 20:30:28 2009 (r191148) @@ -152,7 +152,7 @@ int pfsync_insert_net_state(struct pfsyn void pfsync_update_net_tdb(struct pfsync_tdb *); #endif int pfsyncoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); int pfsyncioctl(struct ifnet *, u_long, caddr_t); void pfsyncstart(struct ifnet *); @@ -1083,7 +1083,7 @@ done: int pfsyncoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { m_freem(m); return (0); Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/contrib/pf/net/pf.c Thu Apr 16 20:30:28 2009 (r191148) @@ -6245,7 +6245,7 @@ pf_route(struct mbuf **m, struct pf_rule } } PF_UNLOCK(); - error = (*ifp->if_output)(ifp, m0, sintosa(dst), ro->ro_rt); + error = (*ifp->if_output)(ifp, m0, sintosa(dst), ro); PF_LOCK(); goto done; } Modified: head/sys/dev/iicbus/if_ic.c ============================================================================== --- head/sys/dev/iicbus/if_ic.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/dev/iicbus/if_ic.c Thu Apr 16 20:30:28 2009 (r191148) @@ -103,7 +103,7 @@ static int icattach(device_t); static int icioctl(struct ifnet *, u_long, caddr_t); static int icoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static int icintr(device_t, int, char *); @@ -354,7 +354,7 @@ icintr(device_t dev, int event, char *pt */ static int icoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { struct ic_softc *sc = ifp->if_softc; device_t icdev = sc->ic_dev; Modified: head/sys/dev/lmc/if_lmc.c ============================================================================== --- head/sys/dev/lmc/if_lmc.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/dev/lmc/if_lmc.c Thu Apr 16 20:30:28 2009 (r191148) @@ -114,6 +114,7 @@ # include <net/if_types.h> # include <net/if_media.h> # include <net/netisr.h> +# include <net/route.h> # include <machine/bus.h> # include <machine/resource.h> # include <sys/rman.h> @@ -4583,7 +4584,7 @@ lmc_ifnet_start(struct ifnet *ifp) /* Called from a syscall (user context; no spinlocks). */ static int lmc_raw_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt) + struct sockaddr *dst, struct route *ro) { softc_t *sc = IFP2SC(ifp); int error = 0; Modified: head/sys/dev/lmc/if_lmc.h ============================================================================== --- head/sys/dev/lmc/if_lmc.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/dev/lmc/if_lmc.h Thu Apr 16 20:30:28 2009 (r191148) @@ -1595,7 +1595,7 @@ static int lmc_raw_ioctl(struct ifnet *, static int lmc_ifnet_ioctl(struct ifnet *, u_long, caddr_t); static void lmc_ifnet_start(struct ifnet *); static int lmc_raw_output(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *); static void lmc_ifnet_watchdog(struct ifnet *); # ifdef __OpenBSD__ static int ifmedia_change(struct ifnet *); Modified: head/sys/dev/ppbus/if_plip.c ============================================================================== --- head/sys/dev/ppbus/if_plip.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/dev/ppbus/if_plip.c Thu Apr 16 20:30:28 2009 (r191148) @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <net/if_types.h> #include <net/netisr.h> +#include <net/route.h> #include <netinet/in.h> #include <netinet/in_var.h> @@ -173,7 +174,7 @@ static u_char *ctxmith; static int lpinittables(void); static int lpioctl(struct ifnet *, u_long, caddr_t); static int lpoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static void lpstop(struct lp_data *); static void lp_intr(void *); static int lp_module_handler(module_t, int, void *); @@ -678,7 +679,7 @@ lpoutbyte(u_char byte, int spin, device_ static int lpoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { struct lp_data *sc = ifp->if_softc; device_t dev = sc->sc_dev; Modified: head/sys/net/ethernet.h ============================================================================== --- head/sys/net/ethernet.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/ethernet.h Thu Apr 16 20:30:28 2009 (r191148) @@ -365,7 +365,7 @@ struct ether_addr { struct ifnet; struct mbuf; -struct rtentry; +struct route; struct sockaddr; struct bpf_if; @@ -376,7 +376,7 @@ extern void ether_ifattach(struct ifnet extern void ether_ifdetach(struct ifnet *); extern int ether_ioctl(struct ifnet *, u_long, caddr_t); extern int ether_output(struct ifnet *, - struct mbuf *, struct sockaddr *, struct rtentry *); + struct mbuf *, struct sockaddr *, struct route *); extern int ether_output_frame(struct ifnet *, struct mbuf *); extern char *ether_sprintf(const u_int8_t *); void ether_vlan_mtap(struct bpf_if *, struct mbuf *, Modified: head/sys/net/if_arc.h ============================================================================== --- head/sys/net/if_arc.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_arc.h Thu Apr 16 20:30:28 2009 (r191148) @@ -133,7 +133,7 @@ void arc_storelladdr(struct ifnet *, u_i int arc_isphds(u_int8_t); void arc_input(struct ifnet *, struct mbuf *); int arc_output(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *); int arc_ioctl(struct ifnet *, int, caddr_t); void arc_frag_init(struct ifnet *); Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_arcsubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -102,7 +102,7 @@ u_int8_t arcbroadcastaddr = 0; */ int arc_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt0) + struct route *ro) { struct arc_header *ah; int error; @@ -129,7 +129,8 @@ arc_output(struct ifnet *ifp, struct mbu else if (ifp->if_flags & IFF_NOARP) adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF; else { - error = arpresolve(ifp, rt0, m, dst, &adst, &lle); + error = arpresolve(ifp, ro ? ro->ro_rt : NULL, + m, dst, &adst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); } Modified: head/sys/net/if_atm.h ============================================================================== --- head/sys/net/if_atm.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_atm.h Thu Apr 16 20:30:28 2009 (r191148) @@ -293,7 +293,7 @@ void atm_ifdetach(struct ifnet *); void atm_input(struct ifnet *, struct atm_pseudohdr *, struct mbuf *, void *); int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); struct atmio_vcctable *atm_getvccs(struct atmio_vcc **, u_int, u_int, struct mtx *, int); Modified: head/sys/net/if_atmsubr.c ============================================================================== --- head/sys/net/if_atmsubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_atmsubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -113,17 +113,17 @@ MALLOC_DEFINE(M_IFATM, "ifatm", "atm int * "ifp" = ATM interface to output to * "m0" = the packet to output * "dst" = the sockaddr to send to (either IP addr, or raw VPI/VCI) - * "rt0" = the route to use + * "ro" = the route to use * returns: error code [0 == ok] * * note: special semantic: if (dst == NULL) then we assume "m" already * has an atm_pseudohdr on it and just send it directly. * [for native mode ATM output] if dst is null, then - * rt0 must also be NULL. + * ro->ro_rt must also be NULL. */ int atm_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, - struct rtentry *rt0) + struct route *ro) { u_int16_t etype = 0; /* if using LLC/SNAP */ int error = 0, sz; @@ -157,7 +157,7 @@ atm_output(struct ifnet *ifp, struct mbu etype = ETHERTYPE_IPV6; else etype = ETHERTYPE_IP; - if (!atmresolve(rt0, m, dst, &atmdst)) { + if (!atmresolve(ro->ro_rt, m, dst, &atmdst)) { m = NULL; /* XXX: atmresolve already free'd it */ senderr(EHOSTUNREACH); Modified: head/sys/net/if_disc.c ============================================================================== --- head/sys/net/if_disc.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_disc.c Thu Apr 16 20:30:28 2009 (r191148) @@ -66,7 +66,7 @@ struct disc_softc { }; static int discoutput(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *); static void discrtrequest(int, struct rtentry *, struct rt_addrinfo *); static int discioctl(struct ifnet *, u_long, caddr_t); static int disc_clone_create(struct if_clone *, int, caddr_t); @@ -156,7 +156,7 @@ DECLARE_MODULE(if_disc, disc_mod, SI_SUB static int discoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { u_int32_t af; Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_enc.c Thu Apr 16 20:30:28 2009 (r191148) @@ -85,7 +85,7 @@ struct enc_softc { static int enc_ioctl(struct ifnet *, u_long, caddr_t); static int enc_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt); + struct sockaddr *dst, struct route *ro); static int enc_clone_create(struct if_clone *, int, caddr_t); static void enc_clone_destroy(struct ifnet *); @@ -185,7 +185,7 @@ DECLARE_MODULE(enc, enc_mod, SI_SUB_PROT static int enc_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { m_freem(m); return (0); Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_ethersubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -163,17 +163,22 @@ static int ether_ipfw; */ int ether_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { short type; - int error, hdrcmplt = 0; + int error = 0, hdrcmplt = 0; u_char esrc[ETHER_ADDR_LEN], edst[ETHER_ADDR_LEN]; struct llentry *lle = NULL; + struct rtentry *rt0 = NULL; struct ether_header *eh; struct pf_mtag *t; int loop_copy = 1; int hlen; /* link layer header length */ + if (ro != NULL) { + lle = ro->ro_lle; + rt0 = ro->ro_rt; + } #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); if (error) @@ -191,7 +196,10 @@ ether_output(struct ifnet *ifp, struct m switch (dst->sa_family) { #ifdef INET case AF_INET: - error = arpresolve(ifp, rt0, m, dst, edst, &lle); + if (lle != NULL && (lle->la_flags & LLE_VALID)) + memcpy(edst, &lle->ll_addr.mac16, sizeof(edst)); + else + error = arpresolve(ifp, rt0, m, dst, edst, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); type = htons(ETHERTYPE_IP); @@ -226,7 +234,10 @@ ether_output(struct ifnet *ifp, struct m #endif #ifdef INET6 case AF_INET6: - error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, &lle); + if (lle != NULL && (lle->la_flags & LLE_VALID)) + memcpy(edst, &lle->ll_addr.mac16, sizeof(edst)); + else + error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, &lle); if (error) return error; type = htons(ETHERTYPE_IPV6); Modified: head/sys/net/if_faith.c ============================================================================== --- head/sys/net/if_faith.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_faith.c Thu Apr 16 20:30:28 2009 (r191148) @@ -88,7 +88,7 @@ struct faith_softc { static int faithioctl(struct ifnet *, u_long, caddr_t); int faithoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static void faithrtrequest(int, struct rtentry *, struct rt_addrinfo *); #ifdef INET6 static int faithprefix(struct in6_addr *); @@ -188,17 +188,20 @@ faith_clone_destroy(ifp) } int -faithoutput(ifp, m, dst, rt) +faithoutput(ifp, m, dst, ro) struct ifnet *ifp; struct mbuf *m; struct sockaddr *dst; - struct rtentry *rt; + struct route *ro; { int isr; u_int32_t af; + struct rtentry *rt = NULL; M_ASSERTPKTHDR(m); + if (ro != NULL) + rt = ro->ro_rt; /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC) { bcopy(dst->sa_data, &af, sizeof(af)); Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_fddisubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -98,7 +98,7 @@ static const u_char fddibroadcastaddr[FD static int fddi_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); static int fddi_output(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static void fddi_input(struct ifnet *ifp, struct mbuf *m); #define senderr(e) do { error = (e); goto bad; } while (0) @@ -111,18 +111,21 @@ static void fddi_input(struct ifnet *ifp * Assumes that ifp is actually pointer to arpcom structure. */ static int -fddi_output(ifp, m, dst, rt0) +fddi_output(ifp, m, dst, ro) struct ifnet *ifp; struct mbuf *m; struct sockaddr *dst; - struct rtentry *rt0; + struct route *ro; { u_int16_t type; int loop_copy = 0, error = 0, hdrcmplt = 0; u_char esrc[FDDI_ADDR_LEN], edst[FDDI_ADDR_LEN]; struct fddi_header *fh; struct llentry *lle; + struct rtentry *rt0 = NULL; + if (ro != NULL) + rt0 = ro->ro_rt; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); if (error) Modified: head/sys/net/if_fwsubr.c ============================================================================== --- head/sys/net/if_fwsubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_fwsubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -77,7 +77,7 @@ struct fw_hwaddr firewire_broadcastaddr static int firewire_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt0) + struct route *ro) { struct fw_com *fc = IFP2FWC(ifp); int error, type; @@ -138,7 +138,7 @@ firewire_output(struct ifnet *ifp, struc * doesn't fit into the arp model. */ if (unicast) { - error = arpresolve(ifp, rt0, m, dst, (u_char *) destfw, &lle); + error = arpresolve(ifp, ro ? ro->ro_rt : NULL, m, dst, (u_char *) destfw, &lle); if (error) return (error == EWOULDBLOCK ? 0 : error); } Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_gif.c Thu Apr 16 20:30:28 2009 (r191148) @@ -409,11 +409,11 @@ gif_start(struct ifnet *ifp) } int -gif_output(ifp, m, dst, rt) +gif_output(ifp, m, dst, ro) struct ifnet *ifp; struct mbuf *m; struct sockaddr *dst; - struct rtentry *rt; /* added in net2 */ + struct route *ro; { INIT_VNET_GIF(ifp->if_vnet); struct gif_softc *sc = ifp->if_softc; Modified: head/sys/net/if_gif.h ============================================================================== --- head/sys/net/if_gif.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_gif.h Thu Apr 16 20:30:28 2009 (r191148) @@ -106,7 +106,7 @@ struct etherip_header { /* Prototypes */ void gif_input(struct mbuf *, int, struct ifnet *); int gif_output(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); int gif_ioctl(struct ifnet *, u_long, caddr_t); int gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *); void gif_delete_tunnel(struct ifnet *); Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_gre.c Thu Apr 16 20:30:28 2009 (r191148) @@ -110,7 +110,7 @@ static int gre_clone_create(struct if_cl static void gre_clone_destroy(struct ifnet *); static int gre_ioctl(struct ifnet *, u_long, caddr_t); static int gre_output(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *rt); + struct route *ro); IFC_SIMPLE_DECLARE(gre, 0); @@ -240,7 +240,7 @@ gre_clone_destroy(ifp) */ static int gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { #ifdef INET6 INIT_VNET_INET(ifp->if_vnet); Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_iso88025subr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -232,11 +232,11 @@ iso88025_ioctl(struct ifnet *ifp, int co * ISO88025 encapsulation */ int -iso88025_output(ifp, m, dst, rt0) +iso88025_output(ifp, m, dst, ro) struct ifnet *ifp; struct mbuf *m; struct sockaddr *dst; - struct rtentry *rt0; + struct route *ro; { u_int16_t snap_type = 0; int loop_copy = 0, error = 0, rif_len = 0; @@ -245,6 +245,10 @@ iso88025_output(ifp, m, dst, rt0) struct iso88025_header gen_th; struct sockaddr_dl *sdl = NULL; struct llentry *lle; + struct rtentry *rt0 = NULL; + + if (ro != NULL) + rt0 = ro->ro_rt; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_lagg.c Thu Apr 16 20:30:28 2009 (r191148) @@ -93,7 +93,7 @@ static void lagg_linkstate(struct lagg_s static void lagg_port_state(struct ifnet *, int); static int lagg_port_ioctl(struct ifnet *, u_long, caddr_t); static int lagg_port_output(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *); static void lagg_port_ifdetach(void *arg __unused, struct ifnet *); static int lagg_port_checkstacking(struct lagg_softc *); static void lagg_port2req(struct lagg_port *, struct lagg_reqport *); @@ -676,7 +676,7 @@ fallback: static int lagg_port_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { struct lagg_port *lp = ifp->if_lagg; struct ether_header *eh; @@ -696,7 +696,7 @@ lagg_port_output(struct ifnet *ifp, stru */ switch (ntohs(type)) { case ETHERTYPE_PAE: /* EAPOL PAE/802.1x */ - return ((*lp->lp_output)(ifp, m, dst, rt0)); + return ((*lp->lp_output)(ifp, m, dst, ro)); } /* drop any other frames */ Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_lagg.h Thu Apr 16 20:30:28 2009 (r191148) @@ -218,7 +218,7 @@ struct lagg_port { /* Redirected callbacks */ int (*lp_ioctl)(struct ifnet *, u_long, caddr_t); int (*lp_output)(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); SLIST_ENTRY(lagg_port) lp_entries; }; Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_loop.c Thu Apr 16 20:30:28 2009 (r191148) @@ -102,7 +102,7 @@ int loioctl(struct ifnet *, u_long, caddr_t); static void lortrequest(int, struct rtentry *, struct rt_addrinfo *); int looutput(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt); + struct sockaddr *dst, struct route *ro); static int lo_clone_create(struct if_clone *, int, caddr_t); static void lo_clone_destroy(struct ifnet *); static int vnet_loif_iattach(const void *); @@ -205,15 +205,18 @@ DECLARE_MODULE(loop, loop_mod, SI_SUB_PR int looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { u_int32_t af; + struct rtentry *rt = NULL; #ifdef MAC int error; #endif M_ASSERTPKTHDR(m); /* check if we have the packet header */ + if (ro != NULL) + rt = ro->ro_rt; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); if (error) { Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_spppsubr.c Thu Apr 16 20:30:28 2009 (r191148) @@ -263,7 +263,7 @@ static const u_short interactive_ports[8 int debug = ifp->if_flags & IFF_DEBUG static int sppp_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt); + struct sockaddr *dst, struct route *ro); static void sppp_cisco_send(struct sppp *sp, int type, long par1, long par2); static void sppp_cisco_input(struct sppp *sp, struct mbuf *m); @@ -786,7 +786,7 @@ sppp_ifstart(struct ifnet *ifp) */ static int sppp_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt) + struct sockaddr *dst, struct route *ro) { struct sppp *sp = IFP2SP(ifp); struct ppp_header *h; Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_stf.c Thu Apr 16 20:30:28 2009 (r191148) @@ -178,7 +178,7 @@ static int stfmodevent(module_t, int, vo static int stf_encapcheck(const struct mbuf *, int, int, void *); static struct in6_ifaddr *stf_getsrcifa6(struct ifnet *); static int stf_output(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static int isrfc1918addr(struct in_addr *); static int stf_checkaddr4(struct stf_softc *, struct in_addr *, struct ifnet *); @@ -403,11 +403,11 @@ stf_getsrcifa6(ifp) } static int -stf_output(ifp, m, dst, rt) +stf_output(ifp, m, dst, ro) struct ifnet *ifp; struct mbuf *m; struct sockaddr *dst; - struct rtentry *rt; + struct route *ro; { struct stf_softc *sc; struct sockaddr_in6 *dst6; Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_tun.c Thu Apr 16 20:30:28 2009 (r191148) @@ -129,7 +129,7 @@ static int tunifioctl(struct ifnet *, u_ static int tuninit(struct ifnet *); static int tunmodevent(module_t, int, void *); static int tunoutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *rt); + struct route *ro); static void tunstart(struct ifnet *); static int tun_clone_create(struct if_clone *, int, caddr_t); @@ -591,7 +591,7 @@ tunoutput( struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { struct tun_softc *tp = ifp->if_softc; u_short cached_tun_flags; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/if_var.h Thu Apr 16 20:30:28 2009 (r191148) @@ -70,6 +70,7 @@ struct socket; struct ether_header; struct carp_if; struct ifvlantrunk; +struct route; #endif #include <sys/queue.h> /* get TAILQ macros */ @@ -149,7 +150,7 @@ struct ifnet { /* procedure handles */ int (*if_output) /* output routine (enqueue) */ (struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); void (*if_input) /* input routine (from h/w driver) */ (struct ifnet *, struct mbuf *); void (*if_start) /* initiate output routine */ Modified: head/sys/net/iso88025.h ============================================================================== --- head/sys/net/iso88025.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/iso88025.h Thu Apr 16 20:30:28 2009 (r191148) @@ -166,7 +166,7 @@ void iso88025_ifattach (struct ifnet *, void iso88025_ifdetach (struct ifnet *, int); int iso88025_ioctl (struct ifnet *, int , caddr_t ); int iso88025_output (struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); void iso88025_input (struct ifnet *, struct mbuf *); #endif Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net/route.h Thu Apr 16 20:30:28 2009 (r191148) @@ -41,9 +41,10 @@ */ /* - * A route consists of a destination address and a reference - * to a routing entry. These are often held by protocols - * in their control blocks, e.g. inpcb. + * A route consists of a destination address, a reference + * to a routing entry, and a reference to an llentry. + * These are often held by protocols in their control + * blocks, e.g. inpcb. */ struct route { struct rtentry *ro_rt; Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net80211/ieee80211.c Thu Apr 16 20:30:28 2009 (r191148) @@ -221,7 +221,7 @@ null_update_promisc(struct ifnet *ifp) static int null_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { if_printf(ifp, "discard raw packet\n"); m_freem(m); Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net80211/ieee80211_output.c Thu Apr 16 20:30:28 2009 (r191148) @@ -294,7 +294,7 @@ ieee80211_start(struct ifnet *ifp) */ int ieee80211_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { #define senderr(e) do { error = (e); goto bad;} while (0) struct ieee80211_node *ni = NULL; @@ -320,7 +320,7 @@ ieee80211_output(struct ifnet *ifp, stru * a raw 802.11 frame. */ if (dst->sa_family != AF_IEEE80211) - return vap->iv_output(ifp, m, dst, rt0); + return vap->iv_output(ifp, m, dst, ro); #ifdef MAC error = mac_check_ifnet_transmit(ifp, m); if (error) Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net80211/ieee80211_proto.h Thu Apr 16 20:30:28 2009 (r191148) @@ -70,7 +70,7 @@ int ieee80211_mgmt_output(struct ieee802 int ieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); int ieee80211_output(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *ro); void ieee80211_start(struct ifnet *); int ieee80211_send_nulldata(struct ieee80211_node *); int ieee80211_classify(struct ieee80211_node *, struct mbuf *m); Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/net80211/ieee80211_var.h Thu Apr 16 20:30:28 2009 (r191148) @@ -437,7 +437,7 @@ struct ieee80211vap { enum ieee80211_state, int); /* 802.3 output method for raw frame xmit */ int (*iv_output)(struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *); + struct sockaddr *, struct route *); }; MALLOC_DECLARE(M_80211_VAP); Modified: head/sys/netgraph/ng_fec.c ============================================================================== --- head/sys/netgraph/ng_fec.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netgraph/ng_fec.c Thu Apr 16 20:30:28 2009 (r191148) @@ -107,6 +107,7 @@ #include <net/if_media.h> #include <net/bpf.h> #include <net/ethernet.h> +#include <net/route.h> #include "opt_inet.h" #include "opt_inet6.h" @@ -165,7 +166,7 @@ struct ng_fec_bundle { int (*fec_if_output) (struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); }; #define FEC_BTYPE_MAC 0x01 @@ -197,7 +198,7 @@ static int ng_fec_ifmedia_upd(struct ifn static void ng_fec_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); static int ng_fec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int ng_fec_output(struct ifnet *ifp, struct mbuf *m0, - struct sockaddr *dst, struct rtentry *rt0); + struct sockaddr *dst, struct route *ro); static void ng_fec_tick(void *arg); static int ng_fec_addport(struct ng_fec_private *priv, char *iface); static int ng_fec_delport(struct ng_fec_private *priv, char *iface); @@ -923,7 +924,7 @@ ng_fec_input(struct ifnet *ifp, struct m static int ng_fec_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { const priv_p priv = (priv_p) ifp->if_softc; struct ng_fec_bundle *b; @@ -977,7 +978,7 @@ ng_fec_output(struct ifnet *ifp, struct * for us. */ priv->if_error = 0; - error = (*b->fec_if_output)(ifp, m, dst, rt0); + error = (*b->fec_if_output)(ifp, m, dst, ro); if (priv->if_error && !error) error = priv->if_error; Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netgraph/ng_iface.c Thu Apr 16 20:30:28 2009 (r191148) @@ -75,6 +75,7 @@ #include <net/if_types.h> #include <net/bpf.h> #include <net/netisr.h> +#include <net/route.h> #include <netinet/in.h> @@ -121,7 +122,7 @@ typedef struct ng_iface_private *priv_p; static void ng_iface_start(struct ifnet *ifp); static int ng_iface_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int ng_iface_output(struct ifnet *ifp, struct mbuf *m0, - struct sockaddr *dst, struct rtentry *rt0); + struct sockaddr *dst, struct route *ro); static void ng_iface_bpftap(struct ifnet *ifp, struct mbuf *m, sa_family_t family); static int ng_iface_send(struct ifnet *ifp, struct mbuf *m, @@ -354,7 +355,7 @@ ng_iface_ioctl(struct ifnet *ifp, u_long static int ng_iface_output(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *dst, struct rtentry *rt0) + struct sockaddr *dst, struct route *ro) { struct m_tag *mtag; uint32_t af; Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet/if_ether.c Thu Apr 16 20:30:28 2009 (r191148) @@ -238,7 +238,7 @@ arprequest(struct ifnet *ifp, struct in_ sa.sa_family = AF_ARP; sa.sa_len = 2; m->m_flags |= M_BCAST; - (*ifp->if_output)(ifp, m, &sa, (struct rtentry *)0); + (*ifp->if_output)(ifp, m, &sa, NULL); } /* @@ -753,7 +753,7 @@ reply: m->m_pkthdr.len = m->m_len; sa.sa_family = AF_ARP; sa.sa_len = 2; - (*ifp->if_output)(ifp, m, &sa, (struct rtentry *)0); + (*ifp->if_output)(ifp, m, &sa, NULL); return; drop: Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet/ip_carp.c Thu Apr 16 20:30:28 2009 (r191148) @@ -207,7 +207,7 @@ static void carp_master_down(void *); static void carp_master_down_locked(struct carp_softc *); static int carp_ioctl(struct ifnet *, u_long, caddr_t); static int carp_looutput(struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *); + struct route *); static void carp_start(struct ifnet *); static void carp_setrun(struct carp_softc *, sa_family_t); static void carp_set_state(struct carp_softc *, int); @@ -2011,12 +2011,15 @@ carp_ioctl(struct ifnet *ifp, u_long cmd */ static int carp_looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, - struct rtentry *rt) + struct route *ro) { u_int32_t af; + struct rtentry *rt = NULL; M_ASSERTPKTHDR(m); /* check if we have the packet header */ + if (ro != NULL) + rt = ro->ro_rt; if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { m_freem(m); return (rt->rt_flags & RTF_BLACKHOLE ? 0 : Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet/ip_fastfwd.c Thu Apr 16 20:30:28 2009 (r191148) @@ -183,7 +183,7 @@ ip_fastforward(struct mbuf *m) M_ASSERTVALID(m); M_ASSERTPKTHDR(m); - ro.ro_rt = NULL; + bzero(&ro, sizeof(ro)); /* * Step 1: check for packet drop conditions (and sanity checks) @@ -552,7 +552,7 @@ passout: * Send off the packet via outgoing interface */ error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro.ro_rt); + (struct sockaddr *)dst, &ro); } else { /* * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery @@ -585,7 +585,7 @@ passout: m->m_nextpkt = NULL; error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro.ro_rt); + (struct sockaddr *)dst, &ro); if (error) break; } while ((m = m0) != NULL); Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet/ip_output.c Thu Apr 16 20:30:28 2009 (r191148) @@ -595,7 +595,7 @@ passout: */ m->m_flags &= ~(M_PROTOFLAGS); error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); + (struct sockaddr *)dst, ro); goto done; } @@ -629,7 +629,7 @@ passout: m->m_flags &= ~(M_PROTOFLAGS); error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); + (struct sockaddr *)dst, ro); } else m_freem(m); } Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet6/nd6.c Thu Apr 16 20:30:28 2009 (r191148) @@ -1939,7 +1939,7 @@ nd6_output_lle(struct ifnet *ifp, struct int nd6_output_flush(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain, - struct sockaddr_in6 *dst, struct rtentry *rt) + struct sockaddr_in6 *dst, struct route *ro) { struct mbuf *m, *m_head; struct ifnet *outifp; @@ -1954,7 +1954,7 @@ nd6_output_flush(struct ifnet *ifp, stru while (m_head) { m = m_head; m_head = m_head->m_nextpkt; - error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, rt); + error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, ro); } /* Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netinet6/nd6.h Thu Apr 16 20:30:28 2009 (r191148) @@ -395,7 +395,7 @@ int nd6_output_lle __P((struct ifnet *, struct sockaddr_in6 *, struct rtentry *, struct llentry *, struct mbuf **)); int nd6_output_flush __P((struct ifnet *, struct ifnet *, struct mbuf *, - struct sockaddr_in6 *, struct rtentry *)); + struct sockaddr_in6 *, struct route *)); int nd6_need_cache __P((struct ifnet *)); int nd6_storelladdr __P((struct ifnet *, struct mbuf *, struct sockaddr *, u_char *, struct llentry **)); Modified: head/sys/netipx/ipx_outputfl.c ============================================================================== --- head/sys/netipx/ipx_outputfl.c Thu Apr 16 20:17:32 2009 (r191147) +++ head/sys/netipx/ipx_outputfl.c Thu Apr 16 20:30:28 2009 (r191148) @@ -154,7 +154,7 @@ gotif: ipx_watch_output(m0, ifp); } error = (*ifp->if_output)(ifp, m0, - (struct sockaddr *)dst, ro->ro_rt); + (struct sockaddr *)dst, ro); goto done; } else { ipxstat.ipxs_mtutoosmall++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904162030.n3GKUSm6090918>