aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/config.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-08 03:19:09 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:08 -0500
commit3e6c8cd5669c1202fe806ce3e13d701f20a71c7e (patch)
treed7412c66923db0093472215cfe352e66d7214ac1 /net/tipc/config.c
parentd54a81d341af80875c201890500f727c8188dd9b (diff)
[TIPC]: endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/config.c')
-rw-r--r--net/tipc/config.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c
index ed1351ed05e1..458a2c46cef3 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -107,7 +107,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
107struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) 107struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
108{ 108{
109 struct sk_buff *buf; 109 struct sk_buff *buf;
110 u32 value_net; 110 __be32 value_net;
111 111
112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); 112 buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value)));
113 if (buf) { 113 if (buf) {
@@ -284,8 +284,7 @@ static struct sk_buff *cfg_set_own_addr(void)
284 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 284 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
285 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 285 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
286 286
287 addr = *(u32 *)TLV_DATA(req_tlv_area); 287 addr = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
288 addr = ntohl(addr);
289 if (addr == tipc_own_addr) 288 if (addr == tipc_own_addr)
290 return tipc_cfg_reply_none(); 289 return tipc_cfg_reply_none();
291 if (!tipc_addr_node_valid(addr)) 290 if (!tipc_addr_node_valid(addr))
@@ -319,8 +318,7 @@ static struct sk_buff *cfg_set_remote_mng(void)
319 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 318 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
320 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 319 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
321 320
322 value = *(u32 *)TLV_DATA(req_tlv_area); 321 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
323 value = ntohl(value);
324 tipc_remote_management = (value != 0); 322 tipc_remote_management = (value != 0);
325 return tipc_cfg_reply_none(); 323 return tipc_cfg_reply_none();
326} 324}
@@ -332,8 +330,7 @@ static struct sk_buff *cfg_set_max_publications(void)
332 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 330 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
333 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 331 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
334 332
335 value = *(u32 *)TLV_DATA(req_tlv_area); 333 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
336 value = ntohl(value);
337 if (value != delimit(value, 1, 65535)) 334 if (value != delimit(value, 1, 65535))
338 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 335 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
339 " (max publications must be 1-65535)"); 336 " (max publications must be 1-65535)");
@@ -348,8 +345,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void)
348 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 345 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
349 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 346 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
350 347
351 value = *(u32 *)TLV_DATA(req_tlv_area); 348 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
352 value = ntohl(value);
353 if (value != delimit(value, 1, 65535)) 349 if (value != delimit(value, 1, 65535))
354 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 350 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
355 " (max subscriptions must be 1-65535"); 351 " (max subscriptions must be 1-65535");
@@ -363,8 +359,7 @@ static struct sk_buff *cfg_set_max_ports(void)
363 359
364 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 360 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
365 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 361 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
366 value = *(u32 *)TLV_DATA(req_tlv_area); 362 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
367 value = ntohl(value);
368 if (value == tipc_max_ports) 363 if (value == tipc_max_ports)
369 return tipc_cfg_reply_none(); 364 return tipc_cfg_reply_none();
370 if (value != delimit(value, 127, 65535)) 365 if (value != delimit(value, 127, 65535))
@@ -383,8 +378,7 @@ static struct sk_buff *cfg_set_max_zones(void)
383 378
384 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 379 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
385 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 380 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
386 value = *(u32 *)TLV_DATA(req_tlv_area); 381 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
387 value = ntohl(value);
388 if (value == tipc_max_zones) 382 if (value == tipc_max_zones)
389 return tipc_cfg_reply_none(); 383 return tipc_cfg_reply_none();
390 if (value != delimit(value, 1, 255)) 384 if (value != delimit(value, 1, 255))
@@ -403,8 +397,7 @@ static struct sk_buff *cfg_set_max_clusters(void)
403 397
404 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 398 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
405 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 399 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
406 value = *(u32 *)TLV_DATA(req_tlv_area); 400 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
407 value = ntohl(value);
408 if (value != delimit(value, 1, 1)) 401 if (value != delimit(value, 1, 1))
409 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 402 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
410 " (max clusters fixed at 1)"); 403 " (max clusters fixed at 1)");
@@ -417,8 +410,7 @@ static struct sk_buff *cfg_set_max_nodes(void)
417 410
418 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 411 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
419 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 412 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
420 value = *(u32 *)TLV_DATA(req_tlv_area); 413 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
421 value = ntohl(value);
422 if (value == tipc_max_nodes) 414 if (value == tipc_max_nodes)
423 return tipc_cfg_reply_none(); 415 return tipc_cfg_reply_none();
424 if (value != delimit(value, 8, 2047)) 416 if (value != delimit(value, 8, 2047))
@@ -437,8 +429,7 @@ static struct sk_buff *cfg_set_max_slaves(void)
437 429
438 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 430 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
439 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 431 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
440 value = *(u32 *)TLV_DATA(req_tlv_area); 432 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
441 value = ntohl(value);
442 if (value != 0) 433 if (value != 0)
443 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 434 return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
444 " (max secondary nodes fixed at 0)"); 435 " (max secondary nodes fixed at 0)");
@@ -451,8 +442,7 @@ static struct sk_buff *cfg_set_netid(void)
451 442
452 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 443 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
453 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 444 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
454 value = *(u32 *)TLV_DATA(req_tlv_area); 445 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
455 value = ntohl(value);
456 if (value == tipc_net_id) 446 if (value == tipc_net_id)
457 return tipc_cfg_reply_none(); 447 return tipc_cfg_reply_none();
458 if (value != delimit(value, 1, 9999)) 448 if (value != delimit(value, 1, 9999))