diff options
Diffstat (limited to 'net/tipc/addr.c')
| -rw-r--r-- | net/tipc/addr.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 88463d9a6f12..a6fdab33877e 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * net/tipc/addr.c: TIPC address utility routines | 2 | * net/tipc/addr.c: TIPC address utility routines |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2000-2006, Ericsson AB | 4 | * Copyright (c) 2000-2006, Ericsson AB |
| 5 | * Copyright (c) 2004-2005, Wind River Systems | 5 | * Copyright (c) 2004-2005, 2010-2011, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| @@ -41,7 +41,7 @@ | |||
| 41 | * tipc_addr_domain_valid - validates a network domain address | 41 | * tipc_addr_domain_valid - validates a network domain address |
| 42 | * | 42 | * |
| 43 | * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, | 43 | * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, |
| 44 | * where Z, C, and N are non-zero and do not exceed the configured limits. | 44 | * where Z, C, and N are non-zero. |
| 45 | * | 45 | * |
| 46 | * Returns 1 if domain address is valid, otherwise 0 | 46 | * Returns 1 if domain address is valid, otherwise 0 |
| 47 | */ | 47 | */ |
| @@ -51,10 +51,6 @@ int tipc_addr_domain_valid(u32 addr) | |||
| 51 | u32 n = tipc_node(addr); | 51 | u32 n = tipc_node(addr); |
| 52 | u32 c = tipc_cluster(addr); | 52 | u32 c = tipc_cluster(addr); |
| 53 | u32 z = tipc_zone(addr); | 53 | u32 z = tipc_zone(addr); |
| 54 | u32 max_nodes = tipc_max_nodes; | ||
| 55 | |||
| 56 | if (n > max_nodes) | ||
| 57 | return 0; | ||
| 58 | 54 | ||
| 59 | if (n && (!z || !c)) | 55 | if (n && (!z || !c)) |
| 60 | return 0; | 56 | return 0; |
| @@ -66,8 +62,7 @@ int tipc_addr_domain_valid(u32 addr) | |||
| 66 | /** | 62 | /** |
| 67 | * tipc_addr_node_valid - validates a proposed network address for this node | 63 | * tipc_addr_node_valid - validates a proposed network address for this node |
| 68 | * | 64 | * |
| 69 | * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed | 65 | * Accepts <Z.C.N>, where Z, C, and N are non-zero. |
| 70 | * the configured limits. | ||
| 71 | * | 66 | * |
| 72 | * Returns 1 if address can be used, otherwise 0 | 67 | * Returns 1 if address can be used, otherwise 0 |
| 73 | */ | 68 | */ |
| @@ -81,9 +76,9 @@ int tipc_in_scope(u32 domain, u32 addr) | |||
| 81 | { | 76 | { |
| 82 | if (!domain || (domain == addr)) | 77 | if (!domain || (domain == addr)) |
| 83 | return 1; | 78 | return 1; |
| 84 | if (domain == (addr & 0xfffff000u)) /* domain <Z.C.0> */ | 79 | if (domain == tipc_cluster_mask(addr)) /* domain <Z.C.0> */ |
| 85 | return 1; | 80 | return 1; |
| 86 | if (domain == (addr & 0xff000000u)) /* domain <Z.0.0> */ | 81 | if (domain == tipc_zone_mask(addr)) /* domain <Z.0.0> */ |
| 87 | return 1; | 82 | return 1; |
| 88 | return 0; | 83 | return 0; |
| 89 | } | 84 | } |
