diff options
| -rw-r--r-- | include/linux/tipc.h | 30 | ||||
| -rw-r--r-- | net/tipc/core.c | 2 | ||||
| -rw-r--r-- | net/tipc/subscr.c | 15 |
3 files changed, 23 insertions, 24 deletions
diff --git a/include/linux/tipc.h b/include/linux/tipc.h index 3d92396639de..9536d8aeadf1 100644 --- a/include/linux/tipc.h +++ b/include/linux/tipc.h | |||
| @@ -127,23 +127,17 @@ static inline unsigned int tipc_node(__u32 addr) | |||
| 127 | * TIPC topology subscription service definitions | 127 | * TIPC topology subscription service definitions |
| 128 | */ | 128 | */ |
| 129 | 129 | ||
| 130 | #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ | 130 | #define TIPC_SUB_SERVICE 0x00 /* Filter for service availability */ |
| 131 | #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ | 131 | #define TIPC_SUB_PORTS 0x01 /* Filter for port availability */ |
| 132 | #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ | 132 | #define TIPC_SUB_CANCEL 0x04 /* Cancel a subscription */ |
| 133 | #if 0 | ||
| 134 | /* The following filter options are not currently implemented */ | ||
| 135 | #define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ | ||
| 136 | #define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */ | ||
| 137 | #define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */ | ||
| 138 | #endif | ||
| 139 | 133 | ||
| 140 | #define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ | 134 | #define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ |
| 141 | 135 | ||
| 142 | struct tipc_subscr { | 136 | struct tipc_subscr { |
| 143 | struct tipc_name_seq seq; /* name sequence of interest */ | 137 | struct tipc_name_seq seq; /* NBO. Name sequence of interest */ |
| 144 | __u32 timeout; /* subscription duration (in ms) */ | 138 | __u32 timeout; /* NBO. Subscription duration (in ms) */ |
| 145 | __u32 filter; /* bitmask of filter options */ | 139 | __u32 filter; /* NBO. Bitmask of filter options */ |
| 146 | char usr_handle[8]; /* available for subscriber use */ | 140 | char usr_handle[8]; /* Opaque. Available for subscriber use */ |
| 147 | }; | 141 | }; |
| 148 | 142 | ||
| 149 | #define TIPC_PUBLISHED 1 /* publication event */ | 143 | #define TIPC_PUBLISHED 1 /* publication event */ |
| @@ -151,11 +145,11 @@ struct tipc_subscr { | |||
| 151 | #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ | 145 | #define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ |
| 152 | 146 | ||
| 153 | struct tipc_event { | 147 | struct tipc_event { |
| 154 | __u32 event; /* event type */ | 148 | __u32 event; /* NBO. Event type, as defined above */ |
| 155 | __u32 found_lower; /* matching name seq instances */ | 149 | __u32 found_lower; /* NBO. Matching name seq instances */ |
| 156 | __u32 found_upper; /* " " " " */ | 150 | __u32 found_upper; /* " " " " " */ |
| 157 | struct tipc_portid port; /* associated port */ | 151 | struct tipc_portid port; /* NBO. Associated port */ |
| 158 | struct tipc_subscr s; /* associated subscription */ | 152 | struct tipc_subscr s; /* Original, associated subscription */ |
| 159 | }; | 153 | }; |
| 160 | 154 | ||
| 161 | /* | 155 | /* |
diff --git a/net/tipc/core.c b/net/tipc/core.c index 52c571fedbe0..4e84c8431f32 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
| @@ -49,7 +49,7 @@ | |||
| 49 | #include "config.h" | 49 | #include "config.h" |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | #define TIPC_MOD_VER "1.6.4" | 52 | #define TIPC_MOD_VER "2.0.0" |
| 53 | 53 | ||
| 54 | #ifndef CONFIG_TIPC_ZONES | 54 | #ifndef CONFIG_TIPC_ZONES |
| 55 | #define CONFIG_TIPC_ZONES 3 | 55 | #define CONFIG_TIPC_ZONES 3 |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index ff123e56114a..ab6eab4c45e2 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
| @@ -274,7 +274,7 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
| 274 | { | 274 | { |
| 275 | struct subscription *sub; | 275 | struct subscription *sub; |
| 276 | struct subscription *sub_temp; | 276 | struct subscription *sub_temp; |
| 277 | __u32 type, lower, upper; | 277 | __u32 type, lower, upper, timeout, filter; |
| 278 | int found = 0; | 278 | int found = 0; |
| 279 | 279 | ||
| 280 | /* Find first matching subscription, exit if not found */ | 280 | /* Find first matching subscription, exit if not found */ |
| @@ -282,12 +282,18 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
| 282 | type = ntohl(s->seq.type); | 282 | type = ntohl(s->seq.type); |
| 283 | lower = ntohl(s->seq.lower); | 283 | lower = ntohl(s->seq.lower); |
| 284 | upper = ntohl(s->seq.upper); | 284 | upper = ntohl(s->seq.upper); |
| 285 | timeout = ntohl(s->timeout); | ||
| 286 | filter = ntohl(s->filter) & ~TIPC_SUB_CANCEL; | ||
| 285 | 287 | ||
| 286 | list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, | 288 | list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, |
| 287 | subscription_list) { | 289 | subscription_list) { |
| 288 | if ((type == sub->seq.type) && | 290 | if ((type == sub->seq.type) && |
| 289 | (lower == sub->seq.lower) && | 291 | (lower == sub->seq.lower) && |
| 290 | (upper == sub->seq.upper)) { | 292 | (upper == sub->seq.upper) && |
| 293 | (timeout == sub->timeout) && | ||
| 294 | (filter == sub->filter) && | ||
| 295 | !memcmp(s->usr_handle,sub->evt.s.usr_handle, | ||
| 296 | sizeof(s->usr_handle)) ){ | ||
| 291 | found = 1; | 297 | found = 1; |
| 292 | break; | 298 | break; |
| 293 | } | 299 | } |
| @@ -304,7 +310,7 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
| 304 | k_term_timer(&sub->timer); | 310 | k_term_timer(&sub->timer); |
| 305 | spin_lock_bh(subscriber->lock); | 311 | spin_lock_bh(subscriber->lock); |
| 306 | } | 312 | } |
| 307 | dbg("Cancel: removing sub %u,%u,%u from subscriber %x list\n", | 313 | dbg("Cancel: removing sub %u,%u,%u from subscriber %p list\n", |
| 308 | sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); | 314 | sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); |
| 309 | subscr_del(sub); | 315 | subscr_del(sub); |
| 310 | } | 316 | } |
| @@ -352,8 +358,7 @@ static struct subscription *subscr_subscribe(struct tipc_subscr *s, | |||
| 352 | sub->seq.upper = ntohl(s->seq.upper); | 358 | sub->seq.upper = ntohl(s->seq.upper); |
| 353 | sub->timeout = ntohl(s->timeout); | 359 | sub->timeout = ntohl(s->timeout); |
| 354 | sub->filter = ntohl(s->filter); | 360 | sub->filter = ntohl(s->filter); |
| 355 | if ((!(sub->filter & TIPC_SUB_PORTS) == | 361 | if ((sub->filter && (sub->filter != TIPC_SUB_PORTS)) || |
| 356 | !(sub->filter & TIPC_SUB_SERVICE)) || | ||
| 357 | (sub->seq.lower > sub->seq.upper)) { | 362 | (sub->seq.lower > sub->seq.upper)) { |
| 358 | warn("Subscription rejected, illegal request\n"); | 363 | warn("Subscription rejected, illegal request\n"); |
| 359 | kfree(sub); | 364 | kfree(sub); |
