From 47e8d432d5db395e2812c03093b70227e48a1c6d Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 26 Apr 2013 12:50:32 +0000 Subject: Add const qualifier to the dst parameter of the ifnet if_output method. --- sys/netgraph/ng_iface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sys/netgraph/ng_iface.c') diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 5e6f12fb4b5d..e6ac5085368d 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -123,7 +123,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 route *ro); + const 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, @@ -353,7 +353,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 route *ro) + const struct sockaddr *dst, struct route *ro) { struct m_tag *mtag; uint32_t af; @@ -385,13 +385,13 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, m_tag_prepend(m, mtag); /* BPF writes need to be handled specially. */ - if (dst->sa_family == AF_UNSPEC) { + if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); - dst->sa_family = af; - } + else + af = dst->sa_family; /* Berkeley packet filter */ - ng_iface_bpftap(ifp, m, dst->sa_family); + ng_iface_bpftap(ifp, m, af); if (ALTQ_IS_ENABLED(&ifp->if_snd)) { M_PREPEND(m, sizeof(sa_family_t), M_NOWAIT); @@ -402,10 +402,10 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, ifp->if_oerrors++; return (ENOBUFS); } - *(sa_family_t *)m->m_data = dst->sa_family; + *(sa_family_t *)m->m_data = af; error = (ifp->if_transmit)(ifp, m); } else - error = ng_iface_send(ifp, m, dst->sa_family); + error = ng_iface_send(ifp, m, af); return (error); } -- cgit v1.2.3