83#include <sys/kernel.h>
88#include <sys/protosw.h>
90#include <sys/signalvar.h>
91#include <sys/socket.h>
92#include <sys/socketvar.h>
94#include <sys/sysctl.h>
95#include <sys/syslog.h>
99#include <net/if_var.h>
100#include <net/if_types.h>
101#include <net/route.h>
102#include <net/rss_config.h>
104#include <netinet/in.h>
105#include <netinet/in_kdtrace.h>
106#include <netinet/in_pcb.h>
107#include <netinet/in_systm.h>
108#include <netinet/in_var.h>
109#include <netinet/ip.h>
110#include <netinet/ip6.h>
111#include <netinet/icmp6.h>
112#include <netinet/ip_var.h>
113#include <netinet/udp.h>
114#include <netinet/udp_var.h>
115#include <netinet/udplite.h>
125#include <netipsec/ipsec_support.h>
127#include <security/mac/mac_framework.h>
130#define V_zero_checksum_port VNET(zero_checksum_port)
131SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET | CTLFLAG_RW,
132 &VNET_NAME(zero_checksum_port), 0,
133 "Zero UDP checksum allowed for traffic to/from this port.");
139extern struct protosw
inetsw[];
147 struct mbuf *opts = NULL, *tmp_opts;
150 INP_LOCK_ASSERT(inp);
156 if (up->u_tun_func != NULL) {
159 (*up->u_tun_func)(n, off, inp, (
struct sockaddr *)&fromsa[0],
162 return (in_pcbrele_rlocked(inp));
164#if defined(IPSEC) || defined(IPSEC_SUPPORT)
166 if (IPSEC_ENABLED(ipv6)) {
167 if (IPSEC_CHECK_POLICY(ipv6, n, inp) != 0) {
174 if (mac_inpcb_check_deliver(inp, n) != 0) {
180 if (inp->inp_flags & INP_CONTROLOPTS ||
181 inp->inp_socket->so_options & SO_TIMESTAMP)
183 if ((inp->inp_vflag & INP_IPV6) && (inp->inp_flags2 & INP_ORIGDSTADDR)) {
184 tmp_opts = sbcreatecontrol((caddr_t)&fromsa[1],
188 tmp_opts->m_next = opts;
194 m_adj(n, off +
sizeof(
struct udphdr));
196 so = inp->inp_socket;
197 SOCKBUF_LOCK(&so->so_rcv);
198 if (sbappendaddr_locked(&so->so_rcv, (
struct sockaddr *)&fromsa[0], n,
200 soroverflow_locked(so);
204 UDPSTAT_INC(udps_fullsock);
206 sorwakeup_locked(so);
220 if ((inp->inp_vflag & INP_IPV6) == 0)
222 if (inp->inp_lport != ctx->
uh->uh_dport)
224 if (inp->inp_fport != 0 && inp->inp_fport != ctx->
uh->uh_sport)
231 inp->inp_fport != ctx->
uh->uh_sport))
242 struct inpcb_iterator inpi = INP_ITERATOR(udp_get_inpcbinfo(proto),
245 struct ip6_moptions *imo;
264 ctx.
ip6 = mtod(m,
struct ip6_hdr *);
265 ctx.
uh = (
struct udphdr *)((
char *)ctx.
ip6 + off);
266 while ((inp = inp_next(&inpi)) != NULL) {
267 INP_RLOCK_ASSERT(inp);
278 if ((imo = inp->in6p_moptions) != NULL) {
288 (
struct sockaddr *)&mcaddr,
289 (
struct sockaddr *)&fromsa[0]);
290 if (blocked != MCAST_PASS) {
291 if (blocked == MCAST_NOTGMEMBER)
293 if (blocked == MCAST_NOTSMEMBER ||
294 blocked == MCAST_MUTED)
295 UDPSTAT_INC(udps_filtermcast);
299 if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
300 if (proto == IPPROTO_UDPLITE)
301 UDPLITE_PROBE(receive, NULL, inp, ctx.
ip6,
304 UDP_PROBE(receive, NULL, inp, ctx.
ip6, inp,
320 if ((inp->inp_socket->so_options &
321 (SO_REUSEPORT|SO_REUSEPORT_LB|SO_REUSEADDR)) == 0) {
334 UDPSTAT_INC(udps_noport);
335 UDPSTAT_INC(udps_noportmcast);
338 return (IPPROTO_DONE);
344 struct mbuf *m = *mp;
348 struct inpcbinfo *pcbinfo;
354 struct m_tag *fwd_tag;
360 if (m->m_len < off +
sizeof(
struct udphdr)) {
361 m = m_pullup(m, off +
sizeof(
struct udphdr));
365 return (IPPROTO_DONE);
368 ip6 = mtod(m,
struct ip6_hdr *);
369 uh = (
struct udphdr *)((caddr_t)ip6 + off);
371 UDPSTAT_INC(udps_ipackets);
376 if (uh->uh_dport == 0)
379 plen = ntohs(ip6->ip6_plen) - off +
sizeof(*ip6);
380 ulen = ntohs((u_short)uh->uh_ulen);
383 cscov_partial = (nxt == IPPROTO_UDPLITE) ? 1 : 0;
384 if (nxt == IPPROTO_UDPLITE) {
390 if ((ulen <
sizeof(
struct udphdr)) || (ulen > plen)) {
394 if (uh->uh_sum == 0) {
399 if ((ulen <
sizeof(
struct udphdr)) || (plen != ulen)) {
400 UDPSTAT_INC(udps_badlen);
403 if (uh->uh_sum == 0) {
404 UDPSTAT_INC(udps_nosum);
416 if ((m->m_pkthdr.csum_flags & CSUM_DATA_VALID_IPV6) &&
418 if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR)
419 uh_sum = m->m_pkthdr.csum_data;
422 m->m_pkthdr.csum_data);
428 UDPSTAT_INC(udps_badsum);
441 pcbinfo = udp_get_inpcbinfo(nxt);
455 (fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) {
465 uh->uh_sport, &ip6->ip6_dst, uh->uh_dport,
466 INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif, m);
476 uh->uh_dport, INPLOOKUP_WILDCARD |
477 INPLOOKUP_RLOCKPCB, m->m_pkthdr.rcvif);
480 m_tag_delete(m, fwd_tag);
481 m->m_flags &= ~M_IP6_NEXTHOP;
484 uh->uh_sport, &ip6->ip6_dst, uh->uh_dport,
485 INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB,
486 m->m_pkthdr.rcvif, m);
488 if (V_udp_log_in_vain) {
493 "Connection attempt to UDP [%s]:%d from [%s]:%d\n",
497 ntohs(uh->uh_sport));
499 if (nxt == IPPROTO_UDPLITE)
500 UDPLITE_PROBE(receive, NULL, NULL, ip6, NULL, uh);
502 UDP_PROBE(receive, NULL, NULL, ip6, NULL, uh);
503 UDPSTAT_INC(udps_noport);
504 if (m->m_flags & M_MCAST) {
505 printf(
"UDP6: M_MCAST is set in a unicast packet.\n");
506 UDPSTAT_INC(udps_noportmcast);
509 if (V_udp_blackhole && (V_udp_blackhole_local ||
512 icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOPORT, 0);
514 return (IPPROTO_DONE);
516 INP_RLOCK_ASSERT(inp);
519 if (up->u_rxcslen == 0 || up->u_rxcslen > ulen) {
523 return (IPPROTO_DONE);
526 if (nxt == IPPROTO_UDPLITE)
527 UDPLITE_PROBE(receive, NULL, inp, ip6, inp, uh);
529 UDP_PROBE(receive, NULL, inp, ip6, inp, uh);
533 return (IPPROTO_DONE);
538 return (IPPROTO_DONE);
543 struct inpcbinfo *pcbinfo)
552 struct inpcb *(*notify)(
struct inpcb *, int) = udp_notify;
553 struct udp_portonly {
558 if (sa->sa_family != AF_INET6 ||
562 if ((
unsigned)cmd >= PRC_NCMDS)
564 if (PRC_IS_REDIRECT(cmd))
566 else if (cmd == PRC_HOSTDEAD)
593 if (m->m_pkthdr.len < off +
sizeof(*uhp))
596 bzero(&uh,
sizeof(uh));
597 m_copydata(m, off,
sizeof(*uhp), (caddr_t)&uh);
599 if (!PRC_IS_REDIRECT(cmd)) {
603 uh.uh_dport, &ip6->ip6_src, uh.uh_sport,
604 INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB,
605 m->m_pkthdr.rcvif, m);
610 if (up->u_icmp_func) {
613 (*up->u_icmp_func)(cmd, (
struct sockaddr *)ip6cp->
ip6c_src,
623 (
struct sockaddr *)ip6cp->
ip6c_src, uh.uh_sport, cmd,
627 (
const struct sockaddr *)sa6_src, 0, cmd, cmdarg, notify);
649 struct epoch_tracker et;
653 error = priv_check(req->td, PRIV_NETINET_GETCRED);
657 if (req->newlen !=
sizeof(addrs))
659 if (req->oldlen !=
sizeof(
struct xucred))
661 error = SYSCTL_IN(req, addrs,
sizeof(addrs));
670 addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port,
671 INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL);
674 INP_RLOCK_ASSERT(inp);
675 if (inp->inp_socket == NULL)
678 error = cr_canseesocket(req->td->td_ucred,
681 cru2x(inp->inp_cred, &xuc);
686 error = SYSCTL_OUT(req, &xuc,
sizeof(
struct xucred));
691 CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE,
693 "Get the xucred of a UDP6 connection");
697 struct sockaddr *addr6,
struct mbuf *control,
struct thread *td)
702 struct in6_addr *laddr, *faddr, in6a;
705 struct epoch_tracker et;
706 int cscov_partial, error, flags, hlen, scope_ambiguous;
707 u_int32_t ulen, plen;
745 KASSERT(inp != NULL, (
"%s: inp == NULL", __func__));
759 inp->inp_lport == 0))
764 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
765 IPPROTO_UDP : IPPROTO_UDPLITE;
768 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
772 hasv4addr = (inp->inp_vflag & INP_IPV4);
777 struct pr_usrreqs *pru;
790 pru =
inetsw[ip_protox[nxt]].pr_usrreqs;
792 return ((*pru->pru_send)(so, flags_arg | PRUS_IPV6, m,
793 (
struct sockaddr *)
sin6, control, td));
812 inp->in6p_outputopts, td->td_ucred, nxt)) != 0) {
817 optp = inp->in6p_outputopts;
827 error = EADDRNOTAVAIL;
842 (
"%s: sin6(%p)->sin6_addr is v4mapped which we "
843 "should have handled.", __func__,
sin6));
847 td->td_ucred, scope_ambiguous, &in6a, NULL);
852 if (inp->inp_lport == 0) {
853 struct inpcbinfo *pcbinfo;
855 INP_WLOCK_ASSERT(inp);
857 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
858 INP_HASH_WLOCK(pcbinfo);
860 INP_HASH_WUNLOCK(pcbinfo);
875 laddr = &inp->in6p_laddr;
876 faddr = &inp->in6p_faddr;
877 fport = inp->inp_fport;
880 ulen = m->m_pkthdr.len;
881 plen =
sizeof(
struct udphdr) + ulen;
882 hlen =
sizeof(
struct ip6_hdr);
888 M_PREPEND(m, hlen +
sizeof(
struct udphdr), M_NOWAIT);
897 cscov = cscov_partial = 0;
898 udp6 = (
struct udphdr *)(mtod(m, caddr_t) + hlen);
899 udp6->uh_sport = inp->inp_lport;
900 udp6->uh_dport = fport;
901 if (nxt == IPPROTO_UDPLITE) {
905 cscov = up->u_txcslen;
908 udp6->uh_ulen = htons(cscov);
913 cscov_partial = (cscov == 0) ? 0 : 1;
914 }
else if (plen <= 0xffff)
915 udp6->uh_ulen = htons((u_short)plen);
920 ip6 = mtod(m,
struct ip6_hdr *);
921 ip6->ip6_flow = inp->inp_flow & IPV6_FLOWINFO_MASK;
922 ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
923 ip6->ip6_vfc |= IPV6_VERSION;
924 ip6->ip6_plen = htons((u_short)plen);
927 ip6->ip6_src = *laddr;
928 ip6->ip6_dst = *faddr;
931 mac_inpcb_create_mbuf(inp, m);
936 sizeof(
struct ip6_hdr), plen, cscov)) == 0)
937 udp6->uh_sum = 0xffff;
940 m->m_pkthdr.csum_flags = CSUM_UDP_IPV6;
941 m->m_pkthdr.csum_data = offsetof(
struct udphdr, uh_sum);
945#if defined(ROUTE_MPATH) || defined(RSS)
946 if (CALC_FLOWID_OUTBOUND_SENDTO) {
947 uint32_t hash_type, hash_val;
950 pr = inp->inp_socket->so_proto->pr_protocol;
952 hash_val = fib6_calc_packet_hash(laddr, faddr,
953 inp->inp_lport, fport, pr, &hash_type);
954 m->m_pkthdr.flowid = hash_val;
955 M_HASHTYPE_SET(m, hash_type);
958 flags |= IP_NODEFAULTFLOWID;
961 UDPSTAT_INC(udps_opackets);
962 if (nxt == IPPROTO_UDPLITE)
963 UDPLITE_PROBE(send, NULL, inp, ip6, inp, udp6);
965 UDP_PROBE(send, NULL, inp, ip6, inp, udp6);
967 INP_WLOCKED(inp) ? &inp->inp_route6 : NULL, flags,
968 inp->in6p_moptions, NULL, inp);
994 struct inpcbinfo *pcbinfo;
996 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
998 KASSERT(inp != NULL, (
"udp6_abort: inp == NULL"));
1002 if (inp->inp_vflag & INP_IPV4) {
1003 struct pr_usrreqs *pru;
1006 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
1007 IPPROTO_UDP : IPPROTO_UDPLITE;
1009 pru =
inetsw[ip_protox[nxt]].pr_usrreqs;
1010 (*pru->pru_abort)(so);
1016 INP_HASH_WLOCK(pcbinfo);
1019 INP_HASH_WUNLOCK(pcbinfo);
1020 soisdisconnected(so);
1029 struct inpcbinfo *pcbinfo;
1032 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1033 inp = sotoinpcb(so);
1034 KASSERT(inp == NULL, (
"udp6_attach: inp != NULL"));
1036 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
1037 error = soreserve(so, udp_sendspace, udp_recvspace);
1041 error = in_pcballoc(so, pcbinfo);
1044 inp = (
struct inpcb *)so->so_pcb;
1045 inp->inp_vflag |= INP_IPV6;
1046 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0)
1047 inp->inp_vflag |= INP_IPV4;
1048 inp->in6p_hops = -1;
1049 inp->in6p_cksum = -1;
1056 inp->inp_ip_ttl = V_ip_defttl;
1058 error = udp_newudpcb(inp);
1069udp6_bind(
struct socket *so,
struct sockaddr *nam,
struct thread *td)
1072 struct inpcbinfo *pcbinfo;
1076 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1077 inp = sotoinpcb(so);
1078 KASSERT(inp != NULL, (
"udp6_bind: inp == NULL"));
1080 if (nam->sa_family != AF_INET6)
1081 return (EAFNOSUPPORT);
1086 INP_HASH_WLOCK(pcbinfo);
1087 vflagsav = inp->inp_vflag;
1088 inp->inp_vflag &= ~INP_IPV4;
1089 inp->inp_vflag |= INP_IPV6;
1090 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
1096 inp->inp_vflag |= INP_IPV4;
1099 struct sockaddr_in sin;
1102 inp->inp_vflag |= INP_IPV4;
1103 inp->inp_vflag &= ~INP_IPV6;
1104 error = in_pcbbind(inp, (
struct sockaddr *)&sin,
1116 inp->inp_vflag = vflagsav;
1117 INP_HASH_WUNLOCK(pcbinfo);
1126 struct inpcbinfo *pcbinfo;
1128 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1129 inp = sotoinpcb(so);
1130 KASSERT(inp != NULL, (
"udp6_close: inp == NULL"));
1134 if (inp->inp_vflag & INP_IPV4) {
1135 struct pr_usrreqs *pru;
1138 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
1139 IPPROTO_UDP : IPPROTO_UDPLITE;
1141 pru =
inetsw[ip_protox[nxt]].pr_usrreqs;
1142 (*pru->pru_disconnect)(so);
1147 INP_HASH_WLOCK(pcbinfo);
1150 INP_HASH_WUNLOCK(pcbinfo);
1151 soisdisconnected(so);
1160 struct epoch_tracker et;
1163 struct inpcbinfo *pcbinfo;
1168 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1169 inp = sotoinpcb(so);
1170 KASSERT(inp != NULL, (
"udp6_connect: inp == NULL"));
1174 return (EAFNOSUPPORT);
1184 struct sockaddr_in sin;
1186 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
1190 if ((inp->inp_vflag & INP_IPV4) == 0) {
1191 error = EAFNOSUPPORT;
1194 if (inp->inp_faddr.s_addr != INADDR_ANY) {
1199 error = prison_remote_ip4(td->td_ucred, &sin.sin_addr);
1202 vflagsav = inp->inp_vflag;
1203 inp->inp_vflag |= INP_IPV4;
1204 inp->inp_vflag &= ~INP_IPV6;
1205 NET_EPOCH_ENTER(et);
1206 INP_HASH_WLOCK(pcbinfo);
1207 error = in_pcbconnect(inp, (
struct sockaddr *)&sin,
1208 td->td_ucred,
true);
1209 INP_HASH_WUNLOCK(pcbinfo);
1218 else if (inp->inp_laddr.s_addr == INADDR_ANY &&
1219 inp->inp_lport == 0)
1220 inp->inp_vflag = vflagsav;
1223 if ((inp->inp_vflag & INP_IPV6) == 0) {
1224 error = EAFNOSUPPORT;
1236 vflagsav = inp->inp_vflag;
1237 inp->inp_vflag &= ~INP_IPV4;
1238 inp->inp_vflag |= INP_IPV6;
1239 INP_HASH_WLOCK(pcbinfo);
1241 INP_HASH_WUNLOCK(pcbinfo);
1250 inp->inp_lport == 0)
1251 inp->inp_vflag = vflagsav;
1263 inp = sotoinpcb(so);
1264 KASSERT(inp != NULL, (
"udp6_detach: inp == NULL"));
1267 up = intoudpcb(inp);
1268 KASSERT(up != NULL, (
"%s: up == NULL", __func__));
1278 struct inpcbinfo *pcbinfo;
1280 pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
1281 inp = sotoinpcb(so);
1282 KASSERT(inp != NULL, (
"udp6_disconnect: inp == NULL"));
1286 if (inp->inp_vflag & INP_IPV4) {
1287 struct pr_usrreqs *pru;
1290 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
1291 IPPROTO_UDP : IPPROTO_UDPLITE;
1293 pru =
inetsw[ip_protox[nxt]].pr_usrreqs;
1294 (void)(*pru->pru_disconnect)(so);
1304 INP_HASH_WLOCK(pcbinfo);
1307 INP_HASH_WUNLOCK(pcbinfo);
1309 so->so_state &= ~SS_ISCONNECTED;
1317 struct sockaddr *addr,
struct mbuf *control,
struct thread *td)
1326 if (addr->sa_family != AF_INET6) {
1327 error = EAFNOSUPPORT;
1332 return (
udp6_output(so, flags, m, addr, control, td));
1351 .pru_shutdown = udp_shutdown,
1353 .pru_soreceive = soreceive_dgram,
1354 .pru_sosend = sosend_dgram,
1355 .pru_sosetlabel = in_pcbsosetlabel,
void icmp6_error(struct mbuf *m, int type, int code, int param)
void in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6)
char * ip6_sprintf(char *ip6buf, const struct in6_addr *addr)
int in6_localaddr(struct in6_addr *in6)
void in6_sin6_2_sin_in_sock(struct sockaddr *nam)
const struct sockaddr_in6 sa6_any
const struct in6_addr in6addr_any
int in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td)
int in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t)
#define IN6_IS_ADDR_UNSPECIFIED(a)
int in6_cksum_partial(struct mbuf *, u_int8_t, u_int32_t, u_int32_t, u_int32_t)
#define IN6_ARE_ADDR_EQUAL(a, b)
#define IN6_IS_ADDR_V4MAPPED(a)
#define IN6_IS_ADDR_MULTICAST(a)
int prison_remote_ip6(struct ucred *cred, struct in6_addr *ia6)
int im6o_mc_filter(const struct ip6_moptions *imo, const struct ifnet *ifp, const struct sockaddr *group, const struct sockaddr *src)
int in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam)
struct inpcb * in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp, struct mbuf *m)
void in6_pcbdisconnect(struct inpcb *inp)
struct inpcb * in6_rtchange(struct inpcb *inp, int errno __unused)
void init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int srcordst)
int in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam)
int in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
void in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr *dst, u_int fport_arg, const struct sockaddr *src, u_int lport_arg, int cmd, void *cmdarg, struct inpcb *(*notify)(struct inpcb *, int))
int in6_pcbsetport(struct in6_addr *laddr, struct inpcb *inp, struct ucred *cred)
int in6_pcbbind(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
struct inpcb * in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp)
int in6_selecthlim(struct inpcb *, struct ifnet *)
int in6_selectsrc_socket(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct inpcb *inp, struct ucred *cred, int scope_ambiguous, struct in6_addr *srcp, int *hlim)
static struct sockaddr_in6 sin6
void ip6_clearpktopts(struct ip6_pktopts *pktopt, int optname)
int ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, int flags, struct ip6_moptions *im6o, struct ifnet **ifpp, struct inpcb *inp)
int ip6_setpktopts(struct mbuf *control, struct ip6_pktopts *opt, struct ip6_pktopts *stickyopt, struct ucred *cred, int uproto)
#define IP6STAT_INC(name)
#define V_ip6_use_defzone
int sa6_embedscope(struct sockaddr_in6 *sin6, int defaultok)
struct ip6_hdr * ip6c_ip6
struct sockaddr_in6 * ip6c_src
struct in6_addr sin6_addr
struct pr_usrreqs udp6_usrreqs
SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(zero_checksum_port), 0, "Zero UDP checksum allowed for traffic to/from this port.")
static void udp6_abort(struct socket *so)
static void udp6_detach(struct socket *so)
SYSCTL_PROC(_net_inet6_udp6, OID_AUTO, getcred, CTLTYPE_OPAQUE|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, 0, udp6_getcred, "S,xucred", "Get the xucred of a UDP6 connection")
static bool udp6_multi_match(const struct inpcb *inp, void *v)
static int udp6_disconnect(struct socket *so)
void udplite6_ctlinput(int cmd, struct sockaddr *sa, void *d)
static int udp6_attach(struct socket *so, int proto, struct thread *td)
#define V_zero_checksum_port
static void udp6_close(struct socket *so)
VNET_DEFINE(int, zero_checksum_port)=0
static int udp6_multi_input(struct mbuf *m, int off, int proto, struct sockaddr_in6 *fromsa)
int udp6_input(struct mbuf **mp, int *offp, int proto)
static int udp6_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
static int udp6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td)
static void udp6_common_ctlinput(int cmd, struct sockaddr *sa, void *d, struct inpcbinfo *pcbinfo)
static int udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
static int udp6_append(struct inpcb *inp, struct mbuf *n, int off, struct sockaddr_in6 *fromsa)
void udp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
static int udp6_output(struct socket *so, int flags_arg, struct mbuf *m, struct sockaddr *addr6, struct mbuf *control, struct thread *td)
static int udp6_getcred(SYSCTL_HANDLER_ARGS)