diff options
| author | Ermal Luçi <eri@FreeBSD.org> | 2017-02-12 06:56:33 +0000 |
|---|---|---|
| committer | Ermal Luçi <eri@FreeBSD.org> | 2017-02-12 06:56:33 +0000 |
| commit | c10c5b1eba5d85d538b7c1bc97f02da1d0d3cc76 (patch) | |
| tree | 7eb55180b788209b794a1e8c26022584f4a968f1 /sys | |
| parent | 8148f4f3d5627532262aa8f56a14a2f9b2230719 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netinet/in.h | 2 | ||||
| -rw-r--r-- | sys/netinet/in_pcb.c | 4 | ||||
| -rw-r--r-- | sys/netinet/in_pcb.h | 1 | ||||
| -rw-r--r-- | sys/netinet/ip_output.c | 10 | ||||
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 44 | ||||
| -rw-r--r-- | sys/netinet6/in6.h | 3 | ||||
| -rw-r--r-- | sys/netinet6/in6_pcb.c | 4 | ||||
| -rw-r--r-- | sys/netinet6/in6_pcb.h | 2 | ||||
| -rw-r--r-- | sys/netinet6/ip6_output.c | 8 | ||||
| -rw-r--r-- | sys/netinet6/raw_ip6.c | 2 | ||||
| -rw-r--r-- | sys/netinet6/udp6_usrreq.c | 34 |
11 files changed, 28 insertions, 86 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 0800512e5331a..6990235469712 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -433,8 +433,6 @@ __END_DECLS #define IP_BINDANY 24 /* bool: allow bind to any address */ #define IP_BINDMULTI 25 /* bool: allow multiple listeners on a tuple */ #define IP_RSS_LISTEN_BUCKET 26 /* int; set RSS listen bucket */ -#define IP_ORIGDSTADDR 27 /* bool: receive IP dst addr/port w/dgram */ -#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR /* * Options for controlling the firewall and dummynet. diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 9d66ca38f3c8a..c9717dde0ab2a 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2492,10 +2492,6 @@ db_print_inpflags(int inp_flags) db_printf("%sINP_RECVDSTADDR", comma ? ", " : ""); comma = 1; } - if (inp_flags & INP_ORIGDSTADDR) { - db_printf("%sINP_ORIGDSTADDR", comma ? ", " : ""); - comma = 1; - } if (inp_flags & INP_HDRINCL) { db_printf("%sINP_HDRINCL", comma ? ", " : ""); comma = 1; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index e57138483c157..3842695597c62 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -618,7 +618,6 @@ short inp_so_options(const struct inpcb *inp); #define INP_RECVFLOWID 0x00000100 /* populate recv datagram with flow info */ #define INP_RECVRSSBUCKETID 0x00000200 /* populate recv datagram with bucket id */ #define INP_RATE_LIMIT_CHANGED 0x00000400 /* rate limit needs attention */ -#define INP_ORIGDSTADDR 0x00000800 /* receive IP dst address/port */ /* * Flags passed to in_pcblookup*() functions. diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 53f259295e368..fc229d1f078b2 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1065,7 +1065,6 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) case IP_MINTTL: case IP_RECVOPTS: case IP_RECVRETOPTS: - case IP_ORIGDSTADDR: case IP_RECVDSTADDR: case IP_RECVTTL: case IP_RECVIF: @@ -1127,10 +1126,6 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) OPTSET(INP_RECVDSTADDR); break; - case IP_ORIGDSTADDR: - OPTSET2(INP_ORIGDSTADDR, optval); - break; - case IP_RECVTTL: OPTSET(INP_RECVTTL); break; @@ -1263,7 +1258,6 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) case IP_MINTTL: case IP_RECVOPTS: case IP_RECVRETOPTS: - case IP_ORIGDSTADDR: case IP_RECVDSTADDR: case IP_RECVTTL: case IP_RECVIF: @@ -1309,10 +1303,6 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt) optval = OPTBIT(INP_RECVDSTADDR); break; - case IP_ORIGDSTADDR: - optval = OPTBIT2(INP_ORIGDSTADDR); - break; - case IP_RECVTTL: optval = OPTBIT(INP_RECVTTL); break; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 3ede7dc087142..f24499dbd7f33 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -304,7 +304,7 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, { struct sockaddr *append_sa; struct socket *so; - struct mbuf *tmpopts, *opts = NULL; + struct mbuf *opts = NULL; #ifdef INET6 struct sockaddr_in6 udp_in6; #endif @@ -319,7 +319,7 @@ udp_append(struct inpcb *inp, struct ip *ip, 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 *)&udp_in[0], + (*up->u_tun_func)(n, off, inp, (struct sockaddr *)udp_in, up->u_tun_ctx); INP_RLOCK(inp); return (in_pcbrele_rlocked(inp)); @@ -355,27 +355,16 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, #endif /* INET6 */ ip_savecontrol(inp, &opts, ip, n); } - if (inp->inp_vflag & INP_IPV4 && inp->inp_flags2 & INP_ORIGDSTADDR) { - tmpopts = sbcreatecontrol((caddr_t)&udp_in[1], - sizeof(struct sockaddr_in), IP_ORIGDSTADDR, IPPROTO_IP); - if (tmpopts) { - if (opts) { - tmpopts->m_next = opts; - opts = tmpopts; - } else - opts = tmpopts; - } - } #ifdef INET6 if (inp->inp_vflag & INP_IPV6) { bzero(&udp_in6, sizeof(udp_in6)); udp_in6.sin6_len = sizeof(udp_in6); udp_in6.sin6_family = AF_INET6; - in6_sin_2_v4mapsin6(&udp_in[0], &udp_in6); + in6_sin_2_v4mapsin6(udp_in, &udp_in6); append_sa = (struct sockaddr *)&udp_in6; } else #endif /* INET6 */ - append_sa = (struct sockaddr *)&udp_in[0]; + append_sa = (struct sockaddr *)udp_in; m_adj(n, off); so = inp->inp_socket; @@ -401,7 +390,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) uint16_t len, ip_len; struct inpcbinfo *pcbinfo; struct ip save_ip; - struct sockaddr_in udpin[2]; + struct sockaddr_in udp_in; struct mbuf *m; struct m_tag *fwd_tag; int cscov_partial, iphlen; @@ -446,16 +435,11 @@ udp_input(struct mbuf **mp, int *offp, int proto) * Construct sockaddr format source address. Stuff source address * and datagram in user buffer. */ - bzero(&udpin[0], sizeof(struct sockaddr_in)); - udpin[0].sin_len = sizeof(struct sockaddr_in); - udpin[0].sin_family = AF_INET; - udpin[0].sin_port = uh->uh_sport; - udpin[0].sin_addr = ip->ip_src; - bzero(&udpin[1], sizeof(struct sockaddr_in)); - udpin[1].sin_len = sizeof(struct sockaddr_in); - udpin[1].sin_family = AF_INET; - udpin[1].sin_port = uh->uh_dport; - udpin[1].sin_addr = ip->ip_dst; + bzero(&udp_in, sizeof(udp_in)); + udp_in.sin_len = sizeof(udp_in); + udp_in.sin_family = AF_INET; + udp_in.sin_port = uh->uh_sport; + udp_in.sin_addr = ip->ip_src; /* * Make mbuf data length reflect UDP length. If not enough data to @@ -584,7 +568,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) blocked = imo_multi_filter(imo, ifp, (struct sockaddr *)&group, - (struct sockaddr *)&udpin[0]); + (struct sockaddr *)&udp_in); if (blocked != MCAST_PASS) { if (blocked == MCAST_NOTGMEMBER) IPSTAT_INC(ips_notmember); @@ -603,7 +587,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) UDP_PROBE(receive, NULL, last, ip, last, uh); if (udp_append(last, ip, n, iphlen, - udpin)) { + &udp_in)) { goto inp_lost; } } @@ -636,7 +620,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) goto badunlocked; } UDP_PROBE(receive, NULL, last, ip, last, uh); - if (udp_append(last, ip, m, iphlen, udpin) == 0) + if (udp_append(last, ip, m, iphlen, &udp_in) == 0) INP_RUNLOCK(last); inp_lost: INP_INFO_RUNLOCK(pcbinfo); @@ -726,7 +710,7 @@ udp_input(struct mbuf **mp, int *offp, int proto) } UDP_PROBE(receive, NULL, inp, ip, inp, uh); - if (udp_append(inp, ip, m, iphlen, udpin) == 0) + if (udp_append(inp, ip, m, iphlen, &udp_in) == 0) INP_RUNLOCK(inp); return (IPPROTO_DONE); diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index ae5809f8aaa4d..e913c0ab977a3 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -497,9 +497,6 @@ struct route_in6 { #define IPV6_RECVFLOWID 70 /* bool; receive IP6 flowid/flowtype w/ datagram */ #define IPV6_RECVRSSBUCKETID 71 /* bool; receive IP6 RSS bucket id w/ datagram */ -#define IPV6_ORIGDSTADDR 72 /* bool: allow getting dstaddr /port info */ -#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR - /* * The following option is private; do not use it from user applications. * It is deliberately defined to the same value as IP_MSFILTER. diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index bab5259f7ffea..ff8813b143475 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1267,7 +1267,7 @@ in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, } void -init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int srcordst) +init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m) { struct ip6_hdr *ip; @@ -1275,7 +1275,7 @@ init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int srcordst) bzero(sin6, sizeof(*sin6)); sin6->sin6_len = sizeof(*sin6); sin6->sin6_family = AF_INET6; - sin6->sin6_addr = srcordst ? ip->ip6_dst : ip->ip6_src; + sin6->sin6_addr = ip->ip6_src; (void)sa6_recoverscope(sin6); /* XXX: should catch errors... */ diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h index 1ff09ea93ba62..e758dacea3b8c 100644 --- a/sys/netinet6/in6_pcb.h +++ b/sys/netinet6/in6_pcb.h @@ -113,7 +113,7 @@ int in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam); int in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam); int in6_selecthlim(struct in6pcb *, struct ifnet *); int in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *); -void init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int); +void init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m); #endif /* _KERNEL */ #endif /* !_NETINET6_IN6_PCB_H_ */ diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index d8f8864d3e53a..6644361369cc6 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1545,7 +1545,6 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt) #endif case IPV6_V6ONLY: case IPV6_AUTOFLOWLABEL: - case IPV6_ORIGDSTADDR: case IPV6_BINDANY: case IPV6_BINDMULTI: #ifdef RSS @@ -1731,9 +1730,6 @@ do { \ OPTSET(IN6P_AUTOFLOWLABEL); break; - case IPV6_ORIGDSTADDR: - OPTSET2(INP_ORIGDSTADDR, optval); - break; case IPV6_BINDANY: OPTSET(INP_BINDANY); break; @@ -2022,10 +2018,6 @@ do { \ optval = OPTBIT(IN6P_AUTOFLOWLABEL); break; - case IPV6_ORIGDSTADDR: - optval = OPTBIT2(INP_ORIGDSTADDR); - break; - case IPV6_BINDANY: optval = OPTBIT(INP_BINDANY); break; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 9dd6577e6b525..3ffadef2426b8 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -166,7 +166,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) RIP6STAT_INC(rip6s_ipackets); - init_sin6(&fromsa, m, 0); /* general init */ + init_sin6(&fromsa, m); /* general init */ ifp = m->m_pkthdr.rcvif; 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); |
