/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | sockopt_sk.c | 24 socklen_t optlen; in getsetsockopt() local 35 optlen = getpagesize() * 2; in getsetsockopt() 36 big_buf = calloc(1, optlen); in getsetsockopt() 43 err = setsockopt(fd, SOL_IP, IP_TOS, big_buf, optlen); in getsetsockopt() 49 memset(big_buf, 0, optlen); in getsetsockopt() 50 optlen = 1; in getsetsockopt() 51 err = getsockopt(fd, SOL_IP, IP_TOS, big_buf, &optlen); in getsetsockopt() 82 optlen = 4; in getsetsockopt() 83 err = getsockopt(fd, SOL_CUSTOM, 0, &buf, &optlen); in getsetsockopt() 89 if (optlen != 1) { in getsetsockopt() [all …]
|
H A D | sockopt_multi.c | 12 socklen_t optlen; in run_getsockopt_test() local 26 optlen = 1; in run_getsockopt_test() 27 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test() 50 optlen = 1; in run_getsockopt_test() 51 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test() 75 optlen = 1; in run_getsockopt_test() 76 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test() 102 optlen = 1; in run_getsockopt_test() 103 err = getsockopt(sock_fd, SOL_IP, IP_TOS, &buf, &optlen); in run_getsockopt_test() 118 optlen = 1; in run_getsockopt_test() [all …]
|
H A D | sockopt.c | 237 offsetof(struct bpf_sockopt, optlen)), 267 offsetof(struct bpf_sockopt, optlen)), 335 offsetof(struct bpf_sockopt, optlen)), 514 offsetof(struct bpf_sockopt, optlen)), 569 offsetof(struct bpf_sockopt, optlen)), 617 offsetof(struct bpf_sockopt, optlen)), 624 offsetof(struct bpf_sockopt, optlen)), 646 offsetof(struct bpf_sockopt, optlen)), 663 offsetof(struct bpf_sockopt, optlen)), 682 offsetof(struct bpf_sockopt, optlen)), [all …]
|
/linux/net/ipv6/ |
H A D | ipv6_sockglue.c | 141 sockptr_t optval, int optlen) in copy_group_source_from_sockptr() argument 146 if (optlen < sizeof(gr32)) in copy_group_source_from_sockptr() 154 if (optlen < sizeof(*greqs)) in copy_group_source_from_sockptr() 164 sockptr_t optval, int optlen) in do_ipv6_mcast_group_source() argument 170 ret = copy_group_source_from_sockptr(&greqs, optval, optlen); in do_ipv6_mcast_group_source() 205 int optlen) in ipv6_set_mcast_msfilter() argument 210 if (optlen < GROUP_FILTER_SIZE(0)) in ipv6_set_mcast_msfilter() 212 if (optlen > READ_ONCE(sock_net(sk)->core.sysctl_optmem_max)) in ipv6_set_mcast_msfilter() 215 gsf = memdup_sockptr(optval, optlen); in ipv6_set_mcast_msfilter() 226 if (GROUP_FILTER_SIZE(gsf->gf_numsrc) > optlen) in ipv6_set_mcast_msfilter() [all …]
|
H A D | exthdrs_core.c | 136 int optlen; in ipv6_find_tlv() local 143 optlen = 1; in ipv6_find_tlv() 148 optlen = nh[offset + 1] + 2; in ipv6_find_tlv() 149 if (optlen > len) in ipv6_find_tlv() 153 offset += optlen; in ipv6_find_tlv() 154 len -= optlen; in ipv6_find_tlv()
|
/linux/net/mptcp/ |
H A D | sockopt.c | 59 unsigned int optlen, int *val) in mptcp_get_int_option() argument 61 if (optlen < sizeof(int)) in mptcp_get_int_option() 174 unsigned int optlen) in mptcp_setsockopt_sol_socket_int() argument 178 ret = mptcp_get_int_option(msk, optval, optlen, &val); in mptcp_setsockopt_sol_socket_int() 208 unsigned int optlen) in mptcp_setsockopt_sol_socket_timestamping() argument 215 if (optlen == sizeof(timestamping)) { in mptcp_setsockopt_sol_socket_timestamping() 219 } else if (optlen == sizeof(int)) { in mptcp_setsockopt_sol_socket_timestamping() 250 unsigned int optlen) in mptcp_setsockopt_sol_socket_linger() argument 258 if (optlen < sizeof(ling)) in mptcp_setsockopt_sol_socket_linger() 291 sockptr_t optval, unsigned int optlen) in mptcp_setsockopt_sol_socket() argument [all …]
|
/linux/net/ipv4/ |
H A D | ip_sockglue.c | 76 if (IPCB(skb)->opt.optlen == 0) in ip_cmsg_recv_opts() 79 put_cmsg(msg, SOL_IP, IP_RECVOPTS, IPCB(skb)->opt.optlen, in ip_cmsg_recv_opts() 90 if (IPCB(skb)->opt.optlen == 0) in ip_cmsg_recv_retopts() 99 put_cmsg(msg, SOL_IP, IP_RETOPTS, opt->optlen, opt->__data); in ip_cmsg_recv_retopts() 699 sockptr_t optval, int optlen) in copy_group_source_from_sockptr() argument 704 if (optlen != sizeof(gr32)) in copy_group_source_from_sockptr() 712 if (optlen != sizeof(*greqs)) in copy_group_source_from_sockptr() 722 sockptr_t optval, int optlen) in do_mcast_group_source() argument 729 err = copy_group_source_from_sockptr(&greqs, optval, optlen); in do_mcast_group_source() 769 static int ip_set_mcast_msfilter(struct sock *sk, sockptr_t optval, int optlen) in ip_set_mcast_msfilter() argument [all …]
|
H A D | cipso_ipv4.c | 1501 int optlen; in cipso_v4_optptr() local 1504 for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 1; ) { in cipso_v4_optptr() 1514 if (!taglen || taglen > optlen) in cipso_v4_optptr() 1519 optlen -= taglen; in cipso_v4_optptr() 1731 opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); in cipso_v4_error() 1815 int iter = 0, optlen = 0; in cipso_v4_get_actual_opt_len() local 1830 optlen = iter; in cipso_v4_get_actual_opt_len() 1833 return optlen; in cipso_v4_get_actual_opt_len() 1897 opt->opt.optlen = opt_len; in cipso_v4_sock_setattr() 1908 sk_conn->icsk_ext_hdr_len -= old->opt.optlen; in cipso_v4_sock_setattr() [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | sockopt_multi.c | 28 ctx->optlen = 1; in _getsockopt_child() 34 if (ctx->optlen > page_size) in _getsockopt_child() 35 ctx->optlen = 0; in _getsockopt_child() 57 ctx->optlen = 1; in _getsockopt_parent() 63 if (ctx->optlen > page_size) in _getsockopt_parent() 64 ctx->optlen = 0; in _getsockopt_parent() 81 ctx->optlen = 1; in _setsockopt() 87 if (ctx->optlen > page_size) in _setsockopt() 88 ctx->optlen = 0; in _setsockopt()
|
H A D | sockopt_sk.c | 98 ctx->optlen = 1; in _getsockopt() 128 ctx->optlen = 1; in _getsockopt() 134 if (ctx->optlen > page_size) in _getsockopt() 135 ctx->optlen = 0; in _getsockopt() 165 ctx->optlen = 0; /* bypass optval>PAGE_SIZE */ in _setsockopt() 176 ctx->optlen = 4; in _setsockopt() 188 ctx->optlen = 5; in _setsockopt() 195 if (ctx->optlen != page_size * 2) in _setsockopt() 203 ctx->optlen = 1; in _setsockopt() 227 ctx->optlen = -1; /* BPF has consumed this option, don't call kernel in _setsockopt() [all …]
|
H A D | cgroup_getset_retval_setsockopt.c | 23 if (ctx->optlen > page_size) in get_retval() 24 ctx->optlen = 0; in get_retval() 38 if (ctx->optlen > page_size) in set_eunatch() 39 ctx->optlen = 0; in set_eunatch() 53 if (ctx->optlen > page_size) in set_eisconn() 54 ctx->optlen = 0; in set_eisconn() 65 if (ctx->optlen > page_size) in legacy_eperm() 66 ctx->optlen = 0; in legacy_eperm()
|
H A D | cgroup_getset_retval_getsockopt.c | 25 if (ctx->optlen > page_size) in get_retval() 26 ctx->optlen = 0; in get_retval() 40 if (ctx->optlen > page_size) in set_eisconn() 41 ctx->optlen = 0; in set_eisconn() 54 if (ctx->optlen > page_size) in clear_retval() 55 ctx->optlen = 0; in clear_retval()
|
H A D | sockopt_inherit.c | 72 ctx->optlen = 1; in _getsockopt() 78 if (ctx->optlen > page_size) in _getsockopt() 79 ctx->optlen = 0; in _getsockopt() 101 ctx->optlen = -1; in _setsockopt() 107 if (ctx->optlen > page_size) in _setsockopt() 108 ctx->optlen = 0; in _setsockopt()
|
H A D | test_tcp_hdr_options.c | 164 __u8 optlen; in synack_opt_len() local 179 optlen = option_total_len(passive_synack_out.flags); in synack_opt_len() 180 if (optlen) { in synack_opt_len() 181 err = bpf_reserve_hdr_opt(skops, optlen, 0); in synack_opt_len() 208 __u8 optlen; in syn_opt_len() local 214 optlen = option_total_len(active_syn_out.flags); in syn_opt_len() 215 if (optlen) { in syn_opt_len() 216 err = bpf_reserve_hdr_opt(skops, optlen, 0); in syn_opt_len() 236 __u8 optlen; in fin_opt_len() local 251 optlen = option_total_len(opt->flags); in fin_opt_len() [all …]
|
H A D | test_ldsx_insn.c | 72 old_optlen = ctx->optlen; in _getsockopt() 75 ctx->optlen = -1; in _getsockopt() 79 set_optlen = ctx->optlen; in _getsockopt() 82 ctx->optlen = old_optlen; in _getsockopt()
|
/linux/net/sctp/ |
H A D | socket.c | 1389 int __user *optlen) in sctp_getsockopt_connectx3() argument 1426 if (put_user(sizeof(assoc_id), optlen)) in sctp_getsockopt_connectx3() 2212 unsigned int optlen) in sctp_setsockopt_disable_fragments() argument 2214 if (optlen < sizeof(int)) in sctp_setsockopt_disable_fragments() 2221 unsigned int optlen) in sctp_setsockopt_events() argument 2227 if (optlen > sizeof(struct sctp_event_subscribe)) in sctp_setsockopt_events() 2230 for (i = 0; i < optlen; i++) in sctp_setsockopt_events() 2270 unsigned int optlen) in sctp_setsockopt_autoclose() argument 2278 if (optlen != sizeof(int)) in sctp_setsockopt_autoclose() 2619 unsigned int optlen) in sctp_setsockopt_peer_addr_params() argument [all …]
|
/linux/Documentation/bpf/ |
H A D | prog_cgroup_sockopt.rst | 16 all input arguments: ``level``, ``optname``, ``optval`` and ``optlen``. 26 If BPF program sets ``optlen`` to -1, the control will be returned 30 Note, that ``optlen`` can not be increased beyond the user-supplied 44 sockopt. The BPF hook can observe ``optval``, ``optlen`` and ``retval`` 46 the values above, adjust ``optlen`` and reset ``retval`` to 0. If ``optlen`` 60 * ``1`` - success: copy ``optval`` and ``optlen`` to userspace, return 78 adjust ``optval``, ``optlen`` and reset ``retval`` to 0. After that 84 to the input arguments (``level``, ``optname``, ``optval``, ``optlen``), 94 * Set ``optlen`` to zero, which indicates that the kernel should 97 * Set ``optlen`` to the value less than ``PAGE_SIZE``, which [all …]
|
/linux/net/ipv6/netfilter/ |
H A D | ip6t_hbh.c | 57 unsigned int optlen; in hbh_mt6() local 137 optlen = *lp + 2; in hbh_mt6() 140 optlen = 1; in hbh_mt6() 144 pr_debug("len%04X\n", optlen); in hbh_mt6() 146 if ((ptr > skb->len - optlen || hdrlen < optlen) && in hbh_mt6() 151 ptr += optlen; in hbh_mt6() 152 hdrlen -= optlen; in hbh_mt6()
|
/linux/net/rds/ |
H A D | af_rds.c | 331 int optlen) in rds_set_bool_option() argument 335 if (optlen < sizeof(int)) in rds_set_bool_option() 343 static int rds_cong_monitor(struct rds_sock *rs, sockptr_t optval, int optlen) in rds_cong_monitor() argument 347 ret = rds_set_bool_option(&rs->rs_cong_monitor, optval, optlen); in rds_cong_monitor() 360 static int rds_set_transport(struct rds_sock *rs, sockptr_t optval, int optlen) in rds_set_transport() argument 367 if (optlen != sizeof(int)) in rds_set_transport() 382 int optlen, int optname) in rds_enable_recvtstamp() argument 386 if (optlen != sizeof(int)) in rds_enable_recvtstamp() 406 int optlen) in rds_recv_track_latency() argument 411 if (optlen != sizeof(struct rds_rx_trace_so)) in rds_recv_track_latency() [all …]
|
/linux/net/dccp/ |
H A D | proto.c | 415 sockptr_t optval, unsigned int optlen) in dccp_setsockopt_service() argument 421 optlen > DCCP_SERVICE_LIST_MAX_LEN * sizeof(u32)) in dccp_setsockopt_service() 424 if (optlen > sizeof(service)) { in dccp_setsockopt_service() 425 sl = kmalloc(optlen, GFP_KERNEL); in dccp_setsockopt_service() 429 sl->dccpsl_nr = optlen / sizeof(u32) - 1; in dccp_setsockopt_service() 431 sizeof(service), optlen - sizeof(service)) || in dccp_setsockopt_service() 485 sockptr_t optval, unsigned int optlen) in dccp_setsockopt_ccid() argument 490 if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) in dccp_setsockopt_ccid() 493 val = memdup_sockptr(optval, optlen); in dccp_setsockopt_ccid() 499 rc = dccp_feat_register_sp(sk, DCCPF_CCID, 1, val, optlen); in dccp_setsockopt_ccid() [all …]
|
/linux/net/netfilter/ |
H A D | xt_tcpmss.c | 33 unsigned int i, optlen; in tcpmss_mt() local 44 optlen = th->doff*4 - sizeof(*th); in tcpmss_mt() 45 if (!optlen) in tcpmss_mt() 49 op = skb_header_pointer(skb, par->thoff + sizeof(*th), optlen, _opt); in tcpmss_mt() 53 for (i = 0; i < optlen; ) { in tcpmss_mt() 55 && (optlen - i) >= TCPOLEN_MSS in tcpmss_mt()
|
/linux/net/tls/ |
H A D | tls_main.c | 438 int __user *optlen, int tx) in do_tls_getsockopt_conf() argument 447 if (get_user(len, optlen)) in do_tls_getsockopt_conf() 499 int __user *optlen) in do_tls_getsockopt_tx_zc() argument 505 if (get_user(len, optlen)) in do_tls_getsockopt_tx_zc() 519 int __user *optlen) in do_tls_getsockopt_no_pad() argument 527 if (get_user(len, optlen)) in do_tls_getsockopt_no_pad() 538 if (put_user(sizeof(value), optlen)) in do_tls_getsockopt_no_pad() 547 char __user *optval, int __user *optlen) in do_tls_getsockopt() argument 556 rc = do_tls_getsockopt_conf(sk, optval, optlen, in do_tls_getsockopt() 560 rc = do_tls_getsockopt_tx_zc(sk, optval, optlen); in do_tls_getsockopt() [all …]
|
/linux/kernel/bpf/ |
H A D | cgroup.c | 1818 int *optlen, char **kernel_optval) in __cgroup_bpf_run_filter_setsockopt() argument 1833 max_optlen = max_t(int, 16, *optlen); in __cgroup_bpf_run_filter_setsockopt() 1838 ctx.optlen = *optlen; in __cgroup_bpf_run_filter_setsockopt() 1841 min(*optlen, max_optlen))) { in __cgroup_bpf_run_filter_setsockopt() 1854 if (ctx.optlen == -1) { in __cgroup_bpf_run_filter_setsockopt() 1855 /* optlen set to -1, bypass kernel */ in __cgroup_bpf_run_filter_setsockopt() 1857 } else if (ctx.optlen > max_optlen || ctx.optlen < -1) { in __cgroup_bpf_run_filter_setsockopt() 1858 /* optlen i in __cgroup_bpf_run_filter_setsockopt() 1909 __cgroup_bpf_run_filter_getsockopt(struct sock * sk,int level,int optname,sockptr_t optval,sockptr_t optlen,int max_optlen,int retval) __cgroup_bpf_run_filter_getsockopt() argument 1994 __cgroup_bpf_run_filter_getsockopt_kern(struct sock * sk,int level,int optname,void * optval,int * optlen,int retval) __cgroup_bpf_run_filter_getsockopt_kern() argument [all...] |
/linux/net/xfrm/ |
H A D | xfrm_output.c | 228 int hdrlen, optlen; in xfrm4_beet_encap_add() local 231 optlen = XFRM_MODE_SKB_CB(skb)->optlen; in xfrm4_beet_encap_add() 232 if (unlikely(optlen)) in xfrm4_beet_encap_add() 233 hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); in xfrm4_beet_encap_add() 249 if (unlikely(optlen)) { in xfrm4_beet_encap_add() 250 if (WARN_ON(optlen < 0)) in xfrm4_beet_encap_add() 253 ph->padlen = 4 - (optlen & 4); in xfrm4_beet_encap_add() 254 ph->hdrlen = optlen / 8; in xfrm4_beet_encap_add() 358 int optlen, hdr_len; in xfrm6_beet_encap_add() local 361 optlen = XFRM_MODE_SKB_CB(skb)->optlen; in xfrm6_beet_encap_add() [all …]
|
/linux/io_uring/ |
H A D | uring_cmd.c | 305 int optlen, optname, level, err; in io_uring_cmd_getsockopt() local 314 optlen = READ_ONCE(cmd->sqe->optlen); in io_uring_cmd_getsockopt() 318 KERNEL_SOCKPTR(&optlen)); in io_uring_cmd_getsockopt() 323 return optlen; in io_uring_cmd_getsockopt() 331 int optname, optlen, level; in io_uring_cmd_setsockopt() local 337 optlen = READ_ONCE(cmd->sqe->optlen); in io_uring_cmd_setsockopt() 342 optlen); in io_uring_cmd_setsockopt()
|