commit 7ac99af6c4007d1a35444dedeaa506b4b1be6def Author: Ryota Ozaki Date: Tue Mar 22 19:40:00 2016 +0900 Constify rtentry of if_output diff --git a/sys/dev/ic/hd64570.c b/sys/dev/ic/hd64570.c index 9e841fa..7ee290e 100644 --- a/sys/dev/ic/hd64570.c +++ b/sys/dev/ic/hd64570.c @@ -160,7 +160,7 @@ static void sca_port_up(sca_port_t *); static void sca_port_down(sca_port_t *); static int sca_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); static int sca_ioctl(struct ifnet *, u_long, void *); static void sca_start(struct ifnet *); static void sca_watchdog(struct ifnet *); @@ -792,7 +792,7 @@ sca_output( struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt0) + const struct rtentry *rt0) { struct hdlc_header *hdlc; struct ifqueue *ifq = NULL; diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index 3ba7854..d0b306e 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -3355,7 +3355,7 @@ ifnet_input(struct ifnet *ifp, struct mbuf *mbuf) */ static int /* context: process */ ifnet_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct rtentry *rt) + const struct sockaddr *dst, const struct rtentry *rt) { softc_t *sc = IFP2SC(ifp); int error = 0; diff --git a/sys/dev/pci/if_lmc.h b/sys/dev/pci/if_lmc.h index e99c155..8eea023 100644 --- a/sys/dev/pci/if_lmc.h +++ b/sys/dev/pci/if_lmc.h @@ -1311,7 +1311,7 @@ static int rawip_detach(softc_t *); #if IFNET static void ifnet_input(struct ifnet *, struct mbuf *); static int ifnet_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static int ifnet_ioctl(struct ifnet *, u_long, void *); static void ifnet_start(struct ifnet *); static void ifnet_watchdog(struct ifnet *); diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 2b480ddd..e40957b 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -193,7 +193,7 @@ Static void upl_stop(struct upl_softc *); Static void upl_watchdog(struct ifnet *); Static int upl_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); Static void upl_input(struct ifnet *, struct mbuf *); /* @@ -985,7 +985,7 @@ upl_stop(struct upl_softc *sc) Static int upl_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt0) + const struct rtentry *rt0) { int s, len, error; diff --git a/sys/dev/usb/uhso.c b/sys/dev/usb/uhso.c index 300bd29..cb6b725 100644 --- a/sys/dev/usb/uhso.c +++ b/sys/dev/usb/uhso.c @@ -421,7 +421,8 @@ Static int uhso_ifnet_ioctl(struct ifnet *, u_long, void *); Static int uhso_ifnet_init(struct uhso_port *); Static void uhso_ifnet_clean(struct uhso_port *); Static void uhso_ifnet_start(struct ifnet *); -Static int uhso_ifnet_output(struct ifnet *, struct mbuf *, const struct sockaddr *, struct rtentry *); +Static int uhso_ifnet_output(struct ifnet *, struct mbuf *, + const struct sockaddr *, const struct rtentry *); /******************************************************************************* @@ -2339,7 +2340,7 @@ uhso_ifnet_start(struct ifnet *ifp) Static int uhso_ifnet_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt0) + const struct rtentry *rt0) { int error; diff --git a/sys/net/if.c b/sys/net/if.c index 4f6beb5..341b6ee 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -308,7 +308,7 @@ if_initname(struct ifnet *ifp, const char *name, int unit) int if_nulloutput(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *so, struct rtentry *rt) + const struct sockaddr *so, const struct rtentry *rt) { return ENXIO; diff --git a/sys/net/if.h b/sys/net/if.h index 12c3d72..4c4ac70 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -267,7 +267,7 @@ typedef struct ifnet { */ int (*if_output) /* output routine (enqueue) */ (struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); void (*_if_input) /* input routine (from h/w driver) */ (struct ifnet *, struct mbuf *); void (*if_start) /* initiate output routine */ @@ -945,7 +945,7 @@ int ifq_enqueue2(struct ifnet *, struct ifqueue *, struct mbuf *); int loioctl(struct ifnet *, u_long, void *); void loopattach(int); int looutput(struct ifnet *, - struct mbuf *, const struct sockaddr *, struct rtentry *); + struct mbuf *, const struct sockaddr *, const struct rtentry *); void lortrequest(int, struct rtentry *, const struct rt_addrinfo *); /* @@ -953,7 +953,7 @@ void lortrequest(int, struct rtentry *, const struct rt_addrinfo *); * an interface is going away without having to burn a flag. */ int if_nulloutput(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); void if_nullinput(struct ifnet *, struct mbuf *); void if_nullstart(struct ifnet *); int if_nullioctl(struct ifnet *, u_long, void *); diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h index 4677a57..e59f506 100644 --- a/sys/net/if_atm.h +++ b/sys/net/if_atm.h @@ -136,7 +136,7 @@ void atm_ifattach(struct ifnet *); void atm_input(struct ifnet *, struct atm_pseudohdr *, struct mbuf *, void *); int atm_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); #endif #ifdef ATM_PVCEXT #ifdef _KERNEL diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index ce69db3..06c835d 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -90,7 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_atmsubr.c,v 1.57 2016/04/20 09:01:04 knakahara Ex int atm_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t etype = 0; /* if using LLC/SNAP */ int error = 0, sz; diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 153348f..3334675 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1415,7 +1415,7 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m, */ int bridge_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa, - struct rtentry *rt) + const struct rtentry *rt) { struct ether_header *eh; struct ifnet *dst_if; diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index 66be142..218d5af 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -334,7 +334,7 @@ extern const uint8_t bstp_etheraddr[]; void bridge_ifdetach(struct ifnet *); int bridge_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); void bstp_initialization(struct bridge_softc *); void bstp_stop(struct bridge_softc *); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 050e311..fa8d3e1 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -178,7 +178,7 @@ const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN] = #define senderr(e) { error = (e); goto bad;} static int ether_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); /* * Ethernet output routine. @@ -188,7 +188,7 @@ static int ether_output(struct ifnet *, struct mbuf *, static int ether_output(struct ifnet * const ifp0, struct mbuf * const m0, const struct sockaddr * const dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t etype = 0; int error = 0, hdrcmplt = 0; diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index eefe7a5..ac58887 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.51 2015/08/20 14:40:19 christos Exp $ static int faithioctl(struct ifnet *, u_long, void *); static int faithoutput(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static void faithrtrequest(int, struct rtentry *, const struct rt_addrinfo *); @@ -143,7 +143,7 @@ faith_clone_destroy(struct ifnet *ifp) static int faithoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { pktqueue_t *pktq; size_t pktlen; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 2386401..df9c5bb 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -176,7 +176,7 @@ extern u_char aarp_org_code[ 3 ]; #define CFDDIADDR(ifp) CLLADDR((ifp)->if_sadl) static int fddi_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static void fddi_input(struct ifnet *, struct mbuf *); /* @@ -186,7 +186,7 @@ static void fddi_input(struct ifnet *, struct mbuf *); */ static int fddi_output(struct ifnet *ifp0, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t etype; int error = 0, hdrcmplt = 0; diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 3fceeb3..0c87983 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -306,7 +306,7 @@ gif_check_nesting(struct ifnet *ifp, struct mbuf *m) int gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { struct gif_softc *sc = ifp->if_softc; int error = 0; diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h index 1d66b1d..65ebb62 100644 --- a/sys/net/if_gif.h +++ b/sys/net/if_gif.h @@ -73,7 +73,7 @@ struct gif_softc { void gifattach0(struct gif_softc *); void gif_input(struct mbuf *, int, struct ifnet *); int gif_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); int gif_ioctl(struct ifnet *, u_long, void *); int gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *); void gif_delete_tunnel(struct ifnet *); diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index d08a4d1..20639ee 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -152,7 +152,7 @@ static int gre_input(struct gre_softc *, struct mbuf *, int, const struct gre_h *); static bool gre_is_nullconf(const struct gre_soparm *); static int gre_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static int gre_ioctl(struct ifnet *, u_long, void *); static int gre_getsockname(struct socket *, struct sockaddr *); static int gre_getpeername(struct socket *, struct sockaddr *); @@ -878,7 +878,7 @@ gre_input(struct gre_softc *sc, struct mbuf *m, int hlen, */ static int gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { int error = 0; struct gre_softc *sc = ifp->if_softc; diff --git a/sys/net/if_hippisubr.c b/sys/net/if_hippisubr.c index 698a2e7..453bd02 100644 --- a/sys/net/if_hippisubr.c +++ b/sys/net/if_hippisubr.c @@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_hippisubr.c,v 1.46 2016/04/20 09:01:04 knakahara #endif static int hippi_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static void hippi_input(struct ifnet *, struct mbuf *); /* @@ -85,7 +85,7 @@ static void hippi_input(struct ifnet *, struct mbuf *); static int hippi_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t htype; uint32_t ifield = 0; diff --git a/sys/net/if_ieee1394subr.c b/sys/net/if_ieee1394subr.c index b3402b9..754e349 100644 --- a/sys/net/if_ieee1394subr.c +++ b/sys/net/if_ieee1394subr.c @@ -79,12 +79,12 @@ __KERNEL_RCSID(0, "$NetBSD: if_ieee1394subr.c,v 1.53 2016/04/20 09:01:04 knakaha #define senderr(e) do { error = (e); goto bad; } while(0/*CONSTCOND*/) static int ieee1394_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static struct mbuf *ieee1394_reass(struct ifnet *, struct mbuf *, uint16_t); static int ieee1394_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t etype = 0; struct mbuf *m; diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 5c6e893..4163d1f 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -205,7 +205,7 @@ loop_clone_destroy(struct ifnet *ifp) int looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { pktqueue_t *pktq = NULL; struct ifqueue *ifq = NULL; diff --git a/sys/net/if_mpls.c b/sys/net/if_mpls.c index 6434dd6..da27fd5 100644 --- a/sys/net/if_mpls.c +++ b/sys/net/if_mpls.c @@ -89,9 +89,10 @@ static struct if_clone mpls_if_cloner = static void mpls_input(struct ifnet *, struct mbuf *); static int mpls_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); static int mpls_ioctl(struct ifnet *, u_long, void *); -static int mpls_send_frame(struct mbuf *, struct ifnet *, struct rtentry *); +static int mpls_send_frame(struct mbuf *, struct ifnet *, + const struct rtentry *); static int mpls_lse(struct mbuf *); #ifdef INET @@ -201,7 +202,8 @@ mplsintr(void) * prepend shim and deliver */ static int -mpls_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct rtentry *rt) +mpls_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, + const struct rtentry *rt) { union mpls_shim mh, *pms; struct rtentry *rt1; @@ -438,6 +440,12 @@ mpls_lse(struct mbuf *m) return ENOBUFS; } + if ((rt->rt_flags & RTF_GATEWAY) == 0) { + error = EHOSTUNREACH; + goto done; + } + + rt->rt_use++; error = mpls_send_frame(m, rt->rt_ifp, rt); done: @@ -450,16 +458,11 @@ done: } static int -mpls_send_frame(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt) +mpls_send_frame(struct mbuf *m, struct ifnet *ifp, const struct rtentry *rt) { union mpls_shim msh; int ret; - if ((rt->rt_flags & RTF_GATEWAY) == 0) - return EHOSTUNREACH; - - rt->rt_use++; - msh.s_addr = MPLS_GETSADDR(rt); if (msh.shim.label == MPLS_LABEL_IMPLNULL || (m->m_flags & (M_MCAST | M_BCAST))) { diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index a740b98..efce287 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -839,7 +839,7 @@ pppsioctl(struct ifnet *ifp, u_long cmd, void *data) */ int pppoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rtp) + const struct rtentry *rtp) { struct ppp_softc *sc = ifp->if_softc; int protocol, address, control; diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h index 0bb9a29..e9b1dcb 100644 --- a/sys/net/if_pppvar.h +++ b/sys/net/if_pppvar.h @@ -159,7 +159,7 @@ void ppp_restart(struct ppp_softc *); void ppppktin(struct ppp_softc *, struct mbuf *, int); struct mbuf *ppp_dequeue(struct ppp_softc *); int pppoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); #endif /* _KERNEL */ #endif /* !_NET_IF_PPPVAR_H_ */ diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index c7f3c63..b6bba13 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -198,7 +198,7 @@ static int slinput(int, struct tty *); static int slioctl(struct ifnet *, u_long, void *); static int slopen(dev_t, struct tty *); static int sloutput(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); static int slstart(struct tty *); static int sltioctl(struct tty *, u_long, void *, int, struct lwp *); @@ -433,7 +433,7 @@ sltioctl(struct tty *tp, u_long cmd, void *data, int flag, */ static int sloutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rtp) + const struct rtentry *rtp) { struct sl_softc *sc = ifp->if_softc; struct ip *ip; diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 1f02549..80a67f3 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -258,7 +258,7 @@ static u_short interactive_ports[8] = { int debug = ifp->if_flags & IFF_DEBUG static int sppp_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct rtentry *rt); + const struct sockaddr *dst, const struct rtentry *rt); static void sppp_cisco_send(struct sppp *sp, int type, int32_t par1, int32_t par2); static void sppp_cisco_input(struct sppp *sp, struct mbuf *m); @@ -640,7 +640,7 @@ queue_pkt: */ static int sppp_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct rtentry *rt) + const struct sockaddr *dst, const struct rtentry *rt) { struct sppp *sp = (struct sppp *) ifp; struct ppp_header *h = NULL; diff --git a/sys/net/if_srt.c b/sys/net/if_srt.c index fe000fd..1ab780d 100644 --- a/sys/net/if_srt.c +++ b/sys/net/if_srt.c @@ -181,7 +181,7 @@ srt_if_output( struct ifnet *ifp, struct mbuf *m, const struct sockaddr *to, - struct rtentry *rtp) + const struct rtentry *rtp) { struct srt_softc *sc; struct srt_rt *r; diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 3ac7dd1..96d3ae6 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -168,7 +168,7 @@ static const struct encapsw in_stf_encapsw = static int stf_encapcheck(struct mbuf *, int, int, void *); static struct in6_ifaddr *stf_getsrcifa6(struct ifnet *); static int stf_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct rtentry *); + const struct rtentry *); static int isrfc1918addr(const struct in_addr *); static int stf_checkaddr4(struct stf_softc *, const struct in_addr *, struct ifnet *); @@ -325,7 +325,7 @@ stf_getsrcifa6(struct ifnet *ifp) static int stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt0) + const struct rtentry *rt0) { struct rtentry *rt; struct stf_softc *sc; diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c index b26d8b2..14a7a20 100644 --- a/sys/net/if_strip.c +++ b/sys/net/if_strip.c @@ -332,7 +332,8 @@ static int stripinput(int, struct tty *); static int stripioctl(struct ifnet *, u_long, void *); static int stripopen(dev_t, struct tty *); static int stripoutput(struct ifnet *, - struct mbuf *, const struct sockaddr *, struct rtentry *); + struct mbuf *, const struct sockaddr *, + const struct rtentry *); static int stripstart(struct tty *); static int striptioctl(struct tty *, u_long, void *, int, struct lwp *); @@ -721,7 +722,7 @@ strip_send(struct strip_softc *sc, struct mbuf *m0) */ int stripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { struct strip_softc *sc = ifp->if_softc; struct ip *ip; diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c index 405800b..e3e2af5 100644 --- a/sys/net/if_tokensubr.c +++ b/sys/net/if_tokensubr.c @@ -143,7 +143,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.75 2016/04/20 09:01:04 knakahara #define RCF_SINGLEROUTE (2 << 8) | TOKEN_RCF_FRAME2 | TOKEN_RCF_BROADCAST_SINGLE static int token_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); static void token_input(struct ifnet *, struct mbuf *); /* @@ -154,7 +154,7 @@ static void token_input(struct ifnet *, struct mbuf *); */ static int token_output(struct ifnet *ifp0, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { uint16_t etype; int error = 0; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 76c98ea..07b1459 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -73,7 +73,7 @@ static kmutex_t tun_softc_lock; static int tun_ioctl(struct ifnet *, u_long, void *); static int tun_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *rt); + const struct sockaddr *, const struct rtentry *rt); static int tun_clone_create(struct if_clone *, int); static int tun_clone_destroy(struct ifnet *); @@ -494,7 +494,7 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, void *data) */ static int tun_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct rtentry *rt) + const struct rtentry *rt) { struct tun_softc *tp = ifp->if_softc; int s; diff --git a/sys/net/route.c b/sys/net/route.c index 0ca954c..c2d5e69 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1488,13 +1488,13 @@ rt_settag(struct rtentry *rt, const struct sockaddr *tag) } struct sockaddr * -rt_gettag(struct rtentry *rt) +rt_gettag(const struct rtentry *rt) { return rt->rt_tag; } int -rt_check_reject_route(struct rtentry *rt, struct ifnet *ifp) +rt_check_reject_route(const struct rtentry *rt, const struct ifnet *ifp) { if ((rt->rt_flags & RTF_REJECT) != 0) { diff --git a/sys/net/route.h b/sys/net/route.h index ebef437..3cda045 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -403,9 +403,9 @@ int rt_setgate(struct rtentry *, const struct sockaddr *); const struct sockaddr * rt_settag(struct rtentry *, const struct sockaddr *); struct sockaddr * - rt_gettag(struct rtentry *); + rt_gettag(const struct rtentry *); -int rt_check_reject_route(struct rtentry *, struct ifnet *); +int rt_check_reject_route(const struct rtentry *, const struct ifnet *); static inline void rt_assert_referenced(const struct rtentry *rt) diff --git a/sys/netinet/if_atm.c b/sys/netinet/if_atm.c index 802c37d..9b44cd74 100644 --- a/sys/netinet/if_atm.c +++ b/sys/netinet/if_atm.c @@ -201,18 +201,18 @@ failed: */ int -atmresolve(struct rtentry *rt0, struct mbuf *m, const struct sockaddr *dst, +atmresolve(const struct rtentry *rt0, struct mbuf *m, const struct sockaddr *dst, struct atm_pseudohdr *desten /* OUT */) { const struct sockaddr_dl *sdl; - struct rtentry *rt = rt0; + struct rtentry *rt = NULL; if (m->m_flags & (M_BCAST|M_MCAST)) { log(LOG_INFO, "atmresolve: BCAST/MCAST packet detected/dumped\n"); goto bad; } - if (rt == NULL) { + if (rt0 == NULL) { rt = RTALLOC1(dst, 0); if (rt == NULL) goto bad; /* failed */ @@ -231,7 +231,7 @@ atmresolve(struct rtentry *rt0, struct mbuf *m, const struct sockaddr *dst, * ATM ARP [c.f. if_ether.c]). */ - sdl = satocsdl(rt->rt_gateway); + sdl = satocsdl((rt ? rt : rt0)->rt_gateway); /* * Check the address family and length is valid, the address @@ -240,12 +240,12 @@ atmresolve(struct rtentry *rt0, struct mbuf *m, const struct sockaddr *dst, if (sdl->sdl_family == AF_LINK && sdl->sdl_alen == sizeof(*desten)) { memcpy(desten, CLLADDR(sdl), sdl->sdl_alen); - if (rt != rt0) + if (rt != NULL) rtfree(rt); return (1); /* ok, go for it! */ } - if (rt != rt0) + if (rt != NULL) rtfree(rt); /* diff --git a/sys/netinet/if_atm.h b/sys/netinet/if_atm.h index 1a748c9..bb4cee8 100644 --- a/sys/netinet/if_atm.h +++ b/sys/netinet/if_atm.h @@ -33,7 +33,7 @@ */ void atm_rtrequest(int, struct rtentry *, const struct rt_addrinfo *); -int atmresolve(struct rtentry *, struct mbuf *, const struct sockaddr *, +int atmresolve(const struct rtentry *, struct mbuf *, const struct sockaddr *, struct atm_pseudohdr *); #endif /* !_NETINET_IF_ATM_H_ */ diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index d9491e5..8c20b57 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -2090,7 +2090,7 @@ carp_start(struct ifnet *ifp) int carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa, - struct rtentry *rt) + const struct rtentry *rt) { struct carp_softc *sc = ((struct carp_softc *)ifp->if_softc); KASSERT(KERNEL_LOCKED_P()); diff --git a/sys/netinet/ip_carp.h b/sys/netinet/ip_carp.h index 377b62f..83d7bf0 100644 --- a/sys/netinet/ip_carp.h +++ b/sys/netinet/ip_carp.h @@ -163,6 +163,6 @@ struct ifaddr *carp_iamatch6(void *, struct in6_addr *); struct ifnet *carp_ourether(void *, struct ether_header *, u_char, int); int carp_input(struct mbuf *, u_int8_t *, u_int8_t *, u_int16_t); int carp_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, struct rtentry *); + const struct sockaddr *, const struct rtentry *); #endif /* _KERNEL */ #endif /* _NETINET_IP_CARP_H_ */ diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 0d63e47..5c18e02 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -158,7 +158,8 @@ extern pfil_head_t *inet_pfil_hook; /* XXX */ int ip_do_loopback_cksum = 0; static int -ip_mark_mpls(struct ifnet * const ifp, struct mbuf * const m, struct rtentry *rt) +ip_mark_mpls(struct ifnet * const ifp, struct mbuf * const m, + const struct rtentry *rt) { int error = 0; #ifdef MPLS @@ -193,7 +194,7 @@ ip_mark_mpls(struct ifnet * const ifp, struct mbuf * const m, struct rtentry *rt */ int ip_if_output(struct ifnet * const ifp, struct mbuf * const m, - const struct sockaddr * const dst, struct rtentry *rt) + const struct sockaddr * const dst, const struct rtentry *rt) { int error = 0; diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index ff4b5a3..b40f3c2 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -239,7 +239,7 @@ int ip_setmoptions(struct ip_moptions **, const struct sockopt *sopt); int ip_getmoptions(struct ip_moptions *, struct sockopt *sopt); int ip_if_output(struct ifnet * const, struct mbuf * const, - const struct sockaddr * const, struct rtentry *); + const struct sockaddr * const, const struct rtentry *); /* IP Flow interface. */ void ipflow_init(void); diff --git a/sys/netisdn/i4b_ipr.c b/sys/netisdn/i4b_ipr.c index fcc2e6f..115f2f8 100644 --- a/sys/netisdn/i4b_ipr.c +++ b/sys/netisdn/i4b_ipr.c @@ -257,7 +257,8 @@ static int iprwatchdog(int unit); static void iprwatchdog(struct ifnet *ifp); #endif static void ipr_tx_queue_empty(void *); -static int iripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct rtentry *rtp); +static int iripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, + const struct rtentry *rtp); static void iripclearqueues(struct ipr_softc *sc); static void ipr_set_linktab(void *softc, isdn_link_t *ilt); static void ipr_activity(void *softc, int rxtx); @@ -415,7 +416,7 @@ iripattach(void) *---------------------------------------------------------------------------*/ static int iripoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct rtentry *rtp) + const struct rtentry *rtp) { struct ipr_softc *sc; int s, rv;