MCPcopy Index your code
hub / github.com/F-Stack/f-stack / udp_ctloutput

Function udp_ctloutput

freebsd/netinet/udp_usrreq.c:969–1085  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967#endif /* INET */
968
969int
970udp_ctloutput(struct socket *so, struct sockopt *sopt)
971{
972 struct inpcb *inp;
973 struct udpcb *up;
974 int isudplite, error, optval;
975
976 error = 0;
977 isudplite = (so->so_proto->pr_protocol == IPPROTO_UDPLITE) ? 1 : 0;
978 inp = sotoinpcb(so);
979 KASSERT(inp != NULL, ("%s: inp == NULL", __func__));
980 INP_WLOCK(inp);
981 if (sopt->sopt_level != so->so_proto->pr_protocol) {
982#ifdef INET6
983 if (INP_CHECK_SOCKAF(so, AF_INET6)) {
984 INP_WUNLOCK(inp);
985 error = ip6_ctloutput(so, sopt);
986 }
987#endif
988#if defined(INET) && defined(INET6)
989 else
990#endif
991#ifdef INET
992 {
993 INP_WUNLOCK(inp);
994 error = ip_ctloutput(so, sopt);
995 }
996#endif
997 return (error);
998 }
999
1000 switch (sopt->sopt_dir) {
1001 case SOPT_SET:
1002 switch (sopt->sopt_name) {
1003#if defined(IPSEC) || defined(IPSEC_SUPPORT)
1004#ifdef INET
1005 case UDP_ENCAP:
1006 if (!IPSEC_ENABLED(ipv4)) {
1007 INP_WUNLOCK(inp);
1008 return (ENOPROTOOPT);
1009 }
1010 error = UDPENCAP_PCBCTL(inp, sopt);
1011 break;
1012#endif /* INET */
1013#endif /* IPSEC */
1014 case UDPLITE_SEND_CSCOV:
1015 case UDPLITE_RECV_CSCOV:
1016 if (!isudplite) {
1017 INP_WUNLOCK(inp);
1018 error = ENOPROTOOPT;
1019 break;
1020 }
1021 INP_WUNLOCK(inp);
1022 error = sooptcopyin(sopt, &optval, sizeof(optval),
1023 sizeof(optval));
1024 if (error != 0)
1025 break;
1026 inp = sotoinpcb(so);

Callers

nothing calls this directly

Calls 4

ip6_ctloutputFunction · 0.85
ip_ctloutputFunction · 0.85
sooptcopyinFunction · 0.85
sooptcopyoutFunction · 0.85

Tested by

no test coverage detected