MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip_ctloutput

Function ip_ctloutput

freebsd/netinet/ip_output.c:1096–1588  ·  view source on GitHub ↗

* IP socket option processing. */

Source from the content-addressed store, hash-verified

1094 * IP socket option processing.
1095 */
1096int
1097ip_ctloutput(struct socket *so, struct sockopt *sopt)
1098{
1099 struct inpcb *inp = sotoinpcb(so);
1100 int error, optval;
1101#ifdef RSS
1102 uint32_t rss_bucket;
1103 int retval;
1104#endif
1105
1106 error = optval = 0;
1107 if (sopt->sopt_level != IPPROTO_IP) {
1108 error = EINVAL;
1109
1110 if (sopt->sopt_level == SOL_SOCKET &&
1111 sopt->sopt_dir == SOPT_SET) {
1112 switch (sopt->sopt_name) {
1113 case SO_REUSEADDR:
1114 INP_WLOCK(inp);
1115 if ((so->so_options & SO_REUSEADDR) != 0)
1116 inp->inp_flags2 |= INP_REUSEADDR;
1117 else
1118 inp->inp_flags2 &= ~INP_REUSEADDR;
1119 INP_WUNLOCK(inp);
1120 error = 0;
1121 break;
1122 case SO_REUSEPORT:
1123 INP_WLOCK(inp);
1124 if ((so->so_options & SO_REUSEPORT) != 0)
1125 inp->inp_flags2 |= INP_REUSEPORT;
1126 else
1127 inp->inp_flags2 &= ~INP_REUSEPORT;
1128 INP_WUNLOCK(inp);
1129 error = 0;
1130 break;
1131 case SO_REUSEPORT_LB:
1132 INP_WLOCK(inp);
1133 if ((so->so_options & SO_REUSEPORT_LB) != 0)
1134 inp->inp_flags2 |= INP_REUSEPORT_LB;
1135 else
1136 inp->inp_flags2 &= ~INP_REUSEPORT_LB;
1137 INP_WUNLOCK(inp);
1138 error = 0;
1139 break;
1140 case SO_SETFIB:
1141 INP_WLOCK(inp);
1142 inp->inp_inc.inc_fibnum = so->so_fibnum;
1143 INP_WUNLOCK(inp);
1144 error = 0;
1145 break;
1146 case SO_MAX_PACING_RATE:
1147#ifdef RATELIMIT
1148 INP_WLOCK(inp);
1149 inp->inp_flags2 |= INP_RATE_LIMIT_CHANGED;
1150 INP_WUNLOCK(inp);
1151 error = 0;
1152#else
1153 error = EOPNOTSUPP;

Callers 4

udp_ctloutputFunction · 0.85
sctp_ctloutputFunction · 0.85
rip_ctloutputFunction · 0.85
tcp_ctloutputFunction · 0.85

Calls 12

sooptcopyinFunction · 0.85
ip_pcboptsFunction · 0.85
rss_getnumbucketsFunction · 0.85
inp_setmoptionsFunction · 0.85
m_copymFunction · 0.85
sooptcopyoutFunction · 0.85
rss_hash2bucketFunction · 0.85
inp_getmoptionsFunction · 0.85
m_getFunction · 0.50
m_freeFunction · 0.50
priv_checkFunction · 0.50
m_freemFunction · 0.50

Tested by

no test coverage detected