26 #include <linux/sysctl.h>
27 #include <linux/errno.h>
31 #include <linux/phonet.h>
34 #define DYNAMIC_PORT_MIN 0x40
35 #define DYNAMIC_PORT_MAX 0x7f
38 static int local_port_range_min[2] = {0, 0};
39 static int local_port_range_max[2] = {1023, 1023};
43 static void set_local_port_range(
int range[2])
45 write_seqlock(&local_port_range_lock);
46 local_port_range[0] = range[0];
47 local_port_range[1] = range[1];
48 write_sequnlock(&local_port_range_lock);
56 seq = read_seqbegin(&local_port_range_lock);
58 *min = local_port_range[0];
60 *max = local_port_range[1];
61 }
while (read_seqretry(&local_port_range_lock, seq));
66 size_t *lenp, loff_t *ppos)
69 int range[2] = {local_port_range[0], local_port_range[1]};
72 .maxlen =
sizeof(
range),
74 .extra1 = &local_port_range_min,
75 .extra2 = &local_port_range_max,
80 if (write && ret == 0) {
81 if (range[1] < range[0])
84 set_local_port_range(range);
90 static struct ctl_table phonet_table[] = {
92 .procname =
"local_port_range",
93 .data = &local_port_range,
94 .maxlen =
sizeof(local_port_range),
104 return phonet_table_hrd ==
NULL ? -
ENOMEM : 0;