ctrl.c (6da14d74e2bd07bca2cba10878dda5dc0485d59c) | ctrl.c (ff5a0b421cb23bf6b2898939ffef5b683045d9d3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Multipath TCP 3 * 4 * Copyright (c) 2019, Tessares SA. 5 */ 6 7#ifdef CONFIG_SYSCTL 8#include <linux/sysctl.h> --- 8 unchanged lines hidden (view full) --- 17 18static int mptcp_pernet_id; 19struct mptcp_pernet { 20#ifdef CONFIG_SYSCTL 21 struct ctl_table_header *ctl_table_hdr; 22#endif 23 24 unsigned int add_addr_timeout; | 1// SPDX-License-Identifier: GPL-2.0 2/* Multipath TCP 3 * 4 * Copyright (c) 2019, Tessares SA. 5 */ 6 7#ifdef CONFIG_SYSCTL 8#include <linux/sysctl.h> --- 8 unchanged lines hidden (view full) --- 17 18static int mptcp_pernet_id; 19struct mptcp_pernet { 20#ifdef CONFIG_SYSCTL 21 struct ctl_table_header *ctl_table_hdr; 22#endif 23 24 unsigned int add_addr_timeout; |
25 unsigned int stale_loss_cnt; |
|
25 u8 mptcp_enabled; 26 u8 checksum_enabled; 27 u8 allow_join_initial_addr_port; 28}; 29 30static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) 31{ 32 return net_generic(net, mptcp_pernet_id); --- 14 unchanged lines hidden (view full) --- 47 return mptcp_get_pernet(net)->checksum_enabled; 48} 49 50int mptcp_allow_join_id0(const struct net *net) 51{ 52 return mptcp_get_pernet(net)->allow_join_initial_addr_port; 53} 54 | 26 u8 mptcp_enabled; 27 u8 checksum_enabled; 28 u8 allow_join_initial_addr_port; 29}; 30 31static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) 32{ 33 return net_generic(net, mptcp_pernet_id); --- 14 unchanged lines hidden (view full) --- 48 return mptcp_get_pernet(net)->checksum_enabled; 49} 50 51int mptcp_allow_join_id0(const struct net *net) 52{ 53 return mptcp_get_pernet(net)->allow_join_initial_addr_port; 54} 55 |
56unsigned int mptcp_stale_loss_cnt(const struct net *net) 57{ 58 return mptcp_get_pernet(net)->stale_loss_cnt; 59} 60 |
|
55static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet) 56{ 57 pernet->mptcp_enabled = 1; 58 pernet->add_addr_timeout = TCP_RTO_MAX; 59 pernet->checksum_enabled = 0; 60 pernet->allow_join_initial_addr_port = 1; | 61static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet) 62{ 63 pernet->mptcp_enabled = 1; 64 pernet->add_addr_timeout = TCP_RTO_MAX; 65 pernet->checksum_enabled = 0; 66 pernet->allow_join_initial_addr_port = 1; |
67 pernet->stale_loss_cnt = 4; |
|
61} 62 63#ifdef CONFIG_SYSCTL 64static struct ctl_table mptcp_sysctl_table[] = { 65 { 66 .procname = "enabled", 67 .maxlen = sizeof(u8), 68 .mode = 0644, --- 21 unchanged lines hidden (view full) --- 90 { 91 .procname = "allow_join_initial_addr_port", 92 .maxlen = sizeof(u8), 93 .mode = 0644, 94 .proc_handler = proc_dou8vec_minmax, 95 .extra1 = SYSCTL_ZERO, 96 .extra2 = SYSCTL_ONE 97 }, | 68} 69 70#ifdef CONFIG_SYSCTL 71static struct ctl_table mptcp_sysctl_table[] = { 72 { 73 .procname = "enabled", 74 .maxlen = sizeof(u8), 75 .mode = 0644, --- 21 unchanged lines hidden (view full) --- 97 { 98 .procname = "allow_join_initial_addr_port", 99 .maxlen = sizeof(u8), 100 .mode = 0644, 101 .proc_handler = proc_dou8vec_minmax, 102 .extra1 = SYSCTL_ZERO, 103 .extra2 = SYSCTL_ONE 104 }, |
105 { 106 .procname = "stale_loss_cnt", 107 .maxlen = sizeof(unsigned int), 108 .mode = 0644, 109 .proc_handler = proc_douintvec_minmax, 110 }, |
|
98 {} 99}; 100 101static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet) 102{ 103 struct ctl_table_header *hdr; 104 struct ctl_table *table; 105 106 table = mptcp_sysctl_table; 107 if (!net_eq(net, &init_net)) { 108 table = kmemdup(table, sizeof(mptcp_sysctl_table), GFP_KERNEL); 109 if (!table) 110 goto err_alloc; 111 } 112 113 table[0].data = &pernet->mptcp_enabled; 114 table[1].data = &pernet->add_addr_timeout; 115 table[2].data = &pernet->checksum_enabled; 116 table[3].data = &pernet->allow_join_initial_addr_port; | 111 {} 112}; 113 114static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet) 115{ 116 struct ctl_table_header *hdr; 117 struct ctl_table *table; 118 119 table = mptcp_sysctl_table; 120 if (!net_eq(net, &init_net)) { 121 table = kmemdup(table, sizeof(mptcp_sysctl_table), GFP_KERNEL); 122 if (!table) 123 goto err_alloc; 124 } 125 126 table[0].data = &pernet->mptcp_enabled; 127 table[1].data = &pernet->add_addr_timeout; 128 table[2].data = &pernet->checksum_enabled; 129 table[3].data = &pernet->allow_join_initial_addr_port; |
130 table[4].data = &pernet->stale_loss_cnt; |
|
117 118 hdr = register_net_sysctl(net, MPTCP_SYSCTL_PATH, table); 119 if (!hdr) 120 goto err_reg; 121 122 pernet->ctl_table_hdr = hdr; 123 124 return 0; --- 71 unchanged lines hidden --- | 131 132 hdr = register_net_sysctl(net, MPTCP_SYSCTL_PATH, table); 133 if (!hdr) 134 goto err_reg; 135 136 pernet->ctl_table_hdr = hdr; 137 138 return 0; --- 71 unchanged lines hidden --- |