1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-23 07:31:31 +00:00

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
This commit is contained in:
Kip Macy 2009-04-16 20:30:28 +00:00
parent fe69399069
commit 279aa3d419
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191148
45 changed files with 122 additions and 88 deletions

View File

@ -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 @@ frdest_t *fdp;
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);
}

View File

@ -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);

View File

@ -152,7 +152,7 @@ int pfsync_insert_net_state(struct pfsync_state *, u_int8_t);
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 @@ pfsync_input(struct mbuf *m, ...)
int
pfsyncoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct rtentry *rt)
struct route *ro)
{
m_freem(m);
return (0);

View File

@ -6245,7 +6245,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
}
}
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;
}

View File

@ -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 *ptr)
*/
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;

View File

@ -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;

View File

@ -1595,7 +1595,7 @@ static int lmc_raw_ioctl(struct ifnet *, u_long, caddr_t);
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 *);

View File

@ -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_t ppbus)
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;

View File

@ -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 *, const u_int8_t *);
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 *,

View File

@ -133,7 +133,7 @@ void arc_storelladdr(struct ifnet *, u_int8_t);
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 *);

View File

@ -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 mbuf *m, struct sockaddr *dst,
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);
}

View File

@ -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);

View File

@ -113,17 +113,17 @@ MALLOC_DEFINE(M_IFATM, "ifatm", "atm interface internals");
* "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 mbuf *m0, struct sockaddr *dst,
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);

View File

@ -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_PSEUDO, SI_ORDER_ANY);
static int
discoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct rtentry *rt)
struct route *ro)
{
u_int32_t af;

View File

@ -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_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY);
static int
enc_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
struct rtentry *rt)
struct route *ro)
{
m_freem(m);
return (0);

View File

@ -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 mbuf *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 mbuf *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);

View File

@ -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));

View File

@ -98,7 +98,7 @@ static const u_char fddibroadcastaddr[FDDI_ADDR_LEN] =
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, struct mbuf *m);
* 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)

View File

@ -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, struct mbuf *m, struct sockaddr *dst,
* 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);
}

View File

@ -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;

View File

@ -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 *);

View File

@ -110,7 +110,7 @@ static int gre_clone_create(struct if_clone *, int, caddr_t);
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);

View File

@ -232,11 +232,11 @@ iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data)
* 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);

View File

@ -93,7 +93,7 @@ static void lagg_linkstate(struct lagg_softc *);
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 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
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, struct mbuf *m,
*/
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 */

View File

@ -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;
};

View File

@ -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_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY);
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) {

View File

@ -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;

View File

@ -178,7 +178,7 @@ static int stfmodevent(module_t, int, void *);
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;

View File

@ -129,7 +129,7 @@ static int tunifioctl(struct ifnet *, u_long, caddr_t);
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;

View File

@ -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 */

View File

@ -166,7 +166,7 @@ void iso88025_ifattach (struct ifnet *, const u_int8_t *, int);
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

View File

@ -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;

View File

@ -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);

View File

@ -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, struct mbuf *m,
* 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)

View File

@ -70,7 +70,7 @@ int ieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,
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);

View File

@ -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);

View File

@ -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 ifnet *ifp);
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 mbuf *m0)
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 mbuf *m,
* 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;

View File

@ -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 command, caddr_t data)
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;

View File

@ -238,7 +238,7 @@ arprequest(struct ifnet *ifp, struct in_addr *sip, struct in_addr *tip,
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 @@ in_arpinput(struct mbuf *m)
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:

View File

@ -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, caddr_t addr)
*/
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 :

View File

@ -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 @@ ip_fastforward(struct mbuf *m)
* 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 @@ ip_fastforward(struct mbuf *m)
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);

View File

@ -595,7 +595,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
*/
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 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
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);
}

View File

@ -1939,7 +1939,7 @@ nd6_output_lle(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
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, struct ifnet *origifp, struct mbuf *chain,
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);
}
/*

View File

@ -395,7 +395,7 @@ int nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *,
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 **));

View File

@ -154,7 +154,7 @@ ipx_outputfl(struct mbuf *m0, struct route *ro, int flags)
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++;