aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/tipc_config.h32
-rw-r--r--include/net/tipc/tipc_bearer.h2
-rw-r--r--include/net/tipc/tipc_msg.h2
-rw-r--r--net/tipc/config.c32
-rw-r--r--net/tipc/dbg.c3
-rw-r--r--net/tipc/name_distr.c10
-rw-r--r--net/tipc/node.c9
7 files changed, 38 insertions, 52 deletions
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 33a653913d9..b0c916d1f37 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -194,34 +194,34 @@
194 194
195 195
196struct tipc_node_info { 196struct tipc_node_info {
197 __u32 addr; /* network address of node */ 197 __be32 addr; /* network address of node */
198 __u32 up; /* 0=down, 1= up */ 198 __be32 up; /* 0=down, 1= up */
199}; 199};
200 200
201struct tipc_link_info { 201struct tipc_link_info {
202 __u32 dest; /* network address of peer node */ 202 __be32 dest; /* network address of peer node */
203 __u32 up; /* 0=down, 1=up */ 203 __be32 up; /* 0=down, 1=up */
204 char str[TIPC_MAX_LINK_NAME]; /* link name */ 204 char str[TIPC_MAX_LINK_NAME]; /* link name */
205}; 205};
206 206
207struct tipc_bearer_config { 207struct tipc_bearer_config {
208 __u32 priority; /* Range [1,31]. Override per link */ 208 __be32 priority; /* Range [1,31]. Override per link */
209 __u32 detect_scope; 209 __be32 detect_scope;
210 char name[TIPC_MAX_BEARER_NAME]; 210 char name[TIPC_MAX_BEARER_NAME];
211}; 211};
212 212
213struct tipc_link_config { 213struct tipc_link_config {
214 __u32 value; 214 __be32 value;
215 char name[TIPC_MAX_LINK_NAME]; 215 char name[TIPC_MAX_LINK_NAME];
216}; 216};
217 217
218#define TIPC_NTQ_ALLTYPES 0x80000000 218#define TIPC_NTQ_ALLTYPES 0x80000000
219 219
220struct tipc_name_table_query { 220struct tipc_name_table_query {
221 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ 221 __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
222 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ 222 __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
223 __u32 lowbound; /* (i.e. displays all entries of name table) */ 223 __be32 lowbound; /* (i.e. displays all entries of name table) */
224 __u32 upbound; 224 __be32 upbound;
225}; 225};
226 226
227/* 227/*
@@ -262,8 +262,8 @@ struct tipc_route_info {
262 */ 262 */
263 263
264struct tlv_desc { 264struct tlv_desc {
265 __u16 tlv_len; /* TLV length (descriptor + value) */ 265 __be16 tlv_len; /* TLV length (descriptor + value) */
266 __u16 tlv_type; /* TLV identifier */ 266 __be16 tlv_type; /* TLV identifier */
267}; 267};
268 268
269#define TLV_ALIGNTO 4 269#define TLV_ALIGNTO 4
@@ -377,9 +377,9 @@ struct tipc_genlmsghdr {
377 377
378struct tipc_cfg_msg_hdr 378struct tipc_cfg_msg_hdr
379{ 379{
380 __u32 tcm_len; /* Message length (including header) */ 380 __be32 tcm_len; /* Message length (including header) */
381 __u16 tcm_type; /* Command type */ 381 __be16 tcm_type; /* Command type */
382 __u16 tcm_flags; /* Additional flags */ 382 __be16 tcm_flags; /* Additional flags */
383 char tcm_reserved[8]; /* Unused */ 383 char tcm_reserved[8]; /* Unused */
384}; 384};
385 385
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
index e07136d74c2..2151a80cdf3 100644
--- a/include/net/tipc/tipc_bearer.h
+++ b/include/net/tipc/tipc_bearer.h
@@ -58,7 +58,7 @@
58 */ 58 */
59 59
60struct tipc_media_addr { 60struct tipc_media_addr {
61 __u32 type; /* bearer type (network byte order) */ 61 __be32 type; /* bearer type (network byte order) */
62 union { 62 union {
63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ 63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
64#if 0 64#if 0
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h
index 4d096eebc93..fb42eb7a86a 100644
--- a/include/net/tipc/tipc_msg.h
+++ b/include/net/tipc/tipc_msg.h
@@ -40,7 +40,7 @@
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
41 41
42struct tipc_msg { 42struct tipc_msg {
43 u32 hdr[15]; 43 __be32 hdr[15];
44}; 44};
45 45
46 46
diff --git a/net/tipc/config.c b/net/tipc/config.c
index ed1351ed05e..458a2c46cef 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))
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index d8af4c28695..627f99b7afd 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -393,8 +393,7 @@ struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
393 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) 393 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
394 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 394 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
395 395
396 value = *(u32 *)TLV_DATA(req_tlv_area); 396 value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
397 value = ntohl(value);
398 if (value != delimit(value, 0, 32768)) 397 if (value != delimit(value, 0, 32768))
399 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 398 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
400 " (log size must be 0-32768)"); 399 " (log size must be 0-32768)");
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 03bd659c43c..7bf87cb26ef 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -66,11 +66,11 @@
66 */ 66 */
67 67
68struct distr_item { 68struct distr_item {
69 u32 type; 69 __be32 type;
70 u32 lower; 70 __be32 lower;
71 u32 upper; 71 __be32 upper;
72 u32 ref; 72 __be32 ref;
73 u32 key; 73 __be32 key;
74}; 74};
75 75
76/** 76/**
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 886bda5e88d..106cd0dfac7 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -597,8 +597,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
597 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 597 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
598 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 598 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
599 599
600 domain = *(u32 *)TLV_DATA(req_tlv_area); 600 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
601 domain = ntohl(domain);
602 if (!tipc_addr_domain_valid(domain)) 601 if (!tipc_addr_domain_valid(domain))
603 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 602 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
604 " (network address)"); 603 " (network address)");
@@ -642,8 +641,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
642 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 641 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
643 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 642 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
644 643
645 domain = *(u32 *)TLV_DATA(req_tlv_area); 644 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
646 domain = ntohl(domain);
647 if (!tipc_addr_domain_valid(domain)) 645 if (!tipc_addr_domain_valid(domain))
648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 646 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
649 " (network address)"); 647 " (network address)");
@@ -664,8 +662,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
664 662
665 /* Add TLV for broadcast link */ 663 /* Add TLV for broadcast link */
666 664
667 link_info.dest = tipc_own_addr & 0xfffff00; 665 link_info.dest = htonl(tipc_own_addr & 0xfffff00);
668 link_info.dest = htonl(link_info.dest);
669 link_info.up = htonl(1); 666 link_info.up = htonl(1);
670 sprintf(link_info.str, tipc_bclink_name); 667 sprintf(link_info.str, tipc_bclink_name);
671 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 668 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));