Lines Matching +full:write +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0
26 static int tcp_adv_win_scale_min = -31;
57 if (same_parity && !net->ipv4.ip_local_ports.warned) { in set_local_port_range()
58 net->ipv4.ip_local_ports.warned = true; in set_local_port_range()
61 WRITE_ONCE(net->ipv4.ip_local_ports.range, high << 16 | low); in set_local_port_range()
65 static int ipv4_local_port_range(const struct ctl_table *table, int write, in ipv4_local_port_range() argument
68 struct net *net = table->data; in ipv4_local_port_range()
72 .data = &range, in ipv4_local_port_range()
74 .mode = table->mode, in ipv4_local_port_range()
81 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); in ipv4_local_port_range()
83 if (write && ret == 0) { in ipv4_local_port_range()
89 (range[0] < READ_ONCE(net->ipv4.sysctl_ip_prot_sock))) in ipv4_local_port_range()
90 ret = -EINVAL; in ipv4_local_port_range()
99 static int ipv4_privileged_ports(const struct ctl_table *table, int write, in ipv4_privileged_ports() argument
102 struct net *net = container_of(table->data, struct net, in ipv4_privileged_ports()
108 .data = &pports, in ipv4_privileged_ports()
110 .mode = table->mode, in ipv4_privileged_ports()
115 pports = READ_ONCE(net->ipv4.sysctl_ip_prot_sock); in ipv4_privileged_ports()
117 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); in ipv4_privileged_ports()
119 if (write && ret == 0) { in ipv4_privileged_ports()
125 ret = -EINVAL; in ipv4_privileged_ports()
127 WRITE_ONCE(net->ipv4.sysctl_ip_prot_sock, pports); in ipv4_privileged_ports()
136 kgid_t *data = table->data; in inet_get_ping_group_range_table() local
138 container_of(table->data, struct net, ipv4.ping_group_range.range); in inet_get_ping_group_range_table()
141 seq = read_seqbegin(&net->ipv4.ping_group_range.lock); in inet_get_ping_group_range_table()
143 *low = data[0]; in inet_get_ping_group_range_table()
144 *high = data[1]; in inet_get_ping_group_range_table()
145 } while (read_seqretry(&net->ipv4.ping_group_range.lock, seq)); in inet_get_ping_group_range_table()
152 kgid_t *data = table->data; in set_ping_group_range() local
154 container_of(table->data, struct net, ipv4.ping_group_range.range); in set_ping_group_range()
155 write_seqlock(&net->ipv4.ping_group_range.lock); in set_ping_group_range()
156 data[0] = low; in set_ping_group_range()
157 data[1] = high; in set_ping_group_range()
158 write_sequnlock(&net->ipv4.ping_group_range.lock); in set_ping_group_range()
162 static int ipv4_ping_group_range(const struct ctl_table *table, int write, in ipv4_ping_group_range() argument
170 .data = &urange, in ipv4_ping_group_range()
172 .mode = table->mode, in ipv4_ping_group_range()
180 ret = proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos); in ipv4_ping_group_range()
182 if (write && ret == 0) { in ipv4_ping_group_range()
186 return -EINVAL; in ipv4_ping_group_range()
197 static int ipv4_fwd_update_priority(const struct ctl_table *table, int write, in ipv4_fwd_update_priority() argument
203 net = container_of(table->data, struct net, in ipv4_fwd_update_priority()
205 ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos); in ipv4_fwd_update_priority()
206 if (write && ret == 0) in ipv4_fwd_update_priority()
213 static int proc_tcp_congestion_control(const struct ctl_table *ctl, int write, in proc_tcp_congestion_control() argument
216 struct net *net = container_of(ctl->data, struct net, in proc_tcp_congestion_control()
220 .data = val, in proc_tcp_congestion_control()
227 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_tcp_congestion_control()
228 if (write && ret == 0) in proc_tcp_congestion_control()
234 int write, void *buffer, in proc_tcp_available_congestion_control() argument
240 tbl.data = kmalloc(tbl.maxlen, GFP_USER); in proc_tcp_available_congestion_control()
241 if (!tbl.data) in proc_tcp_available_congestion_control()
242 return -ENOMEM; in proc_tcp_available_congestion_control()
243 tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); in proc_tcp_available_congestion_control()
244 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_tcp_available_congestion_control()
245 kfree(tbl.data); in proc_tcp_available_congestion_control()
250 int write, void *buffer, in proc_allowed_congestion_control() argument
256 tbl.data = kmalloc(tbl.maxlen, GFP_USER); in proc_allowed_congestion_control()
257 if (!tbl.data) in proc_allowed_congestion_control()
258 return -ENOMEM; in proc_allowed_congestion_control()
260 tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); in proc_allowed_congestion_control()
261 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_allowed_congestion_control()
262 if (write && ret == 0) in proc_allowed_congestion_control()
263 ret = tcp_set_allowed_congestion_control(tbl.data); in proc_allowed_congestion_control()
264 kfree(tbl.data); in proc_allowed_congestion_control()
273 if (sscanf(buf, "%x-%x-%x-%x", user_key, user_key + 1, in sscanf_key()
275 ret = -EINVAL; in sscanf_key()
280 pr_debug("proc TFO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", in sscanf_key()
286 static int proc_tcp_fastopen_key(const struct ctl_table *table, int write, in proc_tcp_fastopen_key() argument
289 struct net *net = container_of(table->data, struct net, in proc_tcp_fastopen_key()
302 tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); in proc_tcp_fastopen_key()
303 if (!tbl.data) in proc_tcp_fastopen_key()
304 return -ENOMEM; in proc_tcp_fastopen_key()
316 off += snprintf(tbl.data + off, tbl.maxlen - off, in proc_tcp_fastopen_key()
317 "%08x-%08x-%08x-%08x", in proc_tcp_fastopen_key()
323 if (WARN_ON_ONCE(off >= tbl.maxlen - 1)) in proc_tcp_fastopen_key()
327 off += snprintf(tbl.data + off, tbl.maxlen - off, ","); in proc_tcp_fastopen_key()
330 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_tcp_fastopen_key()
332 if (write && ret == 0) { in proc_tcp_fastopen_key()
333 backup_data = strchr(tbl.data, ','); in proc_tcp_fastopen_key()
338 if (sscanf_key(tbl.data, key)) { in proc_tcp_fastopen_key()
339 ret = -EINVAL; in proc_tcp_fastopen_key()
344 ret = -EINVAL; in proc_tcp_fastopen_key()
353 kfree(tbl.data); in proc_tcp_fastopen_key()
358 int write, void *buffer, in proc_tfo_blackhole_detect_timeout() argument
361 struct net *net = container_of(table->data, struct net, in proc_tfo_blackhole_detect_timeout()
365 ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); in proc_tfo_blackhole_detect_timeout()
366 if (write && ret == 0) in proc_tfo_blackhole_detect_timeout()
367 atomic_set(&net->ipv4.tfo_active_disable_times, 0); in proc_tfo_blackhole_detect_timeout()
373 int write, void *buffer, size_t *lenp, in proc_tcp_available_ulp() argument
379 tbl.data = kmalloc(tbl.maxlen, GFP_USER); in proc_tcp_available_ulp()
380 if (!tbl.data) in proc_tcp_available_ulp()
381 return -ENOMEM; in proc_tcp_available_ulp()
382 tcp_get_available_ulp(tbl.data, TCP_ULP_BUF_MAX); in proc_tcp_available_ulp()
383 ret = proc_dostring(&tbl, write, buffer, lenp, ppos); in proc_tcp_available_ulp()
384 kfree(tbl.data); in proc_tcp_available_ulp()
389 static int proc_tcp_ehash_entries(const struct ctl_table *table, int write, in proc_tcp_ehash_entries() argument
392 struct net *net = container_of(table->data, struct net, in proc_tcp_ehash_entries()
394 struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo; in proc_tcp_ehash_entries()
398 tcp_ehash_entries = hinfo->ehash_mask + 1; in proc_tcp_ehash_entries()
403 if (!net_eq(net, &init_net) && !hinfo->pernet) in proc_tcp_ehash_entries()
404 tcp_ehash_entries *= -1; in proc_tcp_ehash_entries()
407 tbl.data = &tcp_ehash_entries; in proc_tcp_ehash_entries()
410 return proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_tcp_ehash_entries()
413 static int proc_udp_hash_entries(const struct ctl_table *table, int write, in proc_udp_hash_entries() argument
416 struct net *net = container_of(table->data, struct net, in proc_udp_hash_entries()
421 udp_hash_entries = net->ipv4.udp_table->mask + 1; in proc_udp_hash_entries()
426 if (!net_eq(net, &init_net) && net->ipv4.udp_table == &udp_table) in proc_udp_hash_entries()
427 udp_hash_entries *= -1; in proc_udp_hash_entries()
430 tbl.data = &udp_hash_entries; in proc_udp_hash_entries()
433 return proc_dointvec(&tbl, write, buffer, lenp, ppos); in proc_udp_hash_entries()
437 static int proc_fib_multipath_hash_policy(const struct ctl_table *table, int write, in proc_fib_multipath_hash_policy() argument
441 struct net *net = container_of(table->data, struct net, in proc_fib_multipath_hash_policy()
445 ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos); in proc_fib_multipath_hash_policy()
446 if (write && ret == 0) in proc_fib_multipath_hash_policy()
452 static int proc_fib_multipath_hash_fields(const struct ctl_table *table, int write, in proc_fib_multipath_hash_fields() argument
459 net = container_of(table->data, struct net, in proc_fib_multipath_hash_fields()
461 ret = proc_douintvec_minmax(table, write, buffer, lenp, ppos); in proc_fib_multipath_hash_fields()
462 if (write && ret == 0) in proc_fib_multipath_hash_fields()
484 WRITE_ONCE(net->ipv4.sysctl_fib_multipath_hash_seed, new); in proc_fib_multipath_hash_set_seed()
487 static int proc_fib_multipath_hash_seed(const struct ctl_table *table, int write, in proc_fib_multipath_hash_seed() argument
492 struct net *net = table->data; in proc_fib_multipath_hash_seed()
497 mphs = &net->ipv4.sysctl_fib_multipath_hash_seed; in proc_fib_multipath_hash_seed()
498 user_seed = mphs->user_seed; in proc_fib_multipath_hash_seed()
501 tmp.data = &user_seed; in proc_fib_multipath_hash_seed()
503 ret = proc_douintvec_minmax(&tmp, write, buffer, lenp, ppos); in proc_fib_multipath_hash_seed()
505 if (write && ret == 0) { in proc_fib_multipath_hash_seed()
527 .data = &sysctl_tcp_max_orphans,
534 .data = &inet_peer_threshold,
541 .data = &inet_peer_minttl,
548 .data = &inet_peer_maxttl,
556 .data = &sysctl_tcp_mem,
562 .data = &sysctl_tcp_low_latency,
570 .data = &cipso_v4_cache_enabled,
577 .data = &cipso_v4_cache_bucketsize,
584 .data = &cipso_v4_rbm_optfmt,
591 .data = &cipso_v4_rbm_strictvalid,
605 .data = &sysctl_udp_mem,
612 .data = &sysctl_fib_sync_mem,
624 .data = &init_net.ipv4.tcp_death_row.sysctl_max_tw_buckets,
631 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
640 .data = &init_net.ipv4.sysctl_icmp_echo_enable_probe,
649 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
658 .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
667 .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
676 .data = &init_net.ipv4.sysctl_icmp_ratelimit,
683 .data = &init_net.ipv4.sysctl_icmp_ratemask,
690 .data = &init_net.ipv4.sysctl_icmp_msgs_per_sec,
698 .data = &init_net.ipv4.sysctl_icmp_msgs_burst,
706 .data = &init_net.ipv4.ping_group_range.range,
714 .data = &init_net.ipv4.sysctl_raw_l3mdev_accept,
724 .data = &init_net.ipv4.sysctl_tcp_ecn,
733 .data = &init_net.ipv4.sysctl_tcp_ecn_fallback,
742 .data = &init_net.ipv4.sysctl_ip_dynaddr,
749 .data = &init_net.ipv4.sysctl_ip_early_demux,
756 .data = &init_net.ipv4.sysctl_udp_early_demux,
763 .data = &init_net.ipv4.sysctl_tcp_early_demux,
770 .data = &init_net.ipv4.sysctl_nexthop_compat_mode,
779 .data = &init_net.ipv4.sysctl_ip_default_ttl,
789 .data = &init_net,
795 .data = &init_net.ipv4.sysctl_local_reserved_ports,
802 .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
809 .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu,
816 .data = &init_net.ipv4.sysctl_ip_fwd_update_priority,
825 .data = &init_net.ipv4.sysctl_ip_nonlocal_bind,
832 .data = &init_net.ipv4.sysctl_ip_autobind_reuse,
841 .data = &init_net.ipv4.sysctl_fwmark_reflect,
848 .data = &init_net.ipv4.sysctl_tcp_fwmark_accept,
856 .data = &init_net.ipv4.sysctl_tcp_l3mdev_accept,
866 .data = &init_net.ipv4.sysctl_tcp_mtu_probing,
873 .data = &init_net.ipv4.sysctl_tcp_base_mss,
880 .data = &init_net.ipv4.sysctl_tcp_min_snd_mss,
889 .data = &init_net.ipv4.sysctl_tcp_mtu_probe_floor,
898 .data = &init_net.ipv4.sysctl_tcp_probe_threshold,
905 .data = &init_net.ipv4.sysctl_tcp_probe_interval,
913 .data = &init_net.ipv4.sysctl_igmp_llm_reports,
920 .data = &init_net.ipv4.sysctl_igmp_max_memberships,
927 .data = &init_net.ipv4.sysctl_igmp_max_msf,
935 .data = &init_net.ipv4.sysctl_igmp_qrv,
944 .data = &init_net.ipv4.tcp_congestion_control,
963 .data = &init_net.ipv4.sysctl_tcp_keepalive_time,
970 .data = &init_net.ipv4.sysctl_tcp_keepalive_probes,
977 .data = &init_net.ipv4.sysctl_tcp_keepalive_intvl,
984 .data = &init_net.ipv4.sysctl_tcp_syn_retries,
993 .data = &init_net.ipv4.sysctl_tcp_synack_retries,
1001 .data = &init_net.ipv4.sysctl_tcp_syncookies,
1009 .data = &init_net.ipv4.sysctl_tcp_migrate_req,
1018 .data = &init_net.ipv4.sysctl_tcp_reordering,
1025 .data = &init_net.ipv4.sysctl_tcp_retries1,
1033 .data = &init_net.ipv4.sysctl_tcp_retries2,
1040 .data = &init_net.ipv4.sysctl_tcp_orphan_retries,
1047 .data = &init_net.ipv4.sysctl_tcp_fin_timeout,
1054 .data = &init_net.ipv4.sysctl_tcp_notsent_lowat,
1061 .data = &init_net.ipv4.sysctl_tcp_tw_reuse,
1070 .data = &init_net.ipv4.sysctl_max_syn_backlog,
1077 .data = &init_net.ipv4.sysctl_tcp_fastopen,
1085 .data = &init_net.ipv4.sysctl_tcp_fastopen,
1096 .data = &init_net.ipv4.sysctl_tcp_fastopen_blackhole_timeout,
1105 .data = &init_net.ipv4.sysctl_fib_multipath_use_neigh,
1114 .data = &init_net.ipv4.sysctl_fib_multipath_hash_policy,
1123 .data = &init_net.ipv4.sysctl_fib_multipath_hash_fields,
1132 .data = &init_net,
1141 .data = &init_net.ipv4.sysctl_ip_prot_sock,
1148 .data = &init_net.ipv4.sysctl_udp_l3mdev_accept,
1158 .data = &init_net.ipv4.sysctl_tcp_sack,
1165 .data = &init_net.ipv4.sysctl_tcp_window_scaling,
1172 .data = &init_net.ipv4.sysctl_tcp_timestamps,
1179 .data = &init_net.ipv4.sysctl_tcp_early_retrans,
1188 .data = &init_net.ipv4.sysctl_tcp_recovery,
1195 .data = &init_net.ipv4.sysctl_tcp_thin_linear_timeouts,
1202 .data = &init_net.ipv4.sysctl_tcp_slow_start_after_idle,
1209 .data = &init_net.ipv4.sysctl_tcp_retrans_collapse,
1216 .data = &init_net.ipv4.sysctl_tcp_stdurg,
1223 .data = &init_net.ipv4.sysctl_tcp_rfc1337,
1230 .data = &init_net.ipv4.sysctl_tcp_abort_on_overflow,
1237 .data = &init_net.ipv4.sysctl_tcp_fack,
1244 .data = &init_net.ipv4.sysctl_tcp_max_reordering,
1251 .data = &init_net.ipv4.sysctl_tcp_dsack,
1258 .data = &init_net.ipv4.sysctl_tcp_app_win,
1267 .data = &init_net.ipv4.sysctl_tcp_adv_win_scale,
1276 .data = &init_net.ipv4.sysctl_tcp_frto,
1283 .data = &init_net.ipv4.sysctl_tcp_nometrics_save,
1290 .data = &init_net.ipv4.sysctl_tcp_no_ssthresh_metrics_save,
1299 .data = &init_net.ipv4.sysctl_tcp_moderate_rcvbuf,
1306 .data = &init_net.ipv4.sysctl_tcp_tso_win_divisor,
1313 .data = &init_net.ipv4.sysctl_tcp_workaround_signed_windows,
1320 .data = &init_net.ipv4.sysctl_tcp_limit_output_bytes,
1327 .data = &init_net.ipv4.sysctl_tcp_challenge_ack_limit,
1334 .data = &init_net.ipv4.sysctl_tcp_min_tso_segs,
1342 .data = &init_net.ipv4.sysctl_tcp_tso_rtt_log,
1349 .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen,
1358 .data = &init_net.ipv4.sysctl_tcp_autocorking,
1367 .data = &init_net.ipv4.sysctl_tcp_invalid_ratelimit,
1374 .data = &init_net.ipv4.sysctl_tcp_pacing_ss_ratio,
1383 .data = &init_net.ipv4.sysctl_tcp_pacing_ca_ratio,
1392 .data = &init_net.ipv4.sysctl_tcp_wmem,
1400 .data = &init_net.ipv4.sysctl_tcp_rmem,
1408 .data = &init_net.ipv4.sysctl_tcp_comp_sack_delay_ns,
1415 .data = &init_net.ipv4.sysctl_tcp_comp_sack_slack_ns,
1422 .data = &init_net.ipv4.sysctl_tcp_comp_sack_nr,
1430 .data = &init_net.ipv4.sysctl_tcp_backlog_ack_defer,
1439 .data = &init_net.ipv4.sysctl_tcp_reflect_tos,
1448 .data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
1454 .data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
1463 .data = &init_net.ipv4.sysctl_udp_child_hash_entries,
1469 .data = &init_net.ipv4.sysctl_udp_child_hash_entries,
1478 .data = &init_net.ipv4.sysctl_udp_rmem_min,
1486 .data = &init_net.ipv4.sysctl_udp_wmem_min,
1494 .data = &init_net.ipv4.sysctl_fib_notify_on_flag_change,
1503 .data = &init_net.ipv4.sysctl_tcp_plb_enabled,
1512 .data = &init_net.ipv4.sysctl_tcp_plb_idle_rehash_rounds,
1520 .data = &init_net.ipv4.sysctl_tcp_plb_rehash_rounds,
1528 .data = &init_net.ipv4.sysctl_tcp_plb_suspend_rto_sec,
1535 .data = &init_net.ipv4.sysctl_tcp_plb_cong_thresh,
1544 .data = &init_net.ipv4.sysctl_tcp_syn_linear_timeouts,
1553 .data = &init_net.ipv4.sysctl_tcp_shrink_window,
1562 .data = &init_net.ipv4.sysctl_tcp_pingpong_thresh,
1570 .data = &init_net.ipv4.sysctl_tcp_rto_min_us,
1592 if (table[i].data) { in ipv4_sysctl_init_net()
1596 table[i].data += (void *)net - (void *)&init_net; in ipv4_sysctl_init_net()
1598 /* Entries without data pointer are global; in ipv4_sysctl_init_net()
1599 * Make them read-only in non-init_net ns in ipv4_sysctl_init_net()
1606 net->ipv4.ipv4_hdr = register_net_sysctl_sz(net, "net/ipv4", table, in ipv4_sysctl_init_net()
1608 if (!net->ipv4.ipv4_hdr) in ipv4_sysctl_init_net()
1611 net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL); in ipv4_sysctl_init_net()
1612 if (!net->ipv4.sysctl_local_reserved_ports) in ipv4_sysctl_init_net()
1620 unregister_net_sysctl_table(net->ipv4.ipv4_hdr); in ipv4_sysctl_init_net()
1625 return -ENOMEM; in ipv4_sysctl_init_net()
1632 kfree(net->ipv4.sysctl_local_reserved_ports); in ipv4_sysctl_exit_net()
1633 table = net->ipv4.ipv4_hdr->ctl_table_arg; in ipv4_sysctl_exit_net()
1634 unregister_net_sysctl_table(net->ipv4.ipv4_hdr); in ipv4_sysctl_exit_net()
1649 return -ENOMEM; in sysctl_ipv4_init()
1655 return -ENOMEM; in sysctl_ipv4_init()