aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6/udp6_usrreq.c
diff options
context:
space:
mode:
authorErmal Luçi <eri@FreeBSD.org>2017-02-12 06:56:33 +0000
committerErmal Luçi <eri@FreeBSD.org>2017-02-12 06:56:33 +0000
commitc10c5b1eba5d85d538b7c1bc97f02da1d0d3cc76 (patch)
tree7eb55180b788209b794a1e8c26022584f4a968f1 /sys/netinet6/udp6_usrreq.c
parent8148f4f3d5627532262aa8f56a14a2f9b2230719 (diff)
Notes
Diffstat (limited to 'sys/netinet6/udp6_usrreq.c')
-rw-r--r--sys/netinet6/udp6_usrreq.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index bcf491f108086..911d1de519452 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -137,7 +137,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
struct sockaddr_in6 *fromsa)
{
struct socket *so;
- struct mbuf *opts = NULL, *tmp_opts;
+ struct mbuf *opts;
struct udpcb *up;
INP_LOCK_ASSERT(inp);
@@ -149,7 +149,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
if (up->u_tun_func != NULL) {
in_pcbref(inp);
INP_RUNLOCK(inp);
- (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&fromsa[0],
+ (*up->u_tun_func)(n, off, inp, (struct sockaddr *)fromsa,
up->u_tun_ctx);
INP_RLOCK(inp);
return (in_pcbrele_rlocked(inp));
@@ -173,23 +173,11 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
if (inp->inp_flags & INP_CONTROLOPTS ||
inp->inp_socket->so_options & SO_TIMESTAMP)
ip6_savecontrol(inp, n, &opts);
- if (inp->inp_vflag & INP_IPV6 && inp->inp_flags2 & INP_ORIGDSTADDR) {
- tmp_opts = sbcreatecontrol((caddr_t)&fromsa[1],
- sizeof(struct sockaddr_in6), IP_ORIGDSTADDR, IPPROTO_IPV6);
- if (tmp_opts) {
- if (opts) {
- tmp_opts->m_next = opts;
- opts = tmp_opts;
- } else
- opts = tmp_opts;
- }
-
- }
m_adj(n, off + sizeof(struct udphdr));
so = inp->inp_socket;
SOCKBUF_LOCK(&so->so_rcv);
- if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&fromsa[0], n,
+ if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)fromsa, n,
opts) == 0) {
SOCKBUF_UNLOCK(&so->so_rcv);
m_freem(n);
@@ -214,7 +202,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
int off = *offp;
int cscov_partial;
int plen, ulen;
- struct sockaddr_in6 fromsa[2];
+ struct sockaddr_in6 fromsa;
struct m_tag *fwd_tag;
uint16_t uh_sum;
uint8_t nxt;
@@ -289,10 +277,8 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
/*
* Construct sockaddr format source address.
*/
- init_sin6(&fromsa[0], m, 0);
- fromsa[0].sin6_port = uh->uh_sport;
- init_sin6(&fromsa[1], m, 1);
- fromsa[1].sin6_port = uh->uh_dport;
+ init_sin6(&fromsa, m);
+ fromsa.sin6_port = uh->uh_sport;
pcbinfo = udp_get_inpcbinfo(nxt);
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
@@ -363,7 +349,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
blocked = im6o_mc_filter(imo, ifp,
(struct sockaddr *)&mcaddr,
- (struct sockaddr *)&fromsa[0]);
+ (struct sockaddr *)&fromsa);
if (blocked != MCAST_PASS) {
if (blocked == MCAST_NOTGMEMBER)
IP6STAT_INC(ip6s_notmember);
@@ -384,7 +370,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
INP_RLOCK(last);
UDP_PROBE(receive, NULL, last, ip6,
last, uh);
- if (udp6_append(last, n, off, fromsa))
+ if (udp6_append(last, n, off, &fromsa))
goto inp_lost;
INP_RUNLOCK(last);
}
@@ -416,7 +402,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
INP_RLOCK(last);
INP_INFO_RUNLOCK(pcbinfo);
UDP_PROBE(receive, NULL, last, ip6, last, uh);
- if (udp6_append(last, m, off, fromsa) == 0)
+ if (udp6_append(last, m, off, &fromsa) == 0)
INP_RUNLOCK(last);
inp_lost:
return (IPPROTO_DONE);
@@ -496,7 +482,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
}
}
UDP_PROBE(receive, NULL, inp, ip6, inp, uh);
- if (udp6_append(inp, m, off, fromsa) == 0)
+ if (udp6_append(inp, m, off, &fromsa) == 0)
INP_RUNLOCK(inp);
return (IPPROTO_DONE);