diff options
Diffstat (limited to 'net/tipc/config.c')
| -rw-r--r-- | net/tipc/config.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index 4785bf26cdf4..f76d3b15e4e2 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
| @@ -179,7 +179,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
| 179 | if (!tipc_addr_node_valid(addr)) | 179 | if (!tipc_addr_node_valid(addr)) |
| 180 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 180 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 181 | " (node address)"); | 181 | " (node address)"); |
| 182 | if (tipc_mode == TIPC_NET_MODE) | 182 | if (tipc_own_addr) |
| 183 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 183 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 184 | " (cannot change node address once assigned)"); | 184 | " (cannot change node address once assigned)"); |
| 185 | 185 | ||
| @@ -218,7 +218,7 @@ static struct sk_buff *cfg_set_max_publications(void) | |||
| 218 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 218 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 219 | 219 | ||
| 220 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 220 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 221 | if (value != delimit(value, 1, 65535)) | 221 | if (value < 1 || value > 65535) |
| 222 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 222 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 223 | " (max publications must be 1-65535)"); | 223 | " (max publications must be 1-65535)"); |
| 224 | tipc_max_publications = value; | 224 | tipc_max_publications = value; |
| @@ -233,7 +233,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void) | |||
| 233 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 233 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
| 234 | 234 | ||
| 235 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 235 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 236 | if (value != delimit(value, 1, 65535)) | 236 | if (value < 1 || value > 65535) |
| 237 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 237 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 238 | " (max subscriptions must be 1-65535"); | 238 | " (max subscriptions must be 1-65535"); |
| 239 | tipc_max_subscriptions = value; | 239 | tipc_max_subscriptions = value; |
| @@ -249,14 +249,11 @@ static struct sk_buff *cfg_set_max_ports(void) | |||
| 249 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 249 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 250 | if (value == tipc_max_ports) | 250 | if (value == tipc_max_ports) |
| 251 | return tipc_cfg_reply_none(); | 251 | return tipc_cfg_reply_none(); |
| 252 | if (value != delimit(value, 127, 65535)) | 252 | if (value < 127 || value > 65535) |
| 253 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 253 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 254 | " (max ports must be 127-65535)"); | 254 | " (max ports must be 127-65535)"); |
| 255 | if (tipc_mode != TIPC_NOT_RUNNING) | 255 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 256 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 256 | " (cannot change max ports while TIPC is active)"); |
| 257 | " (cannot change max ports while TIPC is active)"); | ||
| 258 | tipc_max_ports = value; | ||
| 259 | return tipc_cfg_reply_none(); | ||
| 260 | } | 257 | } |
| 261 | 258 | ||
| 262 | static struct sk_buff *cfg_set_netid(void) | 259 | static struct sk_buff *cfg_set_netid(void) |
| @@ -268,10 +265,10 @@ static struct sk_buff *cfg_set_netid(void) | |||
| 268 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 265 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
| 269 | if (value == tipc_net_id) | 266 | if (value == tipc_net_id) |
| 270 | return tipc_cfg_reply_none(); | 267 | return tipc_cfg_reply_none(); |
| 271 | if (value != delimit(value, 1, 9999)) | 268 | if (value < 1 || value > 9999) |
| 272 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 269 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 273 | " (network id must be 1-9999)"); | 270 | " (network id must be 1-9999)"); |
| 274 | if (tipc_mode == TIPC_NET_MODE) | 271 | if (tipc_own_addr) |
| 275 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 272 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 276 | " (cannot change network id once TIPC has joined a network)"); | 273 | " (cannot change network id once TIPC has joined a network)"); |
| 277 | tipc_net_id = value; | 274 | tipc_net_id = value; |
| @@ -481,7 +478,7 @@ int tipc_cfg_init(void) | |||
| 481 | 478 | ||
| 482 | seq.type = TIPC_CFG_SRV; | 479 | seq.type = TIPC_CFG_SRV; |
| 483 | seq.lower = seq.upper = tipc_own_addr; | 480 | seq.lower = seq.upper = tipc_own_addr; |
| 484 | res = tipc_nametbl_publish_rsv(config_port_ref, TIPC_ZONE_SCOPE, &seq); | 481 | res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq); |
| 485 | if (res) | 482 | if (res) |
| 486 | goto failed; | 483 | goto failed; |
| 487 | 484 | ||
