Re: [PATCH 0/14] TIPC updates
On Mon, 16 Oct 2006, David Miller wrote: > From: Per Liden <[EMAIL PROTECTED]> > Date: Fri, 13 Oct 2006 13:37:23 +0200 (CEST) > > > This patch set includes a number TIPC fixes/cleanups. Please see each > > individual patch for further description. > > > > Please pull from: > > > > git://tipc.cslab.ericsson.net/pub/git/tipc.git > > > > (rebased on linux/kernel/git/davem/net-2.6.git) > > I applied everything except patch 8/14, you really need to > add proper SKB queue locking to handle that race. I think > the "performance cost" of taking that lock is much overstated, > you should never have contention on that lock at all. Ok, we'll take your advice on this. > Secondly, I never pull from your trees because I still have > to make many fixups to your patches: > > 1) Please add a proper colon to your changeset header lines, >it should be "[TIPC]: ", not "[TIPC] ". > > 2) Please check for trailing whitespace added by your patches. >I've given you the command you can use in another email to >check this for yourselve before submission. > > 3) Please get full proper signed-off-by lines from patch submitters, >especially when the patch is more than a trivial 1 or 2 liner. Thanks a lot for the feedback. We'll do our best to assure that we follow these rules in the future. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 9/14] [TIPC] Name publication events now delivered in chronological order
I'm fairly sure this is a problem on your side. I received patch 10/14 from the netdev list and the two list archives I checked also had it. /Per On Fri, 13 Oct 2006, Bill Fink wrote: > FYI, > > At least here, I received two copies of patch 9/14 and no copy > of patch 10/14. > > -Bill > > > > On Fri, 13 Oct 2006 13:37:50 +0200, Per Liden wrote: > > > From: Allan Stephens <[EMAIL PROTECTED]> > > > > This patch tivially re-orders the entries in TIPC's list of local > > publications so that applications will receive publication events > > in the order they were published. > > > > Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> > > Signed-off-by: Per Liden <[EMAIL PROTECTED]> > > --- > > net/tipc/name_distr.c |2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c > > index f0b063b..03bd659 100644 > > --- a/net/tipc/name_distr.c > > +++ b/net/tipc/name_distr.c > > @@ -122,7 +122,7 @@ void tipc_named_publish(struct publicati > > struct sk_buff *buf; > > struct distr_item *item; > > > > - list_add(&publ->local_list, &publ_root); > > + list_add_tail(&publ->local_list, &publ_root); > > publ_cnt++; > > > > buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); > > -- > > 1.4.1 > - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/14] [TIPC] Debug print buffer enhancements and fixes
From: Allan Stephens <[EMAIL PROTECTED]> This change modifies TIPC's print buffer code as follows: 1) Now supports small print buffers (min. size reduced from 512 bytes to 64) 2) Now uses TIPC_NULL print buffer structure to indicate null device instead of NULL pointer (this simplified error handling) 3) Fixed misuse of console buffer structure by tipc_dump() 4) Added and corrected comments in various places Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h | 16 +++--- net/tipc/dbg.c | 136 --- net/tipc/dbg.h | 15 +- 3 files changed, 110 insertions(+), 57 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index 762aac2..31331e8 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -65,7 +65,7 @@ #include #define assert(i) BUG_ON(!(i)) struct tipc_msg; -extern struct print_buf *TIPC_CONS, *TIPC_LOG; +extern struct print_buf *TIPC_NULL, *TIPC_CONS, *TIPC_LOG; extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *); void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*); void tipc_printf(struct print_buf *, const char *fmt, ...); @@ -94,11 +94,11 @@ #define dump(fmt, arg...) do {if (DBG_OU * here, or on a per .c file basis, by redefining these symbols. The following * print buffer options are available: * - * NULL: Output to null print buffer (i.e. print nowhere) - * TIPC_CONS : Output to system console - * TIPC_LOG: Output to TIPC log buffer - * &buf: Output to user-defined buffer (struct print_buf *) - * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) ) + * TIPC_NULL : null buffer (i.e. print nowhere) + * TIPC_CONS : system console + * TIPC_LOG : TIPC log buffer + * &buf : user-defined buffer (struct print_buf *) + * TIPC_TEE(&buf_a,&buf_b) : list of buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG)) */ #ifndef TIPC_OUTPUT @@ -106,7 +106,7 @@ #define TIPC_OUTPUT TIPC_TEE(TIPC_CONS,T #endif #ifndef DBG_OUTPUT -#define DBG_OUTPUT NULL +#define DBG_OUTPUT TIPC_NULL #endif #else @@ -136,7 +136,7 @@ #undef TIPC_OUTPUT #define TIPC_OUTPUT TIPC_CONS #undef DBG_OUTPUT -#define DBG_OUTPUT NULL +#define DBG_OUTPUT TIPC_NULL #endif diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 5513065..48e33ab 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c @@ -1,8 +1,8 @@ /* - * net/tipc/dbg.c: TIPC print buffer routines for debuggign + * net/tipc/dbg.c: TIPC print buffer routines for debugging * * Copyright (c) 1996-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,11 +38,12 @@ #include "core.h" #include "config.h" #include "dbg.h" -#define MAX_STRING 512 - -static char print_string[MAX_STRING]; +static char print_string[TIPC_PB_MAX_STR]; static DEFINE_SPINLOCK(print_lock); +static struct print_buf null_buf = { NULL, 0, NULL, NULL }; +struct print_buf *TIPC_NULL = &null_buf; + static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; struct print_buf *TIPC_CONS = &cons_buf; @@ -62,68 +63,83 @@ #define FORMAT(PTR,LEN,FMT) \ /* * Locking policy when using print buffers. * - * 1) Routines of the form printbuf_XXX() rely on the caller to prevent - *simultaneous use of the print buffer(s) being manipulated. - * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of - *'print_string' and to protect its print buffer(s). - * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s). - * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG. + * The following routines use 'print_lock' for protection: + * 1) tipc_printf() - to protect its print buffer(s) and 'print_string' + * 2) TIPC_TEE() - to protect its print buffer(s) + * 3) tipc_dump()- to protect its print buffer(s) and 'print_string' + * 4) tipc_log_XXX() - to protect TIPC_LOG + * + * All routines of the form tipc_printbuf_XXX() rely on the caller to prevent + * simultaneous use of the print buffer(s) being manipulated. */ /** * tipc_printbuf_init - initialize print buffer to empty + * @pb: pointer to print buffer structure + * @raw: pointer to character array used by print buffer + * @size: size of character array + * + * Makes the print buffer a null device that discards anything written to it + * if the character array is too small (or absent). */ -void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz) +void tipc_printbuf_init(
[PATCH 1/14] [TIPC] Add missing unlock in port timeout code.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/port.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/net/tipc/port.c b/net/tipc/port.c index b9c8c6b..c1a1a76 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -505,8 +505,13 @@ static void port_timeout(unsigned long r struct port *p_ptr = tipc_port_lock(ref); struct sk_buff *buf = NULL; - if (!p_ptr || !p_ptr->publ.connected) + if (!p_ptr) + return; + + if (!p_ptr->publ.connected) { + tipc_port_unlock(p_ptr); return; + } /* Last probe answered ? */ if (p_ptr->probing_state == PROBING) { -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/14] [TIPC] Added duplicate node address detection capability
From: Allan Stephens <[EMAIL PROTECTED]> TIPC now rejects and logs link setup requests from node if the receiving node already has a functional link to that node on the associated interface, or if the requestor is using the same as the receiver. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/bearer.c |8 net/tipc/discover.c | 32 +++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 75a5968..fc85a12 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -2,7 +2,7 @@ * net/tipc/bearer.c: TIPC bearer code * * Copyright (c) 1996-2006, Ericsson AB - * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -191,14 +191,14 @@ void tipc_media_addr_printf(struct print if ((i < media_count) && (m_ptr->addr2str != NULL)) { char addr_str[MAX_ADDR_STR]; - tipc_printf(pb, "%s(%s) ", m_ptr->name, + tipc_printf(pb, "%s(%s)", m_ptr->name, m_ptr->addr2str(a, addr_str, sizeof(addr_str))); } else { unchar *addr = (unchar *)&a->dev_addr; - tipc_printf(pb, "UNKNOWN(%u):", media_type); + tipc_printf(pb, "UNKNOWN(%u)", media_type); for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) { - tipc_printf(pb, "%02x ", addr[i]); + tipc_printf(pb, "-%02x", addr[i]); } } } diff --git a/net/tipc/discover.c b/net/tipc/discover.c index ee94de9..f58cc3c 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -132,6 +132,28 @@ static struct sk_buff *tipc_disc_init_ms } /** + * disc_dupl_alert - issue node address duplication alert + * @b_ptr: pointer to bearer detecting duplication + * @node_addr: duplicated node address + * @media_addr: media address advertised by duplicated node + */ + +static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr, + struct tipc_media_addr *media_addr) +{ + char node_addr_str[16]; + char media_addr_str[64]; + struct print_buf pb; + + addr_string_fill(node_addr_str, node_addr); + tipc_printbuf_init(&pb, media_addr_str, sizeof(media_addr_str)); + tipc_media_addr_printf(&pb, media_addr); + tipc_printbuf_validate(&pb); + warn("Duplicate %s using %s seen on <%s>\n", +node_addr_str, media_addr_str, b_ptr->publ.name); +} + +/** * tipc_disc_recv_msg - handle incoming link setup message (request or response) * @buf: buffer containing message */ @@ -157,8 +179,11 @@ void tipc_disc_recv_msg(struct sk_buff * return; if (!tipc_addr_node_valid(orig)) return; - if (orig == tipc_own_addr) + if (orig == tipc_own_addr) { + if (memcmp(&media_addr, &b_ptr->publ.addr, sizeof(media_addr))) + disc_dupl_alert(b_ptr, tipc_own_addr, &media_addr); return; + } if (!in_scope(dest, tipc_own_addr)) return; if (is_slave(tipc_own_addr) && is_slave(orig)) @@ -190,6 +215,11 @@ void tipc_disc_recv_msg(struct sk_buff * } addr = &link->media_addr; if (memcmp(addr, &media_addr, sizeof(*addr))) { + if (tipc_link_is_up(link) || (!link->started)) { + disc_dupl_alert(b_ptr, orig, &media_addr); + spin_unlock_bh(&n_ptr->lock); + return; + } warn("Resetting link <%s>, peer interface address changed\n", link->name); memcpy(addr, &media_addr, sizeof(*addr)); -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/14] [TIPC] Fix socket receive queue NULL pointer dereference on SMP systems
From: P Litov <[EMAIL PROTECTED]> This patch corrects an SMP system-specific race condition which allowed TIPC to prematurely dereference the first sk_buff in a socket receive queue that was changing from empty to non-empty state. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c | 40 ++-- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2a6a5a6..827f204 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -82,6 +82,18 @@ static int sockets_enabled = 0; static atomic_t tipc_queue_size = ATOMIC_INIT(0); +/* + * Notes on receive queue locking: + * + * 1) Routines called from an application thread that examine the socket + * receive queue must typically use skb_queue_empty() rather than + * skb_queue_len() to determine if the queue has a message in it; otherwise, + * a race condition can arise on SMP systems wherein skb_queue_len() indicates + * the presence of a message that is not yet on the queue. (This race could + * be avoided by taking the queue lock before examining the queue, but this + * would complicate the code and impact performance.) + */ + /* * sock_lock(): Lock a port/socket pair. lock_sock() can * not be used here, since the same lock must protect ports @@ -123,7 +135,7 @@ static u32 pollmask(struct socket *sock) { u32 mask; - if ((skb_queue_len(&sock->sk->sk_receive_queue) != 0) || + if (!skb_queue_empty(&sock->sk->sk_receive_queue) || (sock->state == SS_UNCONNECTED) || (sock->state == SS_DISCONNECTING)) mask = (POLLRDNORM | POLLIN); @@ -809,7 +821,7 @@ static int recv_msg(struct kiocb *iocb, struct tipc_sock *tsock = tipc_sk(sock->sk); struct sk_buff *buf; struct tipc_msg *msg; - unsigned int q_len; + int q_empty; unsigned int sz; u32 err; int res; @@ -828,7 +840,7 @@ static int recv_msg(struct kiocb *iocb, if (unlikely(sock->state == SS_UNCONNECTED)) return -ENOTCONN; if (unlikely((sock->state == SS_DISCONNECTING) && -(skb_queue_len(&sock->sk->sk_receive_queue) == 0))) +(skb_queue_empty(&sock->sk->sk_receive_queue return -ENOTCONN; } @@ -838,7 +850,7 @@ static int recv_msg(struct kiocb *iocb, return -ERESTARTSYS; restart: - if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && + if (unlikely(skb_queue_empty(&sock->sk->sk_receive_queue) && (flags & MSG_DONTWAIT))) { res = -EWOULDBLOCK; goto exit; @@ -846,7 +858,7 @@ restart: if ((res = wait_event_interruptible( *sock->sk->sk_sleep, - ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || + (!(q_empty = skb_queue_empty(&sock->sk->sk_receive_queue)) || (sock->state == SS_DISCONNECTING))) )) { goto exit; } @@ -854,7 +866,7 @@ restart: /* Catch attempt to receive on an already terminated connection */ /* [THIS CHECK MAY OVERLAP WITH AN EARLIER CHECK] */ - if (!q_len) { + if (q_empty) { res = -ENOTCONN; goto exit; } @@ -941,7 +953,7 @@ static int recv_stream(struct kiocb *ioc struct tipc_sock *tsock = tipc_sk(sock->sk); struct sk_buff *buf; struct tipc_msg *msg; - unsigned int q_len; + int q_empty; unsigned int sz; int sz_to_copy; int sz_copied = 0; @@ -962,7 +974,7 @@ static int recv_stream(struct kiocb *ioc return -EINVAL; if (unlikely(sock->state == SS_DISCONNECTING)) { - if (skb_queue_len(&sock->sk->sk_receive_queue) == 0) + if (skb_queue_empty(&sock->sk->sk_receive_queue)) return -ENOTCONN; } else if (unlikely(sock->state != SS_CONNECTED)) return -ENOTCONN; @@ -973,7 +985,7 @@ static int recv_stream(struct kiocb *ioc return -ERESTARTSYS; restart: - if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && + if (unlikely(skb_queue_empty(&sock->sk->sk_receive_queue) && (flags & MSG_DONTWAIT))) { res = -EWOULDBLOCK; goto exit; @@ -981,7 +993,7 @@ restart: if ((res = wait_event_interruptible( *sock->sk->sk_sleep, - ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || + (!(q_empty =
[PATCH 14/14] [TIPC] Updated TIPC version number to 1.6.2
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 7f3f693..6f5b7ee 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -57,7 +57,7 @@ void tipc_socket_stop(void); int tipc_netlink_start(void); void tipc_netlink_stop(void); -#define TIPC_MOD_VER "1.6.1" +#define TIPC_MOD_VER "1.6.2" #ifndef CONFIG_TIPC_ZONES #define CONFIG_TIPC_ZONES 3 -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/14] [TIPC] Fixed slow link reactivation when link tolerance is large
From: Allan Stephens <[EMAIL PROTECTED]> This patch corrects an issue wherein a previouly failed node could not reestablish a links to a non-failing node in the TIPC network until the latter node detected the link failure itself (which might be configured to take up to 30 seconds). The non-failing node now responds to link setup requests from a previously failed node in at most 1 second, allowing it to detect the link failure more quickly. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/discover.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/net/tipc/discover.c b/net/tipc/discover.c index f58cc3c..7ea4c12 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -195,7 +195,8 @@ void tipc_disc_recv_msg(struct sk_buff * struct sk_buff *rbuf; struct tipc_media_addr *addr; struct node *n_ptr = tipc_node_find(orig); - int link_up; + int link_fully_up; + dbg(" in own cluster\n"); if (n_ptr == NULL) { n_ptr = tipc_node_create(orig); @@ -225,9 +226,9 @@ void tipc_disc_recv_msg(struct sk_buff * memcpy(addr, &media_addr, sizeof(*addr)); tipc_link_reset(link); } - link_up = tipc_link_is_up(link); + link_fully_up = (link->state == WORKING_WORKING); spin_unlock_bh(&n_ptr->lock); - if ((type == DSC_RESP_MSG) || link_up) + if ((type == DSC_RESP_MSG) || link_fully_up) return; rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); if (rbuf != NULL) { -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/14] [TIPC] Name publication events now delivered in chronological order
From: Allan Stephens <[EMAIL PROTECTED]> This patch tivially re-orders the entries in TIPC's list of local publications so that applications will receive publication events in the order they were published. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/name_distr.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index f0b063b..03bd659 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -122,7 +122,7 @@ void tipc_named_publish(struct publicati struct sk_buff *buf; struct distr_item *item; - list_add(&publ->local_list, &publ_root); + list_add_tail(&publ->local_list, &publ_root); publ_cnt++; buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/14] [TIPC] Added subscription cancellation capability
From: Lijun Chen <[EMAIL PROTECTED]> This patch allows a TIPC application to cancel an existing topology service subscription by re-requesting the subscription with the TIPC_SUB_CANCEL filter bit set. (All other bits of the cancel request must match the original subscription request.) Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- include/linux/tipc.h |1 + net/tipc/subscr.c| 99 ++ 2 files changed, 85 insertions(+), 15 deletions(-) diff --git a/include/linux/tipc.h b/include/linux/tipc.h index 243a15f..bea4694 100644 --- a/include/linux/tipc.h +++ b/include/linux/tipc.h @@ -129,6 +129,7 @@ #define TIPC_CONN_SHUTDOWN 5 #define TIPC_SUB_PORTS 0x01/* filter for port availability */ #define TIPC_SUB_SERVICE 0x02/* filter for service availability */ +#define TIPC_SUB_CANCEL 0x04/* cancel a subscription */ #if 0 /* The following filter options are not currently implemented */ #define TIPC_SUB_NO_BIND_EVTS 0x04/* filter out "publish" events */ diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index c51600b..77a87c2 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c @@ -155,7 +155,7 @@ void tipc_subscr_report_overlap(struct s sub->seq.upper, found_lower, found_upper); if (!tipc_subscr_overlap(sub, found_lower, found_upper)) return; - if (!must && (sub->filter != TIPC_SUB_PORTS)) + if (!must && !(sub->filter & TIPC_SUB_PORTS)) return; subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); } @@ -176,6 +176,13 @@ static void subscr_timeout(struct subscr if (subscriber == NULL) return; + /* Validate timeout (in case subscription is being cancelled) */ + + if (sub->timeout == TIPC_WAIT_FOREVER) { + tipc_ref_unlock(subscriber_ref); + return; + } + /* Unlink subscription from name table */ tipc_nametbl_unsubscribe(sub); @@ -199,6 +206,20 @@ static void subscr_timeout(struct subscr } /** + * subscr_del - delete a subscription within a subscription list + * + * Called with subscriber locked. + */ + +static void subscr_del(struct subscription *sub) +{ + tipc_nametbl_unsubscribe(sub); + list_del(&sub->subscription_list); + kfree(sub); + atomic_dec(&topsrv.subscription_count); +} + +/** * subscr_terminate - terminate communication with a subscriber * * Called with subscriber locked. Routine must temporarily release this lock @@ -227,12 +248,9 @@ static void subscr_terminate(struct subs k_cancel_timer(&sub->timer); k_term_timer(&sub->timer); } - tipc_nametbl_unsubscribe(sub); - list_del(&sub->subscription_list); - dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n", + dbg("Term: Removing sub %u,%u,%u from subscriber %x list\n", sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); - kfree(sub); - atomic_dec(&topsrv.subscription_count); + subscr_del(sub); } /* Sever connection to subscriber */ @@ -253,6 +271,49 @@ static void subscr_terminate(struct subs } /** + * subscr_cancel - handle subscription cancellation request + * + * Called with subscriber locked. Routine must temporarily release this lock + * to enable the subscription timeout routine to finish without deadlocking; + * the lock is then reclaimed to allow caller to release it upon return. + * + * Note that fields of 's' use subscriber's endianness! + */ + +static void subscr_cancel(struct tipc_subscr *s, + struct subscriber *subscriber) +{ + struct subscription *sub; + struct subscription *sub_temp; + int found = 0; + + /* Find first matching subscription, exit if not found */ + + list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, +subscription_list) { + if (!memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) { + found = 1; + break; + } + } + if (!found) + return; + + /* Cancel subscription timer (if used), then delete subscription */ + + if (sub->timeout != TIPC_WAIT_FOREVER) { + sub->timeout = TIPC_WAIT_FOREVER; + spin_unlock_bh(subscriber->lock); + k_cancel_timer(&sub->timer); + k_term_timer(&sub->timer); + spin_lock_bh(subscriber->lock); + } + dbg("Cancel: removing sub %u,%u
[PATCH 0/14] TIPC updates
Hi David, This patch set includes a number TIPC fixes/cleanups. Please see each individual patch for further description. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git (rebased on linux/kernel/git/davem/net-2.6.git) Summary: include/linux/tipc.h |1 net/tipc/bearer.c |8 +-- net/tipc/config.c |5 +- net/tipc/core.c |4 + net/tipc/core.h | 30 ++- net/tipc/dbg.c| 136 - net/tipc/dbg.h| 15 + net/tipc/discover.c | 39 +- net/tipc/link.c |8 +-- net/tipc/name_distr.c |2 - net/tipc/node.c |2 - net/tipc/port.c |7 ++- net/tipc/socket.c | 53 +-- net/tipc/subscr.c | 99 ++-- 14 files changed, 296 insertions(+), 113 deletions(-) Allan Stephens: [TIPC] Add missing unlock in port timeout code. [TIPC] Debug print buffer enhancements and fixes [TIPC] Stream socket can now send > 66000 bytes at a time [TIPC] Added duplicate node address detection capability [TIPC] Optimize wakeup logic when socket has no waiting processes [TIPC] Remove code bloat introduced by print buffer rework [TIPC] Add support for Ethernet VLANs [TIPC] Name publication events now delivered in chronological order [TIPC] Fixed slow link reactivation when link tolerance is large [TIPC] Can now list multicast link on an isolated network node [TIPC] Unrecognized configuration command now returns error message [TIPC] Updated TIPC version number to 1.6.2 Lijun Chen: [TIPC] Added subscription cancellation capability P Litov: [TIPC] Fix socket receive queue NULL pointer dereference on SMP systems /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/14] [TIPC] Stream socket can now send > 66000 bytes at a time
From: Allan Stephens <[EMAIL PROTECTED]> The stream socket send code was not initializing some required fields of the temporary msghdr structure it was utilizing; this is now fixed. A check has also been added to detect if a user illegally specifies a destination address when sending on an established stream connection. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index acfb852..ed900fe 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -2,7 +2,7 @@ * net/tipc/socket.c: TIPC socket API * * Copyright (c) 2001-2006, Ericsson AB - * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -629,6 +629,9 @@ static int send_stream(struct kiocb *ioc return -ENOTCONN; } + if (unlikely(m->msg_name)) + return -EISCONN; + /* * Send each iovec entry using one or more messages * @@ -641,6 +644,8 @@ static int send_stream(struct kiocb *ioc curr_iovlen = m->msg_iovlen; my_msg.msg_iov = &my_iov; my_msg.msg_iovlen = 1; + my_msg.msg_flags = m->msg_flags; + my_msg.msg_name = NULL; bytes_sent = 0; while (curr_iovlen--) { -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/14] [TIPC] Can now list multicast link on an isolated network node
From: Allan Stephens <[EMAIL PROTECTED]> This patch fixes a minor bug that prevents "tipc-config -l" from displaying the multicast link if a TIPC node has never successfully established at least one unicast link. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/node.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index fc6d096..886bda5 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -648,7 +648,7 @@ struct sk_buff *tipc_node_get_links(cons return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (network address)"); -if (!tipc_nodes) +if (tipc_mode != TIPC_NET_MODE) return tipc_cfg_reply_none(); /* Get space for all unicast links + multicast link */ -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/14] [TIPC] Optimize wakeup logic when socket has no waiting processes
From: Allan Stephens <[EMAIL PROTECTED]> This patch adds a simple test so TIPC doesn't try waking up processes waiting on a socket if there are none waiting. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index ed900fe..2a6a5a6 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1208,7 +1208,8 @@ static u32 dispatch(struct tipc_port *tp atomic_inc(&tipc_queue_size); skb_queue_tail(&sock->sk->sk_receive_queue, buf); -wake_up_interruptible(sock->sk->sk_sleep); + if (waitqueue_active(sock->sk->sk_sleep)) + wake_up_interruptible(sock->sk->sk_sleep); return TIPC_OK; } @@ -1223,7 +1224,8 @@ static void wakeupdispatch(struct tipc_p { struct tipc_sock *tsock = (struct tipc_sock *)tport->usr_handle; -wake_up_interruptible(tsock->sk.sk_sleep); + if (waitqueue_active(tsock->sk.sk_sleep)) + wake_up_interruptible(tsock->sk.sk_sleep); } /** -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/14] [TIPC] Remove code bloat introduced by print buffer rework
From: Allan Stephens <[EMAIL PROTECTED]> This patch allows the compiler to optimize out any code that tries to send debugging output to the null print buffer (TIPC_NULL), a capability that was unintentionally broken during the recent print buffer rework. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h |6 +++--- net/tipc/link.c |8 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index 31331e8..e3a74a3 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -83,9 +83,9 @@ #define err(fmt, arg...) tipc_printf(TI #define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_WARNING "TIPC: " fmt, ## arg) #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) -#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) -#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0) -#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) +#define dbg(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) +#define msg_dbg(msg, txt) do {if (DBG_OUTPUT != TIPC_NULL) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0) +#define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) /* diff --git a/net/tipc/link.c b/net/tipc/link.c index 53bc8cb..1bb983c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -132,7 +132,7 @@ static void link_print(struct link *l_pt * allow the output from multiple links to be intermixed. For this reason * routines of the form "dbg_link_XXX()" have been created that will capture * debug info into a link's personal print buffer, which can then be dumped - * into the TIPC system log (LOG) upon request. + * into the TIPC system log (TIPC_LOG) upon request. * * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, @@ -141,7 +141,7 @@ static void link_print(struct link *l_pt * when there is only a single link in the system being debugged. * * Notes: - * - When enabled, LINK_LOG_BUF_SIZE should be set to at least 1000 (bytes) + * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE * - "l_ptr" must be valid when using dbg_link_XXX() macros */ @@ -159,13 +159,13 @@ #define dbg_link_dump() do { \ static void dbg_print_link(struct link *l_ptr, const char *str) { - if (DBG_OUTPUT) + if (DBG_OUTPUT != TIPC_NULL) link_print(l_ptr, DBG_OUTPUT, str); } static void dbg_print_buf_chain(struct sk_buff *root_buf) { - if (DBG_OUTPUT) { + if (DBG_OUTPUT != TIPC_NULL) { struct sk_buff *buf = root_buf; while (buf) { -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/14] [TIPC] Add support for Ethernet VLANs
From: Allan Stephens <[EMAIL PROTECTED]> This patch enhances TIPC's Ethernet support to include VLAN interfaces. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |2 +- net/tipc/core.h |8 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 0539a83..7f3f693 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -90,7 +90,7 @@ int tipc_random; atomic_t tipc_user_count = ATOMIC_INIT(0); const char tipc_alphabet[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; /* configurable TIPC parameters */ diff --git a/net/tipc/core.h b/net/tipc/core.h index e3a74a3..a0cc1d2 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -275,11 +275,15 @@ static inline void k_term_timer(struct t /* * TIPC message buffer code * - * TIPC message buffer headroom leaves room for 14 byte Ethernet header, + * TIPC message buffer headroom reserves space for a link-level header + * (in case the message is sent off-node), * while ensuring TIPC header is word aligned for quicker access + * + * The largest header currently supported is 18 bytes, which is used when + * the standard 14 byte Ethernet header has 4 added bytes for VLAN info */ -#define BUF_HEADROOM 16u +#define BUF_HEADROOM 20u struct tipc_skb_cb { void *handle; -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/14] [TIPC] Unrecognized configuration command now returns error message
From: Allan Stephens <[EMAIL PROTECTED]> This patch causes TIPC to return an error message when it receives an unrecognized configuration command. (Previously, the sender received no feedback.) Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/config.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/tipc/config.c b/net/tipc/config.c index 285e1bc..ed1351e 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c @@ -2,7 +2,7 @@ * net/tipc/config.c: TIPC configuration management code * * Copyright (c) 2002-2006, Ericsson AB - * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -613,7 +613,8 @@ #endif rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); break; default: - rep_tlv_buf = NULL; + rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (unknown command)"); break; } -- 1.4.1 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf
On Thu, 29 Jun 2006, David Miller wrote: > From: Per Liden <[EMAIL PROTECTED]> > Date: Thu, 29 Jun 2006 17:17:20 +0200 (CEST) > > > A problem was found with this patch. The direct inspection of bundle > > buffer tailroom did not account for the possiblity of unrequested tailroom > > added by skb_alloc(), thereby allowing a bundle to be created that exceeds > > the current link MTU. > > > > I'll resend this patch set with this issue resolved. > > I've applied the patch already, please send a relative fix. Here's a relative fix. /Per [TIPC] Fixed sk_buff panic caused by tipc_link_bundle_buf (REVISED) From: Allan Stephens <[EMAIL PROTECTED]> The recent change to direct inspection of bundle buffer tailroom did not account for the possiblity of unrequested tailroom added by skb_alloc(), thereby allowing a bundle to be created that exceeds the current link MTU. An additional check now ensures that bundling works correctly no matter if the bundle buffer is smaller, larger, or equal to the link MTU. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h |5 - net/tipc/link.c |2 ++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index 86f54f3..762aac2 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -297,7 +297,10 @@ static inline struct tipc_msg *buf_msg(s * buf_acquire - creates a TIPC message buffer * @size: message size (including TIPC header) * - * Returns a new buffer. Space is reserved for a data link header. + * Returns a new buffer with data pointers set to the specified size. + * + * NOTE: Headroom is reserved to allow prepending of a data link header. + * There may also be unrequested tailroom present at the buffer's end. */ static inline struct sk_buff *buf_acquire(u32 size) diff --git a/net/tipc/link.c b/net/tipc/link.c index c6831c7..c10e18a 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -998,6 +998,8 @@ static int link_bundle_buf(struct link * return 0; if (skb_tailroom(bundler) < (pad + size)) return 0; + if (link_max_pkt(l_ptr) < (to_pos + size)) + return 0; skb_put(bundler, pad + size); memcpy(bundler->data + to_pos, buf->data, size); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] [TIPC] Initial activation message now includes TIPC version number
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 5003acb..0539a83 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -191,7 +191,8 @@ static int __init tipc_init(void) int res; tipc_log_reinit(CONFIG_TIPC_LOG); - info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); + info("Activated (version " TIPC_MOD_VER +" compiled " __DATE__ " " __TIME__ ")\n"); tipc_own_addr = 0; tipc_remote_management = 1; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] [TIPC] Improve response to requests for node/link information
From: Allan Stephens <[EMAIL PROTECTED]> Now allocates reply space for "get links" request based on number of actual links, not number of potential links. Also, limits reply to "get links" and "get nodes" requests to 32KB to match capabilities of tipc-config utility that issued request. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/node.c | 26 +- net/tipc/zone.h |4 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index ce9678e..bf24168 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -2,7 +2,7 @@ * net/tipc/node.c: TIPC node management routines * * Copyright (c) 2000-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -592,6 +592,7 @@ struct sk_buff *tipc_node_get_nodes(cons struct sk_buff *buf; struct node *n_ptr; struct tipc_node_info node_info; + u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -608,8 +609,11 @@ struct sk_buff *tipc_node_get_nodes(cons /* For now, get space for all other nodes (will need to modify this when slave nodes are supported */ - buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * - (tipc_max_nodes - 1)); + payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); + if (payload_size > 32768u) + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (too many nodes)"); + buf = tipc_cfg_reply_alloc(payload_size); if (!buf) return NULL; @@ -633,6 +637,7 @@ struct sk_buff *tipc_node_get_links(cons struct sk_buff *buf; struct node *n_ptr; struct tipc_link_info link_info; + u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -645,12 +650,15 @@ struct sk_buff *tipc_node_get_links(cons if (!tipc_nodes) return tipc_cfg_reply_none(); - - /* For now, get space for 2 links to all other nodes + bcast link - (will need to modify this when slave nodes are supported */ - - buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * - (2 * (tipc_max_nodes - 1) + 1)); + + /* Get space for all unicast links + multicast link */ + + payload_size = TLV_SPACE(sizeof(link_info)) * + (tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1); + if (payload_size > 32768u) + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (too many links)"); + buf = tipc_cfg_reply_alloc(payload_size); if (!buf) return NULL; diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 267999c..5ab3d08 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h @@ -2,7 +2,7 @@ * net/tipc/zone.h: Include file for TIPC zone management routines * * Copyright (c) 2000-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ #include "net.h" * struct _zone - TIPC zone structure * @addr: network address of zone * @clusters: array of pointers to all clusters within zone - * @links: (used for inter-zone communication) + * @links: number of (unicast) links to zone */ struct _zone { -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf
From: Allan Stephens <[EMAIL PROTECTED]> Now determines tailroom of bundle buffer by directly inspection of buffer. Previously, buffer was assumed to have a max capacity equal to the link MTU, but the addition of link MTU negotiation means that the link MTU can increase after the bundle buffer is allocated. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h |5 - net/tipc/link.c | 13 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index 86f54f3..762aac2 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -297,7 +297,10 @@ static inline struct tipc_msg *buf_msg(s * buf_acquire - creates a TIPC message buffer * @size: message size (including TIPC header) * - * Returns a new buffer. Space is reserved for a data link header. + * Returns a new buffer with data pointers set to the specified size. + * + * NOTE: Headroom is reserved to allow prepending of a data link header. + * There may also be unrequested tailroom present at the buffer's end. */ static inline struct sk_buff *buf_acquire(u32 size) diff --git a/net/tipc/link.c b/net/tipc/link.c index d646580..c10e18a 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -2,7 +2,7 @@ * net/tipc/link.c: TIPC link code * * Copyright (c) 1996-2006, Ericsson AB - * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -988,17 +988,20 @@ static int link_bundle_buf(struct link * struct tipc_msg *bundler_msg = buf_msg(bundler); struct tipc_msg *msg = buf_msg(buf); u32 size = msg_size(msg); - u32 to_pos = align(msg_size(bundler_msg)); - u32 rest = link_max_pkt(l_ptr) - to_pos; + u32 bundle_size = msg_size(bundler_msg); + u32 to_pos = align(bundle_size); + u32 pad = to_pos - bundle_size; if (msg_user(bundler_msg) != MSG_BUNDLER) return 0; if (msg_type(bundler_msg) != OPEN_MSG) return 0; - if (rest < align(size)) + if (skb_tailroom(bundler) < (pad + size)) + return 0; + if (link_max_pkt(l_ptr) < (to_pos + size)) return 0; - skb_put(bundler, (to_pos - msg_size(bundler_msg)) + size); + skb_put(bundler, pad + size); memcpy(bundler->data + to_pos, buf->data, size); msg_set_size(bundler_msg, to_pos + size); msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] TIPC updates (resend)
This is a resend of this patch set. A problem was found with the direct inspection of bundle buffer tailroom. It did not account for the possiblity of unrequested tailroom added by skb_alloc(), thereby allowing a bundle to be created that exceeds the current link MTU. An additional check now ensures that bundling works correctly no matter if the bundle buffer is smaller, larger, or equal to the link MTU. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git Summary: net/tipc/core.c |3 ++- net/tipc/core.h |5 - net/tipc/link.c | 13 - net/tipc/node.c | 26 +- net/tipc/zone.h |4 ++-- 5 files changed, 33 insertions(+), 18 deletions(-) Allan Stephens: [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf [TIPC] Improve response to requests for node/link information [TIPC] Initial activation message now includes TIPC version number /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf
A problem was found with this patch. The direct inspection of bundle buffer tailroom did not account for the possiblity of unrequested tailroom added by skb_alloc(), thereby allowing a bundle to be created that exceeds the current link MTU. I'll resend this patch set with this issue resolved. /Per On Wed, 28 Jun 2006, Per Liden wrote: > From: Allan Stephens <[EMAIL PROTECTED]> > > Now determines tailroom of bundle buffer by directly inspection of buffer. > Previously, buffer was assumed to have a max capacity equal to the link MTU, > but the addition of link MTU negotiation means that the link MTU can increase > after the bundle buffer is allocated. > > Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> > Signed-off-by: Per Liden <[EMAIL PROTECTED]> > --- > net/tipc/link.c | 11 ++- > 1 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/net/tipc/link.c b/net/tipc/link.c > index d646580..c6831c7 100644 > --- a/net/tipc/link.c > +++ b/net/tipc/link.c > @@ -2,7 +2,7 @@ > * net/tipc/link.c: TIPC link code > * > * Copyright (c) 1996-2006, Ericsson AB > - * Copyright (c) 2004-2005, Wind River Systems > + * Copyright (c) 2004-2006, Wind River Systems > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -988,17 +988,18 @@ static int link_bundle_buf(struct link * > struct tipc_msg *bundler_msg = buf_msg(bundler); > struct tipc_msg *msg = buf_msg(buf); > u32 size = msg_size(msg); > - u32 to_pos = align(msg_size(bundler_msg)); > - u32 rest = link_max_pkt(l_ptr) - to_pos; > + u32 bundle_size = msg_size(bundler_msg); > + u32 to_pos = align(bundle_size); > + u32 pad = to_pos - bundle_size; > > if (msg_user(bundler_msg) != MSG_BUNDLER) > return 0; > if (msg_type(bundler_msg) != OPEN_MSG) > return 0; > - if (rest < align(size)) > + if (skb_tailroom(bundler) < (pad + size)) > return 0; > > - skb_put(bundler, (to_pos - msg_size(bundler_msg)) + size); > + skb_put(bundler, pad + size); > memcpy(bundler->data + to_pos, buf->data, size); > msg_set_size(bundler_msg, to_pos + size); > msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); > -- > 1.4.0 > > - > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html > - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf
From: Allan Stephens <[EMAIL PROTECTED]> Now determines tailroom of bundle buffer by directly inspection of buffer. Previously, buffer was assumed to have a max capacity equal to the link MTU, but the addition of link MTU negotiation means that the link MTU can increase after the bundle buffer is allocated. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/link.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index d646580..c6831c7 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -2,7 +2,7 @@ * net/tipc/link.c: TIPC link code * * Copyright (c) 1996-2006, Ericsson AB - * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -988,17 +988,18 @@ static int link_bundle_buf(struct link * struct tipc_msg *bundler_msg = buf_msg(bundler); struct tipc_msg *msg = buf_msg(buf); u32 size = msg_size(msg); - u32 to_pos = align(msg_size(bundler_msg)); - u32 rest = link_max_pkt(l_ptr) - to_pos; + u32 bundle_size = msg_size(bundler_msg); + u32 to_pos = align(bundle_size); + u32 pad = to_pos - bundle_size; if (msg_user(bundler_msg) != MSG_BUNDLER) return 0; if (msg_type(bundler_msg) != OPEN_MSG) return 0; - if (rest < align(size)) + if (skb_tailroom(bundler) < (pad + size)) return 0; - skb_put(bundler, (to_pos - msg_size(bundler_msg)) + size); + skb_put(bundler, pad + size); memcpy(bundler->data + to_pos, buf->data, size); msg_set_size(bundler_msg, to_pos + size); msg_set_msgcnt(bundler_msg, msg_msgcnt(bundler_msg) + 1); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] TIPC updates
This patch set includes three fixes/cleanups. Please see each individual patch for further description. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git (rebased on linux/kernel/git/davem/net-2.6.git) Summary: net/tipc/core.c |3 ++- net/tipc/link.c | 11 ++- net/tipc/node.c | 26 +- net/tipc/zone.h |4 ++-- 4 files changed, 27 insertions(+), 17 deletions(-) Allan Stephens: [TIPC] Fixed skb_under_panic caused by tipc_link_bundle_buf [TIPC] Improve response to requests for node/link information [TIPC] Initial activation message now includes TIPC version number /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] [TIPC] Initial activation message now includes TIPC version number
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 5003acb..0539a83 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -191,7 +191,8 @@ static int __init tipc_init(void) int res; tipc_log_reinit(CONFIG_TIPC_LOG); - info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); + info("Activated (version " TIPC_MOD_VER +" compiled " __DATE__ " " __TIME__ ")\n"); tipc_own_addr = 0; tipc_remote_management = 1; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] [TIPC] Improve response to requests for node/link information
From: Allan Stephens <[EMAIL PROTECTED]> Now allocates reply space for "get links" request based on number of actual links, not number of potential links. Also, limits reply to "get links" and "get nodes" requests to 32KB to match capabilities of tipc-config utility that issued request. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/node.c | 26 +- net/tipc/zone.h |4 ++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index ce9678e..bf24168 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -2,7 +2,7 @@ * net/tipc/node.c: TIPC node management routines * * Copyright (c) 2000-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -592,6 +592,7 @@ struct sk_buff *tipc_node_get_nodes(cons struct sk_buff *buf; struct node *n_ptr; struct tipc_node_info node_info; + u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -608,8 +609,11 @@ struct sk_buff *tipc_node_get_nodes(cons /* For now, get space for all other nodes (will need to modify this when slave nodes are supported */ - buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * - (tipc_max_nodes - 1)); + payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); + if (payload_size > 32768u) + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (too many nodes)"); + buf = tipc_cfg_reply_alloc(payload_size); if (!buf) return NULL; @@ -633,6 +637,7 @@ struct sk_buff *tipc_node_get_links(cons struct sk_buff *buf; struct node *n_ptr; struct tipc_link_info link_info; + u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -645,12 +650,15 @@ struct sk_buff *tipc_node_get_links(cons if (!tipc_nodes) return tipc_cfg_reply_none(); - - /* For now, get space for 2 links to all other nodes + bcast link - (will need to modify this when slave nodes are supported */ - - buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * - (2 * (tipc_max_nodes - 1) + 1)); + + /* Get space for all unicast links + multicast link */ + + payload_size = TLV_SPACE(sizeof(link_info)) * + (tipc_net.zones[tipc_zone(tipc_own_addr)]->links + 1); + if (payload_size > 32768u) + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (too many links)"); + buf = tipc_cfg_reply_alloc(payload_size); if (!buf) return NULL; diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 267999c..5ab3d08 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h @@ -2,7 +2,7 @@ * net/tipc/zone.h: Include file for TIPC zone management routines * * Copyright (c) 2000-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ #include "net.h" * struct _zone - TIPC zone structure * @addr: network address of zone * @clusters: array of pointers to all clusters within zone - * @links: (used for inter-zone communication) + * @links: number of (unicast) links to zone */ struct _zone { -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 7/32] [TIPC] Multicast link failure now resets all links to "nacking" node.
On Thu, 22 Jun 2006, Stephens, Allan wrote: [...] > Per, I'll leave it to you to decide if you want to address James's > concern. But be aware that the link_reset_all() routine is only called > to handle emergency situations when TIPC's multicast link has run into > serious problems and is trying to recover. Most systems will never > follow this path, so the cost of the unnecessary > local_bh_disable()/local_bh_enable() pairing shouldn't have any real > impact on the overall performance of TIPC. I tend to agree with you Allan. Since local_bh_disable()/local_bh_enable() supports nesting and this code is only called in extreme situations I don't think it's a real problem. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 27/32] [TIPC] Disallow config operations that aren't supported in certain modes.
From: Allan Stephens <[EMAIL PROTECTED]> This change provides user-friendly feedback when TIPC is unable to perform certain configuration operations that don't work properly in certain modes. (In particular, any reconfiguration request that would temporarily take TIPC from network mode to standalone mode, or from standalone mode to not running mode, is disallowed.) Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/config.c | 83 - 1 files changed, 38 insertions(+), 45 deletions(-) diff --git a/net/tipc/config.c b/net/tipc/config.c index 48b5de2..41c8447 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c @@ -291,13 +291,22 @@ static struct sk_buff *cfg_set_own_addr( if (!tipc_addr_node_valid(addr)) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (node address)"); - if (tipc_own_addr) + if (tipc_mode == TIPC_NET_MODE) return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED " (cannot change node address once assigned)"); + tipc_own_addr = addr; + + /* +* Must release all spinlocks before calling start_net() because +* Linux version of TIPC calls eth_media_start() which calls +* register_netdevice_notifier() which may block! +* +* Temporarily releasing the lock should be harmless for non-Linux TIPC, +* but Linux version of eth_media_start() should really be reworked +* so that it can be called with spinlocks held. +*/ spin_unlock_bh(&config_lock); - tipc_core_stop_net(); - tipc_own_addr = addr; tipc_core_start_net(); spin_lock_bh(&config_lock); return tipc_cfg_reply_none(); @@ -350,50 +359,21 @@ static struct sk_buff *cfg_set_max_subsc static struct sk_buff *cfg_set_max_ports(void) { - int orig_mode; u32 value; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); + if (value == tipc_max_ports) + return tipc_cfg_reply_none(); if (value != delimit(value, 127, 65535)) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (max ports must be 127-65535)"); - - if (value == tipc_max_ports) - return tipc_cfg_reply_none(); - - if (atomic_read(&tipc_user_count) > 2) + if (tipc_mode != TIPC_NOT_RUNNING) return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED - " (cannot change max ports while TIPC users exist)"); - - spin_unlock_bh(&config_lock); - orig_mode = tipc_get_mode(); - if (orig_mode == TIPC_NET_MODE) - tipc_core_stop_net(); - tipc_core_stop(); + " (cannot change max ports while TIPC is active)"); tipc_max_ports = value; - tipc_core_start(); - if (orig_mode == TIPC_NET_MODE) - tipc_core_start_net(); - spin_lock_bh(&config_lock); - return tipc_cfg_reply_none(); -} - -static struct sk_buff *set_net_max(int value, int *parameter) -{ - int orig_mode; - - if (value != *parameter) { - orig_mode = tipc_get_mode(); - if (orig_mode == TIPC_NET_MODE) - tipc_core_stop_net(); - *parameter = value; - if (orig_mode == TIPC_NET_MODE) - tipc_core_start_net(); - } - return tipc_cfg_reply_none(); } @@ -405,10 +385,16 @@ static struct sk_buff *cfg_set_max_zones return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); value = *(u32 *)TLV_DATA(req_tlv_area); value = ntohl(value); + if (value == tipc_max_zones) + return tipc_cfg_reply_none(); if (value != delimit(value, 1, 255)) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (max zones must be 1-255)"); - return set_net_max(value, &tipc_max_zones); + if (tipc_mode == TIPC_NET_MODE) + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + " (cannot change max zones once TIPC has joined a network)"); + tipc_max_zones = value; + return tipc_cfg_reply_none(); } static struct sk_buff *cfg_set_max_clusters(void) @@ -419,8 +405,8 @@ static struct sk_buff *cfg_set_max_clust return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
[PATCH 31/32] [TIPC] Get rid of dynamically allocated arrays in broadcast code.
From: Allan Stephens <[EMAIL PROTECTED]> This change improves an earlier change which replaced the large local variable arrays used during broadcasting with dynamically allocated arrays. The temporary arrays are now incoprorated into the multicast link data structure. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/bcast.c | 41 + 1 files changed, 17 insertions(+), 24 deletions(-) diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 1633ef2..5412804 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -81,7 +81,14 @@ struct bcbearer_pair { * @bearer: (non-standard) broadcast bearer structure * @media: (non-standard) broadcast media structure * @bpairs: array of bearer pairs - * @bpairs_temp: array of bearer pairs used during creation of "bpairs" + * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort() + * @remains: temporary node map used by tipc_bcbearer_send() + * @remains_new: temporary node map used tipc_bcbearer_send() + * + * Note: The fields labelled "temporary" are incorporated into the bearer + * to avoid consuming potentially limited stack space through the use of + * large local variables within multicast routines. Concurrent access is + * prevented through use of the spinlock "bc_lock". */ struct bcbearer { @@ -89,6 +96,8 @@ struct bcbearer { struct media media; struct bcbearer_pair bpairs[MAX_BEARERS]; struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; + struct node_map remains; + struct node_map remains_new; }; /** @@ -551,12 +560,8 @@ static int tipc_bcbearer_send(struct sk_ { static int send_count = 0; - struct node_map *remains; - struct node_map *remains_new; - struct node_map *remains_tmp; int bp_index; int swap_time; - int err; /* Prepare buffer for broadcasting (if first time trying to send it) */ @@ -577,9 +582,7 @@ static int tipc_bcbearer_send(struct sk_ /* Send buffer over bearers until all targets reached */ - remains = kmalloc(sizeof(struct node_map), GFP_ATOMIC); - remains_new = kmalloc(sizeof(struct node_map), GFP_ATOMIC); - *remains = tipc_cltr_bcast_nodes; + bcbearer->remains = tipc_cltr_bcast_nodes; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { struct bearer *p = bcbearer->bpairs[bp_index].primary; @@ -588,8 +591,8 @@ static int tipc_bcbearer_send(struct sk_ if (!p) break; /* no more bearers to try */ - tipc_nmap_diff(remains, &p->nodes, remains_new); - if (remains_new->count == remains->count) + tipc_nmap_diff(&bcbearer->remains, &p->nodes, &bcbearer->remains_new); + if (bcbearer->remains_new.count == bcbearer->remains.count) continue; /* bearer pair doesn't add anything */ if (!p->publ.blocked && @@ -607,27 +610,17 @@ swap: bcbearer->bpairs[bp_index].primary = s; bcbearer->bpairs[bp_index].secondary = p; update: - if (remains_new->count == 0) { - err = TIPC_OK; - goto out; - } + if (bcbearer->remains_new.count == 0) + return TIPC_OK; - /* swap map */ - remains_tmp = remains; - remains = remains_new; - remains_new = remains_tmp; + bcbearer->remains = bcbearer->remains_new; } /* Unable to reach all targets */ bcbearer->bearer.publ.blocked = 1; bcl->stats.bearer_congs++; - err = ~TIPC_OK; - - out: - kfree(remains_new); - kfree(remains); - return err; + return ~TIPC_OK; } /** -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/32] [TIPC] Fix for NULL pointer dereference
From: Eric Sesterhenn <[EMAIL PROTECTED]> This fixes a bug spotted by the coverity checker, bug id #366. If (mod(seqno - prev) != 1) we set buf to NULL, dereference it in the for case, and set it to whatever value happes to be at adress 0+next, if it happens to be non-zero, we even stay in the loop. It seems that the author intended to break there. Signed-off-by: Eric Sesterhenn <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/bcast.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 00691b7..44645f5 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -349,8 +349,10 @@ static void tipc_bclink_peek_nack(u32 de for (; buf; buf = buf->next) { u32 seqno = buf_seqno(buf); - if (mod(seqno - prev) != 1) + if (mod(seqno - prev) != 1) { buf = NULL; + break; + } if (seqno == gap_after) break; prev = seqno; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 26/32] [TIPC] Fixed memory leak in tipc_link_send() when destination is unreachable
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/link.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index ba7d3f1..ff40c91 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1135,9 +1135,13 @@ int tipc_link_send(struct sk_buff *buf, if (n_ptr) { tipc_node_lock(n_ptr); l_ptr = n_ptr->active_links[selector & 1]; - dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest); if (l_ptr) { + dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest); res = tipc_link_send_buf(l_ptr, buf); + } else { + dbg("Attempt to send msg to unreachable node:\n"); + msg_dbg(buf_msg(buf),">>>"); + buf_discard(buf); } tipc_node_unlock(n_ptr); } else { -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/32] [TIPC] Improved tolerance to promiscuous mode interface
From: Jon Maloy <[EMAIL PROTECTED]> Signed-off-by: Jon Maloy <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/eth_media.c | 20 +++- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 7a25278..b646619 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -98,17 +98,19 @@ static int recv_msg(struct sk_buff *buf, u32 size; if (likely(eb_ptr->bearer)) { - size = msg_size((struct tipc_msg *)buf->data); - skb_trim(buf, size); - if (likely(buf->len == size)) { - buf->next = NULL; - tipc_recv_msg(buf, eb_ptr->bearer); - } else { - kfree_skb(buf); + if (likely(!dev->promiscuity) || + !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || + !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { + size = msg_size((struct tipc_msg *)buf->data); + skb_trim(buf, size); + if (likely(buf->len == size)) { + buf->next = NULL; + tipc_recv_msg(buf, eb_ptr->bearer); + return TIPC_OK; + } } - } else { - kfree_skb(buf); } + kfree_skb(buf); return TIPC_OK; } -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/32] [TIPC] Prevent name table corruption if no room for new publication
From: Allan Stephens <[EMAIL PROTECTED]> Now exits cleanly if attempt to allocate larger array of subsequences fails, without losing track of pointer to existing array. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/name_table.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index d129422..0511436 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -284,18 +284,18 @@ static struct publication *tipc_nameseq_ /* Ensure there is space for new sub-sequence */ if (nseq->first_free == nseq->alloc) { - struct sub_seq *sseqs = nseq->sseqs; - nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2); - if (nseq->sseqs != NULL) { - memcpy(nseq->sseqs, sseqs, - nseq->alloc * sizeof (struct sub_seq)); - kfree(sseqs); - dbg("Allocated %u sseqs\n", nseq->alloc); - nseq->alloc *= 2; - } else { + struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2); + + if (!sseqs) { warn("Memory squeeze; failed to create sub-sequence\n"); return NULL; } + dbg("Allocated %u more sseqs\n", nseq->alloc); + memcpy(sseqs, nseq->sseqs, + nseq->alloc * sizeof(struct sub_seq)); + kfree(nseq->sseqs); + nseq->sseqs = sseqs; + nseq->alloc *= 2; } dbg("Have %u sseqs for type %u\n", nseq->alloc, type); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/32] [TIPC] Fixed privilege checking typo in dest_name_check().
From: Allan Stephens <[EMAIL PROTECTED]> This patch originated by Stephane Ouellette <[EMAIL PROTECTED]>. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 648a734..eaf4d69 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -426,7 +426,7 @@ static int dest_name_check(struct sockad if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) return -EFAULT; - if ((ntohs(hdr.tcm_type) & 0xC000) & (!capable(CAP_NET_ADMIN))) + if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN))) return -EACCES; return 0; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/32] [TIPC] Allow ports to receive multicast messages through native API.
From: Allan Stephens <[EMAIL PROTECTED]> This fix prevents a kernel panic if an application mistakenly sends a multicast message to TIPC's topology service or configuration service. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/port.c | 26 -- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/net/tipc/port.c b/net/tipc/port.c index 67e96cb..360920b 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -810,18 +810,20 @@ static void port_dispatcher_sigh(void *d void *usr_handle; int connected; int published; + u32 message_type; struct sk_buff *next = buf->next; struct tipc_msg *msg = buf_msg(buf); u32 dref = msg_destport(msg); + message_type = msg_type(msg); + if (message_type > TIPC_DIRECT_MSG) + goto reject;/* Unsupported message type */ + p_ptr = tipc_port_lock(dref); - if (!p_ptr) { - /* Port deleted while msg in queue */ - tipc_reject_msg(buf, TIPC_ERR_NO_PORT); - buf = next; - continue; - } + if (!p_ptr) + goto reject;/* Port deleted while msg in queue */ + orig.ref = msg_origport(msg); orig.node = msg_orignode(msg); up_ptr = p_ptr->user_port; @@ -832,7 +834,7 @@ static void port_dispatcher_sigh(void *d if (unlikely(msg_errcode(msg))) goto err; - switch (msg_type(msg)) { + switch (message_type) { case TIPC_CONN_MSG:{ tipc_conn_msg_event cb = up_ptr->conn_msg_cb; @@ -874,6 +876,7 @@ static void port_dispatcher_sigh(void *d &orig); break; } + case TIPC_MCAST_MSG: case TIPC_NAMED_MSG:{ tipc_named_msg_event cb = up_ptr->named_msg_cb; @@ -886,7 +889,8 @@ static void port_dispatcher_sigh(void *d goto reject; dseq.type = msg_nametype(msg); dseq.lower = msg_nameinst(msg); - dseq.upper = dseq.lower; + dseq.upper = (message_type == TIPC_NAMED_MSG) + ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_importance(msg), @@ -899,7 +903,7 @@ static void port_dispatcher_sigh(void *d buf = next; continue; err: - switch (msg_type(msg)) { + switch (message_type) { case TIPC_CONN_MSG:{ tipc_conn_shutdown_event cb = @@ -931,6 +935,7 @@ err: msg_data_sz(msg), msg_errcode(msg), &orig); break; } + case TIPC_MCAST_MSG: case TIPC_NAMED_MSG:{ tipc_named_msg_err_event cb = up_ptr->named_err_cb; @@ -940,7 +945,8 @@ err: break; dseq.type = msg_nametype(msg); dseq.lower = msg_nameinst(msg); - dseq.upper = dseq.lower; + dseq.upper = (message_type == TIPC_NAMED_MSG) + ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_errcode(msg), &dseq); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 15/32] [TIPC] Fixed connect() to detect a dest address that is missing or too short.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 0923213..758b2d2 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1244,7 +1244,7 @@ static int connect(struct socket *sock, if (sock->state != SS_UNCONNECTED) return -EISCONN; - if ((dst->family != AF_TIPC) || + if ((destlen < sizeof(*dst)) || (dst->family != AF_TIPC) || ((dst->addrtype != TIPC_ADDR_NAME) && (dst->addrtype != TIPC_ADDR_ID))) return -EINVAL; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/32] [TIPC] Added support for MODULE_VERSION capability.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 31c7dd5..5003acb 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -2,7 +2,7 @@ * net/tipc/core.c: TIPC module code * * Copyright (c) 2003-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ void tipc_socket_stop(void); int tipc_netlink_start(void); void tipc_netlink_stop(void); -#define MOD_NAME "tipc_start: " +#define TIPC_MOD_VER "1.6.1" #ifndef CONFIG_TIPC_ZONES #define CONFIG_TIPC_ZONES 3 @@ -224,6 +224,7 @@ module_exit(tipc_exit); MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_VERSION(TIPC_MOD_VER); /* Native TIPC API for kernel-space applications (see tipc.h) */ -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 25/32] [TIPC] Added missing warning for out-of-memory condition
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/port.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/net/tipc/port.c b/net/tipc/port.c index 899e08e..99846a1 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -1061,6 +1061,7 @@ int tipc_createport(u32 user_ref, up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC); if (up_ptr == NULL) { + warn("Port creation failed, no memory\n"); return -ENOMEM; } ref = tipc_createport_raw(NULL, port_dispatcher, port_wakeup, importance); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 21/32] [TIPC] recvmsg() now returns TIPC ancillary data using correct level (SOL_TIPC)
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index a1f2210..abecf2d 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -744,10 +744,10 @@ static int anc_data_recv(struct msghdr * if (unlikely(err)) { anc_data[0] = err; anc_data[1] = msg_data_sz(msg); - if ((res = put_cmsg(m, SOL_SOCKET, TIPC_ERRINFO, 8, anc_data))) + if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data))) return res; if (anc_data[1] && - (res = put_cmsg(m, SOL_SOCKET, TIPC_RETDATA, anc_data[1], + (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], msg_data(msg return res; } @@ -778,7 +778,7 @@ static int anc_data_recv(struct msghdr * has_name = 0; } if (has_name && - (res = put_cmsg(m, SOL_SOCKET, TIPC_DESTNAME, 12, anc_data))) + (res = put_cmsg(m, SOL_TIPC, TIPC_DESTNAME, 12, anc_data))) return res; return 0; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/32] [TIPC] Validate entire interface name when locating bearer to enable.
From: Allan Stephens <[EMAIL PROTECTED]> This fix prevents a bearer from being enabled using the wrong interface. For example, specifying "eth:eth14" might enable "eth:eth1" by mistake. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/eth_media.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 3ecb100..682da4a 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -2,7 +2,7 @@ * net/tipc/eth_media.c: Ethernet bearer support for TIPC * * Copyright (c) 2001-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,8 +127,7 @@ static int enable_bearer(struct tipc_bea /* Find device with specified name */ - while (dev && dev->name && - (memcmp(dev->name, driver_name, strlen(dev->name { + while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { dev = dev->next; } if (!dev) -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/32] [TIPC] Fix misleading comment in buf_discard() routine.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index d1edb7a..86f54f3 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -318,7 +318,7 @@ static inline struct sk_buff *buf_acquir * buf_discard - frees a TIPC message buffer * @skb: message buffer * - * Frees a new buffer. If passed NULL, just returns. + * Frees a message buffer. If passed NULL, just returns. */ static inline void buf_discard(struct sk_buff *skb) -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/32] [TIPC] Can now return destination name of form {0,x,y} via ancillary data.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 98550b9..361dc34 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -731,6 +731,7 @@ static int anc_data_recv(struct msghdr * u32 anc_data[3]; u32 err; u32 dest_type; + int has_name; int res; if (likely(m->msg_controllen == 0)) @@ -755,24 +756,27 @@ static int anc_data_recv(struct msghdr * dest_type = msg ? msg_type(msg) : TIPC_DIRECT_MSG; switch (dest_type) { case TIPC_NAMED_MSG: + has_name = 1; anc_data[0] = msg_nametype(msg); anc_data[1] = msg_namelower(msg); anc_data[2] = msg_namelower(msg); break; case TIPC_MCAST_MSG: + has_name = 1; anc_data[0] = msg_nametype(msg); anc_data[1] = msg_namelower(msg); anc_data[2] = msg_nameupper(msg); break; case TIPC_CONN_MSG: + has_name = (tport->conn_type != 0); anc_data[0] = tport->conn_type; anc_data[1] = tport->conn_instance; anc_data[2] = tport->conn_instance; break; default: - anc_data[0] = 0; + has_name = 0; } - if (anc_data[0] && + if (has_name && (res = put_cmsg(m, SOL_SOCKET, TIPC_DESTNAME, 12, anc_data))) return res; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 29/32] [TIPC] Enhanced & cleaned up system messages; fixed 2 obscure memory leaks.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/bcast.c |2 + net/tipc/bcast.h |2 + net/tipc/bearer.c | 70 +++-- net/tipc/cluster.c| 22 +-- net/tipc/config.c |2 + net/tipc/discover.c |7 + net/tipc/link.c | 39 +++ net/tipc/name_distr.c | 10 --- net/tipc/name_table.c |6 ++-- net/tipc/node.c | 68 +--- net/tipc/port.c | 10 --- net/tipc/subscr.c | 18 ++--- net/tipc/zone.c | 19 - 13 files changed, 149 insertions(+), 126 deletions(-) diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 44645f5..1633ef2 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -785,7 +785,7 @@ int tipc_bclink_init(void) bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); if (!bcbearer || !bclink) { nomem: - warn("Memory squeeze; Failed to create multicast link\n"); + warn("Multicast link creation failed, no memory\n"); kfree(bcbearer); bcbearer = NULL; kfree(bclink); diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index 0e3be2a..b243d9d 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h @@ -180,7 +180,7 @@ static inline void tipc_port_list_add(st if (!item->next) { item->next = kmalloc(sizeof(*item), GFP_ATOMIC); if (!item->next) { - warn("Memory squeeze: multicast destination port list is incomplete\n"); + warn("Incomplete multicast delivery, no memory\n"); return; } item->next->next = NULL; diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index e213a8e..4fa24b5 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type, goto exit; if (!media_name_valid(name)) { - warn("Media registration error: illegal name <%s>\n", name); + warn("Media <%s> rejected, illegal name\n", name); goto exit; } if (!bcast_addr) { - warn("Media registration error: no broadcast address supplied\n"); + warn("Media <%s> rejected, no broadcast address\n", name); goto exit; } if ((bearer_priority < TIPC_MIN_LINK_PRI) && (bearer_priority > TIPC_MAX_LINK_PRI)) { - warn("Media registration error: priority %u\n", bearer_priority); + warn("Media <%s> rejected, illegal priority (%u)\n", name, +bearer_priority); goto exit; } if ((link_tolerance < TIPC_MIN_LINK_TOL) || (link_tolerance > TIPC_MAX_LINK_TOL)) { - warn("Media registration error: tolerance %u\n", link_tolerance); + warn("Media <%s> rejected, illegal tolerance (%u)\n", name, +link_tolerance); goto exit; } media_id = media_count++; if (media_id >= MAX_MEDIA) { - warn("Attempt to register more than %u media\n", MAX_MEDIA); + warn("Media <%s> rejected, media limit reached (%u)\n", name, +MAX_MEDIA); media_count--; goto exit; } for (i = 0; i < media_id; i++) { if (media_list[i].type_id == media_type) { - warn("Attempt to register second media with type %u\n", + warn("Media <%s> rejected, duplicate type (%u)\n", name, media_type); media_count--; goto exit; } if (!strcmp(name, media_list[i].name)) { - warn("Attempt to re-register media name <%s>\n", name); + warn("Media <%s> rejected, duplicate name\n", name); media_count--; goto exit; } @@ -283,6 +286,9 @@ static struct bearer *bearer_find(const struct bearer *b_ptr; u32 i; + if (tipc_mode != TIPC_NET_MODE) + return NULL; + for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
[PATCH 23/32] [TIPC] Optimized argument validation done by connect().
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c | 17 + 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 6d4d2b0..32d7784 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -455,7 +455,8 @@ static int send_msg(struct kiocb *iocb, if (unlikely(!dest)) return -EDESTADDRREQ; - if (unlikely(dest->family != AF_TIPC)) + if (unlikely((m->msg_namelen < sizeof(*dest)) || +(dest->family != AF_TIPC))) return -EINVAL; needs_conn = (sock->state != SS_READY); @@ -1245,7 +1246,8 @@ static int connect(struct socket *sock, if (sock->state == SS_READY) return -EOPNOTSUPP; - /* MOVE THE REST OF THIS ERROR CHECKING TO send_msg()? */ + /* Issue Posix-compliant error code if socket is in the wrong state */ + if (sock->state == SS_LISTENING) return -EOPNOTSUPP; if (sock->state == SS_CONNECTING) @@ -1253,13 +1255,20 @@ static int connect(struct socket *sock, if (sock->state != SS_UNCONNECTED) return -EISCONN; - if ((destlen < sizeof(*dst)) || (dst->family != AF_TIPC) || - ((dst->addrtype != TIPC_ADDR_NAME) && (dst->addrtype != TIPC_ADDR_ID))) + /* +* Reject connection attempt using multicast address +* +* Note: send_msg() validates the rest of the address fields, +* so there's no need to do it here +*/ + + if (dst->addrtype == TIPC_ADDR_MCAST) return -EINVAL; /* Send a 'SYN-' to destination */ m.msg_name = dest; + m.msg_namelen = destlen; if ((res = send_msg(NULL, sock, &m, 0)) < 0) { sock->state = SS_DISCONNECTING; return res; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/32] [TIPC] Stream socket send indicates partial success if data partially sent.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9c834fc..8cefacb 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -601,7 +601,8 @@ exit: * * Used for SOCK_STREAM data. * - * Returns the number of bytes sent on success, or errno otherwise + * Returns the number of bytes sent on success (or partial success), + * or errno if no data sent */ @@ -615,6 +616,7 @@ static int send_stream(struct kiocb *ioc char __user *curr_start; int curr_left; int bytes_to_send; + int bytes_sent; int res; if (likely(total_len <= TIPC_MAX_USER_MSG_SIZE)) @@ -637,11 +639,11 @@ static int send_stream(struct kiocb *ioc * of small iovec entries into send_packet(). */ - my_msg = *m; - curr_iov = my_msg.msg_iov; - curr_iovlen = my_msg.msg_iovlen; + curr_iov = m->msg_iov; + curr_iovlen = m->msg_iovlen; my_msg.msg_iov = &my_iov; my_msg.msg_iovlen = 1; + bytes_sent = 0; while (curr_iovlen--) { curr_start = curr_iov->iov_base; @@ -652,16 +654,18 @@ static int send_stream(struct kiocb *ioc ? curr_left : TIPC_MAX_USER_MSG_SIZE; my_iov.iov_base = curr_start; my_iov.iov_len = bytes_to_send; -if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) -return res; +if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { + return bytes_sent ? bytes_sent : res; + } curr_left -= bytes_to_send; curr_start += bytes_to_send; + bytes_sent += bytes_to_send; } curr_iov++; } - return total_len; + return bytes_sent; } /** -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/32] [TIPC] Connected send now checks socket state when retrying congested send.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 361dc34..9c834fc 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -565,15 +565,15 @@ static int send_packet(struct kiocb *ioc return -ERESTARTSYS; } -if (unlikely(sock->state != SS_CONNECTED)) { -if (sock->state == SS_DISCONNECTING) -res = -EPIPE; -else -res = -ENOTCONN; -goto exit; -} - do { + if (unlikely(sock->state != SS_CONNECTED)) { + if (sock->state == SS_DISCONNECTING) + res = -EPIPE; + else + res = -ENOTCONN; + goto exit; + } + res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); if (likely(res != -ELINKCONG)) { exit: -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/32] [TIPC] Corrected potential misuse of tipc_media_addr structure.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- include/net/tipc/tipc_bearer.h | 12 ++-- net/tipc/eth_media.c |4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h index 098607c..e07136d 100644 --- a/include/net/tipc/tipc_bearer.h +++ b/include/net/tipc/tipc_bearer.h @@ -49,10 +49,18 @@ #include #define TIPC_MEDIA_TYPE_ETH1 +/* + * Destination address structure used by TIPC bearers when sending messages + * + * IMPORTANT: The fields of this structure MUST be stored using the specified + * byte order indicated below, as the structure is exchanged between nodes + * as part of a link setup process. + */ + struct tipc_media_addr { - __u32 type; + __u32 type;/* bearer type (network byte order) */ union { - __u8 eth_addr[6]; /* Ethernet bearer */ + __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ #if 0 /* Prototypes for other possible bearer types */ diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index b646619..3ecb100 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -254,7 +254,9 @@ int tipc_eth_media_start(void) if (eth_started) return -EINVAL; - memset(&bcast_addr, 0xff, sizeof(bcast_addr)); + bcast_addr.type = htonl(TIPC_MEDIA_TYPE_ETH); + memset(&bcast_addr.dev_addr, 0xff, ETH_ALEN); + memset(eth_bearers, 0, sizeof(eth_bearers)); res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/32] [TIPC] Implied connect now saves dest name for retrieval as ancillary data.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 758b2d2..98550b9 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -470,6 +470,10 @@ static int send_msg(struct kiocb *iocb, if ((tsock->p->published) || ((sock->type == SOCK_STREAM) && (total_len != 0))) return -EOPNOTSUPP; + if (dest->addrtype == TIPC_ADDR_NAME) { + tsock->p->conn_type = dest->addr.name.name.type; + tsock->p->conn_instance = dest->addr.name.name.instance; + } } if (down_interruptible(&tsock->sem)) @@ -1269,10 +1273,6 @@ static int connect(struct socket *sock, msg = buf_msg(buf); res = auto_connect(sock, tsock, msg); if (!res) { - if (dst->addrtype == TIPC_ADDR_NAME) { - tsock->p->conn_type = dst->addr.name.name.type; - tsock->p->conn_instance = dst->addr.name.name.instance; - } if (!msg_data_sz(msg)) advance_queue(tsock); } -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/32] [TIPC] Non-operation-affecting corrections to comments & function definitions.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index eaf4d69..0923213 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -437,7 +437,7 @@ static int dest_name_check(struct sockad * @iocb: (unused) * @sock: socket structure * @m: message to send - * @total_len: (unused) + * @total_len: length of message * * Message must have an destination specified explicitly. * Used for SOCK_RDM and SOCK_DGRAM messages, @@ -538,7 +538,7 @@ exit: * @iocb: (unused) * @sock: socket structure * @m: message to send - * @total_len: (unused) + * @total_len: length of message * * Used for SOCK_SEQPACKET messages and SOCK_STREAM data. * @@ -1386,7 +1386,7 @@ exit: /** * shutdown - shutdown socket connection * @sock: socket structure - * @how: direction to close (always treated as read + write) + * @how: direction to close (unused; always treated as read + write) * * Terminates connection (if necessary), then purges socket's receive queue. * @@ -1469,7 +1469,8 @@ restart: * Returns 0 on success, errno otherwise */ -static int setsockopt(struct socket *sock, int lvl, int opt, char *ov, int ol) +static int setsockopt(struct socket *sock, + int lvl, int opt, char __user *ov, int ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); u32 value; @@ -1525,7 +1526,8 @@ static int setsockopt(struct socket *soc * Returns 0 on success, errno otherwise */ -static int getsockopt(struct socket *sock, int lvl, int opt, char *ov, int *ol) +static int getsockopt(struct socket *sock, + int lvl, int opt, char __user *ov, int *ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); int len; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 28/32] [TIPC] First phase of assert() cleanup
From: Allan Stephens <[EMAIL PROTECTED]> This also contains enhancements to simplify comparisons in name table publication removal algorithm and to simplify name table sanity checking when shutting down TIPC. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/link.c| 13 ++- net/tipc/name_distr.c | 20 + net/tipc/name_table.c | 179 +--- net/tipc/node.c|3 - net/tipc/node_subscr.c | 15 ++-- net/tipc/port.c|1 net/tipc/ref.c | 31 +++- 7 files changed, 153 insertions(+), 109 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index ff40c91..2efced5 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -574,7 +574,6 @@ void tipc_link_wakeup_ports(struct link break; list_del_init(&p_ptr->wait_list); p_ptr->congested_link = NULL; - assert(p_ptr->wakeup); spin_lock_bh(p_ptr->publ.lock); p_ptr->publ.congested = 0; p_ptr->wakeup(&p_ptr->publ); @@ -1246,8 +1245,6 @@ int tipc_link_send_sections_fast(struct int res; u32 selector = msg_origport(hdr) & 1; - assert(destaddr != tipc_own_addr); - again: /* * Try building message using port's max_pkt hint. @@ -2310,7 +2307,6 @@ void tipc_link_tunnel(struct link *l_ptr memcpy(buf->data + INT_H_SIZE, (unchar *)msg, length); dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); msg_dbg(buf_msg(buf), ">SEND>"); - assert(tunnel); tipc_link_send_buf(tunnel, buf); } @@ -2339,10 +2335,10 @@ void tipc_link_changeover(struct link *l ORIGINAL_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr); msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id); msg_set_msgcnt(&tunnel_hdr, msgcount); + if (!l_ptr->first_out) { struct sk_buff *buf; - assert(!msgcount); buf = buf_acquire(INT_H_SIZE); if (buf) { memcpy(buf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); @@ -2356,6 +2352,7 @@ void tipc_link_changeover(struct link *l } return; } + while (crs) { struct tipc_msg *msg = buf_msg(crs); @@ -2455,11 +2452,15 @@ static int link_recv_changeover_msg(stru u32 msg_count = msg_msgcnt(tunnel_msg); dest_link = (*l_ptr)->owner->links[msg_bearer_id(tunnel_msg)]; - assert(dest_link != *l_ptr); if (!dest_link) { msg_dbg(tunnel_msg, "NOLINK/\n", + (*l_ptr)->name); + goto exit; + } dbg("%c<-%c:", dest_link->b_ptr->net_plane, (*l_ptr)->b_ptr->net_plane); *l_ptr = dest_link; diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index a3bbc89..5718ecb 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -174,7 +174,6 @@ void tipc_named_node_up(unsigned long no u32 rest; u32 max_item_buf; - assert(in_own_cluster(node)); read_lock_bh(&tipc_nametbl_lock); max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf *= ITEM_SIZE; @@ -221,15 +220,24 @@ exit: static void node_is_down(struct publication *publ) { struct publication *p; + write_lock_bh(&tipc_nametbl_lock); dbg("node_is_down: withdrawing %u, %u, %u\n", publ->type, publ->lower, publ->upper); publ->key += 1222345; p = tipc_nametbl_remove_publ(publ->type, publ->lower, publ->node, publ->ref, publ->key); -assert(p == publ); write_unlock_bh(&tipc_nametbl_lock); - kfree(publ); + +if (p != publ) { + err("Unable to remove publication from failed node\n" + "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n", + publ->type, publ->lower, publ->node, publ->ref, publ->key); + } + + if (p) { + kfree(p); + } } /** @@ -275,6 +283,12 @@ void tipc_named_recv(struct sk_buff *buf if (publ) { tipc_nodesub_unsubscribe(&publ->subscr); kfree(publ); + } else { + err("Unable to remove publication by node 0x%x\n" + "(type=%u, lower=%u, ref=%u, key=%u)\n", + msg_orignode(msg), + ntohl(item->type), ntohl(item->lower), +
[PATCH 8/32] [TIPC] Allow compilation when CONFIG_TIPC_DEBUG is not set.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.h | 19 ++- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/net/tipc/core.h b/net/tipc/core.h index 1f2e8b2..d1edb7a 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -2,7 +2,7 @@ * net/tipc/core.h: Include file for TIPC global declarations * * Copyright (c) 2005-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,10 +111,6 @@ #endif #else -#ifndef DBG_OUTPUT -#define DBG_OUTPUT NULL -#endif - /* * TIPC debug support not included: * - system messages are printed to system console @@ -129,6 +125,19 @@ #define dbg(fmt, arg...) do {} while (0) #define msg_dbg(msg,txt) do {} while (0) #define dump(fmt,arg...) do {} while (0) + +/* + * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is + * the null print buffer. Thes ensures that any system or debug messages + * that are generated without using the above macros are handled correctly. + */ + +#undef TIPC_OUTPUT +#define TIPC_OUTPUT TIPC_CONS + +#undef DBG_OUTPUT +#define DBG_OUTPUT NULL + #endif -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 22/32] [TIPC] Simplify code for returning partial success of stream send request.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index abecf2d..6d4d2b0 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -969,7 +969,7 @@ static int recv_stream(struct kiocb *ioc restart: if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && (flags & MSG_DONTWAIT))) { - res = (sz_copied == 0) ? -EWOULDBLOCK : 0; + res = -EWOULDBLOCK; goto exit; } @@ -1060,7 +1060,7 @@ restart: exit: up(&tsock->sem); - return res ? res : sz_copied; + return sz_copied ? sz_copied : res; } /** -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/32] [TIPC] Use correct upper bound when validating network zone number.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/tipc/core.c b/net/tipc/core.c index 3d0a8ee..31c7dd5 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -198,7 +198,7 @@ static int __init tipc_init(void) tipc_max_publications = 1; tipc_max_subscriptions = 2000; tipc_max_ports = delimit(CONFIG_TIPC_PORTS, 127, 65536); - tipc_max_zones = delimit(CONFIG_TIPC_ZONES, 1, 511); + tipc_max_zones = delimit(CONFIG_TIPC_ZONES, 1, 255); tipc_max_clusters = delimit(CONFIG_TIPC_CLUSTERS, 1, 1); tipc_max_nodes = delimit(CONFIG_TIPC_NODES, 8, 2047); tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/32] [TIPC] Links now validate destination node specified by incoming messages.
From: Allan Stephens <[EMAIL PROTECTED]> This fix prevents link flopping and name table inconsistency problems arising when a node is assigned a different value than it used previously. (Changing the value causes other nodes to have two link endpoints sending to the same MAC address using two different destination values, requiring the receiving node to filter out the unwanted messages.) Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/link.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 784b24b..955b87d 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1720,6 +1720,11 @@ #endif link_recv_non_seq(buf); continue; } + + if (unlikely(!msg_short(msg) && +(msg_destnode(msg) != tipc_own_addr))) + goto cont; + n_ptr = tipc_node_find(msg_prevnode(msg)); if (unlikely(!n_ptr)) goto cont; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/32] [TIPC] Multicast link failure now resets all links to "nacking" node.
From: Allan Stephens <[EMAIL PROTECTED]> This fix prevents node from crashing. Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/bcast.c | 32 +++--- net/tipc/link.c | 124 +- 2 files changed, 128 insertions(+), 28 deletions(-) diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 2c4ecbe..00691b7 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -49,13 +49,19 @@ #include "bearer.h" #include "name_table.h" #include "bcast.h" - #define MAX_PKT_DEFAULT_MCAST 1500 /* bcast link max packet size (fixed) */ #define BCLINK_WIN_DEFAULT 20 /* bcast link window size (default) */ #define BCLINK_LOG_BUF_SIZE 0 +/* + * Loss rate for incoming broadcast frames; used to test retransmission code. + * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. + */ + +#define TIPC_BCAST_LOSS_RATE 0 + /** * struct bcbearer_pair - a pair of bearers used by broadcast link * @primary: pointer to primary bearer @@ -165,21 +171,18 @@ static int bclink_ack_allowed(u32 n) * @after: sequence number of last packet to *not* retransmit * @to: sequence number of last packet to retransmit * - * Called with 'node' locked, bc_lock unlocked + * Called with bc_lock locked */ static void bclink_retransmit_pkt(u32 after, u32 to) { struct sk_buff *buf; - spin_lock_bh(&bc_lock); buf = bcl->first_out; while (buf && less_eq(buf_seqno(buf), after)) { buf = buf->next; } - if (buf != NULL) - tipc_link_retransmit(bcl, buf, mod(to - after)); - spin_unlock_bh(&bc_lock); + tipc_link_retransmit(bcl, buf, mod(to - after)); } /** @@ -399,7 +402,10 @@ int tipc_bclink_send_msg(struct sk_buff */ void tipc_bclink_recv_pkt(struct sk_buff *buf) -{ +{ +#if (TIPC_BCAST_LOSS_RATE) + static int rx_count = 0; +#endif struct tipc_msg *msg = buf_msg(buf); struct node* node = tipc_node_find(msg_prevnode(msg)); u32 next_in; @@ -420,9 +426,13 @@ void tipc_bclink_recv_pkt(struct sk_buff tipc_node_lock(node); tipc_bclink_acknowledge(node, msg_bcast_ack(msg)); tipc_node_unlock(node); + spin_lock_bh(&bc_lock); bcl->stats.recv_nacks++; + bcl->owner->next = node; /* remember requestor */ bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); + bcl->owner->next = NULL; + spin_unlock_bh(&bc_lock); } else { tipc_bclink_peek_nack(msg_destnode(msg), msg_bcast_tag(msg), @@ -433,6 +443,14 @@ void tipc_bclink_recv_pkt(struct sk_buff return; } +#if (TIPC_BCAST_LOSS_RATE) + if (++rx_count == TIPC_BCAST_LOSS_RATE) { + rx_count = 0; + buf_discard(buf); + return; + } +#endif + tipc_node_lock(node); receive: deferred = node->bclink.deferred_head; diff --git a/net/tipc/link.c b/net/tipc/link.c index 955b87d..ba7d3f1 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1604,40 +1604,121 @@ void tipc_link_push_queue(struct link *l tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); } +static void link_reset_all(unsigned long addr) +{ + struct node *n_ptr; + char addr_string[16]; + u32 i; + + read_lock_bh(&tipc_net_lock); + n_ptr = tipc_node_find((u32)addr); + if (!n_ptr) { + read_unlock_bh(&tipc_net_lock); + return; /* node no longer exists */ + } + + tipc_node_lock(n_ptr); + + warn("Resetting all links to %s\n", +addr_string_fill(addr_string, n_ptr->addr)); + + for (i = 0; i < MAX_BEARERS; i++) { + if (n_ptr->links[i]) { + link_print(n_ptr->links[i], TIPC_OUTPUT, + "Resetting link\n"); + tipc_link_reset(n_ptr->links[i]); + } + } + + tipc_node_unlock(n_ptr); + read_unlock_bh(&tipc_net_lock); +} + +static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) +{ + struct tipc_msg *msg = buf_msg(buf); + + warn("Retransmission failure on link <%s>\n", l_ptr->name); + tipc_msg_print(TIPC_OUTPUT, msg, ">RETR-FAIL>"); + + if (l_ptr->addr) { + + /* Handle failure on standard link */ + +
[PATCH 20/32] [TIPC] Improved performance of error checking during socket creation.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/socket.c |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 8cefacb..a1f2210 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -169,12 +169,6 @@ static int tipc_create(struct socket *so struct sock *sk; u32 ref; - if ((sock->type != SOCK_STREAM) && - (sock->type != SOCK_SEQPACKET) && - (sock->type != SOCK_DGRAM) && - (sock->type != SOCK_RDM)) - return -EPROTOTYPE; - if (unlikely(protocol != 0)) return -EPROTONOSUPPORT; @@ -199,6 +193,9 @@ static int tipc_create(struct socket *so sock->ops = &msg_ops; sock->state = SS_READY; break; + default: + tipc_deleteport(ref); + return -EPROTOTYPE; } sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1); -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 30/32] [TIPC] Fixed link switchover bugs
From: Allan Stephens <[EMAIL PROTECTED]> Incorporates several related fixes: - switchover now occurs when switching from an active link to a standby link - failure of a standby link no longer initiates switchover - links now display correct # of received packtes following reactivation Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/link.c | 30 -- net/tipc/node.c |7 +-- net/tipc/node.h |2 ++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index d7668b8..d646580 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -690,6 +690,7 @@ void tipc_link_reset(struct link *l_ptr) struct sk_buff *buf; u32 prev_state = l_ptr->state; u32 checkpoint = l_ptr->next_in_no; + int was_active_link = tipc_link_is_active(l_ptr); msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1); @@ -711,7 +712,7 @@ #if 0 tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name); dbg_link_dump(); #endif - if (tipc_node_has_active_links(l_ptr->owner) && + if (was_active_link && tipc_node_has_active_links(l_ptr->owner) && l_ptr->owner->permit_changeover) { l_ptr->reset_checkpoint = checkpoint; l_ptr->exp_msg_count = START_CHANGEOVER; @@ -754,7 +755,7 @@ #endif static void link_activate(struct link *l_ptr) { - l_ptr->next_in_no = 1; + l_ptr->next_in_no = l_ptr->stats.recv_info = 1; tipc_node_link_up(l_ptr->owner, l_ptr); tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); link_send_event(tipc_cfg_link_event, l_ptr, 1); @@ -2303,12 +2304,18 @@ void tipc_link_tunnel(struct link *l_ptr u32 length = msg_size(msg); tunnel = l_ptr->owner->active_links[selector & 1]; - if (!tipc_link_is_up(tunnel)) + if (!tipc_link_is_up(tunnel)) { + warn("Link changeover error, " +"tunnel link no longer available\n"); return; + } msg_set_size(tunnel_hdr, length + INT_H_SIZE); buf = buf_acquire(length + INT_H_SIZE); - if (!buf) + if (!buf) { + warn("Link changeover error, " +"unable to send tunnel msg\n"); return; + } memcpy(buf->data, (unchar *)tunnel_hdr, INT_H_SIZE); memcpy(buf->data + INT_H_SIZE, (unchar *)msg, length); dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); @@ -2328,19 +2335,23 @@ void tipc_link_changeover(struct link *l u32 msgcount = l_ptr->out_queue_size; struct sk_buff *crs = l_ptr->first_out; struct link *tunnel = l_ptr->owner->active_links[0]; - int split_bundles = tipc_node_has_redundant_links(l_ptr->owner); struct tipc_msg tunnel_hdr; + int split_bundles; if (!tunnel) return; - if (!l_ptr->owner->permit_changeover) + if (!l_ptr->owner->permit_changeover) { + warn("Link changeover error, " +"peer did not permit changeover\n"); return; + } msg_init(&tunnel_hdr, CHANGEOVER_PROTOCOL, ORIGINAL_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr); msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id); msg_set_msgcnt(&tunnel_hdr, msgcount); + dbg("Link changeover requires %u tunnel messages\n", msgcount); if (!l_ptr->first_out) { struct sk_buff *buf; @@ -2360,6 +2371,9 @@ void tipc_link_changeover(struct link *l return; } + split_bundles = (l_ptr->owner->active_links[0] != +l_ptr->owner->active_links[1]); + while (crs) { struct tipc_msg *msg = buf_msg(crs); @@ -2497,11 +2511,13 @@ static int link_recv_changeover_msg(stru dest_link->name); tipc_link_reset(dest_link); dest_link->exp_msg_count = msg_count; + dbg("Expecting %u tunnelled messages\n", msg_count); if (!msg_count) goto exit; } else if (dest_link->exp_msg_count == START_CHANGEOVER) { msg_dbg(tunnel_msg, "BLK/FIRST/exp_msg_count = msg_count; + dbg("Expecting %u tunnelled messages\n", msg_count); if (!msg_count) goto exit; } @@ -2509,6 +2525,8 @@ static int link_recv_changeover_msg(stru /* Receive original message */ if (dest_link->exp_msg_count == 0) { +
[PATCH 32/32] [TIPC] Fix incorrect correction to discovery timer frequency computation.
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/discover.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/tipc/discover.c b/net/tipc/discover.c index ee9b448..2b84412 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -2,7 +2,7 @@ * net/tipc/discover.c * * Copyright (c) 2003-2006, Ericsson AB - * Copyright (c) 2005, Wind River Systems + * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -267,8 +267,8 @@ static void disc_timeout(struct link_req /* leave timer interval "as is" if already at a "normal" rate */ } else { req->timer_intv *= 2; - if (req->timer_intv > TIPC_LINK_REQ_SLOW) - req->timer_intv = TIPC_LINK_REQ_SLOW; + if (req->timer_intv > TIPC_LINK_REQ_FAST) + req->timer_intv = TIPC_LINK_REQ_FAST; if ((req->timer_intv == TIPC_LINK_REQ_FAST) && (req->bearer->nodes.count)) req->timer_intv = TIPC_LINK_REQ_SLOW; -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 24/32] [TIPC] Withdrawing all names from nameless port now returns success, not error
From: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Allan Stephens <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- net/tipc/port.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/net/tipc/port.c b/net/tipc/port.c index 360920b..899e08e 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -1171,8 +1171,6 @@ int tipc_withdraw(u32 ref, unsigned int p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; - if (!p_ptr->publ.published) - goto exit; if (!seq) { list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { @@ -1199,7 +1197,6 @@ int tipc_withdraw(u32 ref, unsigned int } if (list_empty(&p_ptr->publications)) p_ptr->publ.published = 0; -exit: tipc_port_unlock(p_ptr); return res; } -- 1.4.0 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/32] TIPC updates
Here's a resend of the latest TIPC updates. I apologize for not properly submitting the patches for review the first time around. This patch set includes several minor bugfixes. Most of them ported over from an older TIPC 1.5.x branch maintained on sourceforge (that branch is being phased). Patches can be pulled from: git://tipc.cslab.ericsson.net/pub/git/tipc.git Summary: include/net/tipc/tipc_bearer.h | 12 ++ net/tipc/bcast.c | 79 --- net/tipc/bcast.h |2 net/tipc/bearer.c | 70 +++-- net/tipc/cluster.c | 22 ++-- net/tipc/config.c | 85 +++- net/tipc/core.c|7 + net/tipc/core.h| 21 +++- net/tipc/discover.c| 13 +- net/tipc/eth_media.c | 29 +++-- net/tipc/link.c| 217 +++- net/tipc/name_distr.c | 30 -- net/tipc/name_table.c | 203 - net/tipc/node.c| 78 -- net/tipc/node.h|2 net/tipc/node_subscr.c | 15 +-- net/tipc/port.c| 41 net/tipc/ref.c | 31 +- net/tipc/socket.c | 100 +++--- net/tipc/subscr.c | 18 ++- net/tipc/zone.c| 19 ++-- 21 files changed, 661 insertions(+), 433 deletions(-) Allan Stephens: [TIPC] Prevent name table corruption if no room for new publication [TIPC] Use correct upper bound when validating network zone number. [TIPC] Corrected potential misuse of tipc_media_addr structure. [TIPC] Allow ports to receive multicast messages through native API. [TIPC] Links now validate destination node specified by incoming messages. [TIPC] Multicast link failure now resets all links to "nacking" node. [TIPC] Allow compilation when CONFIG_TIPC_DEBUG is not set. [TIPC] Fixed privilege checking typo in dest_name_check(). [TIPC] Fix misleading comment in buf_discard() routine. [TIPC] Added support for MODULE_VERSION capability. [TIPC] Validate entire interface name when locating bearer to enable. [TIPC] Non-operation-affecting corrections to comments & function definitions. [TIPC] Fixed connect() to detect a dest address that is missing or too short. [TIPC] Implied connect now saves dest name for retrieval as ancillary data. [TIPC] Can now return destination name of form {0,x,y} via ancillary data. [TIPC] Connected send now checks socket state when retrying congested send. [TIPC] Stream socket send indicates partial success if data partially sent. [TIPC] Improved performance of error checking during socket creation. [TIPC] recvmsg() now returns TIPC ancillary data using correct level (SOL_TIPC) [TIPC] Simplify code for returning partial success of stream send request. [TIPC] Optimized argument validation done by connect(). [TIPC] Withdrawing all names from nameless port now returns success, not error [TIPC] Added missing warning for out-of-memory condition [TIPC] Fixed memory leak in tipc_link_send() when destination is unreachable [TIPC] Disallow config operations that aren't supported in certain modes. [TIPC] First phase of assert() cleanup [TIPC] Enhanced & cleaned up system messages; fixed 2 obscure memory leaks. [TIPC] Fixed link switchover bugs [TIPC] Get rid of dynamically allocated arrays in broadcast code. [TIPC] Fix incorrect correction to discovery timer frequency computation. Eric Sesterhenn: [TIPC] Fix for NULL pointer dereference Jon Maloy: [TIPC] Improved tolerance to promiscuous mode interface /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PATCH] TIPC updates
Hi Dave, Here are the latest TIPC updates. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git Thanks /Per include/net/tipc/tipc_bearer.h | 12 ++ net/tipc/bcast.c | 79 --- net/tipc/bcast.h |2 net/tipc/bearer.c | 70 +++-- net/tipc/cluster.c | 22 ++-- net/tipc/config.c | 85 +++- net/tipc/core.c|7 + net/tipc/core.h| 21 +++- net/tipc/discover.c|7 - net/tipc/eth_media.c |9 +- net/tipc/link.c| 217 +++- net/tipc/name_distr.c | 30 -- net/tipc/name_table.c | 203 - net/tipc/node.c| 78 -- net/tipc/node.h|2 net/tipc/node_subscr.c | 15 +-- net/tipc/port.c| 41 net/tipc/ref.c | 31 +- net/tipc/socket.c | 100 +++--- net/tipc/subscr.c | 18 ++- net/tipc/zone.c| 19 ++-- 21 files changed, 647 insertions(+), 421 deletions(-) Allan Stephens: [TIPC] Prevent name table corruption if no room for new publication [TIPC] Use correct upper bound when validating network zone number. [TIPC] Corrected potential misuse of tipc_media_addr structure. [TIPC] Allow ports to receive multicast messages through native API. [TIPC] Links now validate destination node specified by incoming messages. [TIPC] Multicast link failure now resets all links to "nacking" node. [TIPC] Allow compilation when CONFIG_TIPC_DEBUG is not set. [TIPC] Fixed privilege checking typo in dest_name_check(). [TIPC] Fix misleading comment in buf_discard() routine. [TIPC] Added support for MODULE_VERSION capability. [TIPC] Validate entire interface name when locating bearer to enable. [TIPC] Non-operation-affecting corrections to comments & function definitions. [TIPC] Fixed connect() to detect a dest address that is missing or too short. [TIPC] Implied connect now saves dest name for retrieval as ancillary data. [TIPC] Can now return destination name of form {0,x,y} via ancillary data. [TIPC] Connected send now checks socket state when retrying congested send. [TIPC] Stream socket send indicates partial success if data partially sent. [TIPC] Improved performance of error checking during socket creation. [TIPC] recvmsg() now returns TIPC ancillary data using correct level (SOL_TIPC) [TIPC] Simplify code for returning partial success of stream send request. [TIPC] Optimized argument validation done by connect(). [TIPC] Withdrawing all names from nameless port now returns success, not error [TIPC] Added missing warning for out-of-memory condition [TIPC] Fixed memory leak in tipc_link_send() when destination is unreachable [TIPC] Disallow config operations that aren't supported in certain modes. [TIPC] First phase of assert() cleanup [TIPC] Enhanced & cleaned up system messages; fixed 2 obscure memory leaks. [TIPC] Fixed link switchover bugs [TIPC] Get rid of dynamically allocated arrays in broadcast code. Eric Sesterhenn: [TIPC] Fix for NULL pointer dereference Per Liden: [TIPC] Fixed incorrect access permissions - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PATCH] TIPC updates
On Wed, 8 Mar 2006, David S. Miller wrote: > From: Per Liden <[EMAIL PROTECTED]> > Date: Wed, 8 Mar 2006 11:18:15 +0100 (CET) > > > Here is a set of patches for net-2.6.17. > > > > Please pull from: > > > > git://tipc.cslab.ericsson.net/pub/git/tipc.git > > Looks good, but I can't pull it cleanly. Ok, looks like git://git.kernel.org is still not in sync, but I managed to resync over http instead. Please retry the pull. Should be clean now. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PATCH] TIPC updates
Hi Dave, Here is a set of patches for net-2.6.17. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git Thanks /Per net/tipc/bcast.c | 58 +++ net/tipc/bearer.c | 20 +-- net/tipc/cluster.c | 20 +-- net/tipc/cluster.h |2 + net/tipc/config.c |4 +- net/tipc/dbg.c |4 +- net/tipc/discover.c|8 ++-- net/tipc/eth_media.c |4 +- net/tipc/link.c| 89 +++- net/tipc/name_distr.c |6 ++- net/tipc/name_table.c | 62 ++--- net/tipc/net.c |7 ++-- net/tipc/node.c| 20 +-- net/tipc/node.h|2 + net/tipc/node_subscr.c |2 + net/tipc/port.c| 57 ++- net/tipc/ref.c |8 ++-- net/tipc/ref.h |4 +- net/tipc/socket.c | 28 --- net/tipc/subscr.c | 30 net/tipc/user_reg.c|4 +- net/tipc/zone.c| 12 +++--- 22 files changed, 230 insertions(+), 221 deletions(-) commit 387f290cb34ad2d791ced01614ba7062cbcac879 Author: Per Liden <[EMAIL PROTECTED]> Date: Thu Feb 9 12:46:56 2006 +0100 [TIPC] reduce stack usage The node_map struct can be quite large (516 bytes) and allocating two of them on the stack is not a good idea since we might only have a 4K stack to start with. Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 8242fb4d3d516c4763b0861496e0e2b9bd89e37a Author: Adrian Bunk <[EMAIL PROTECTED]> Date: Tue Feb 7 10:53:21 2006 +0100 [2.6 patch] net/tipc/: possible cleanups This patch contains the following possible cleanups: - make needlessly global code static - #if 0 the following unused global functions: - name_table.c: tipc_nametbl_print() - name_table.c: tipc_nametbl_dump() - net.c: tipc_net_next_node() Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit d71b81ce24e05e3f5d10ad7ffc8f777ce23421f2 Author: Per Liden <[EMAIL PROTECTED]> Date: Fri Jan 20 15:02:21 2006 +0100 [TIPC] Remove unused functions Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 14bc3a94dccb30e61b93981b8897afcf46ebd0a9 Author: Sam Ravnborg <[EMAIL PROTECTED]> Date: Fri Jan 20 08:52:44 2006 +0100 [PATCH] tipc: remove inlines from *.c With reference to latest discussions on linux-kernel with respect to inline here is a patch for tipc to remove all inlines as used in the .c files. See also chapter 14 in Documentation/CodingStyle. Before: textdata bss dec hex filename 10299052921752 110034 1add2 tipc.o Now: textdata bss dec hex filename 10119052921752 108234 1a6ca tipc.o This is a nice text size reduction which will improve icache usage. In some cases bigger (> 4 lines) functions where declared inline and used in many places, they are most probarly no longer inlined by gcc resulting in the size reduction. There are several one liners that no longer are declared inline, but gcc should inline these just fine without the inline hint. With this patch applied one warning is added about an unused static function - that was hidded by utilising inline before. The function in question were kept so this patch is solely a inline removal patch. Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 81f71f5283f5c531a134cad0c272eb1492007cd4 Author: Sam Ravnborg <[EMAIL PROTECTED]> Date: Thu Jan 19 23:18:55 2006 +0100 [PATCH] tipc: fix simple sparse warnings Tried to run the new tipc stack through sparse. Following patch fixes all cases where 0 was used as replacement of NULL. Use NULL to document this is a pointer and to silence sparse. This brough sparse warning count down with 127 to 24 warnings. Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]> Signed-off-by: Per Liden <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6 patch] net/tipc/: possible cleanups
On Sat, 4 Feb 2006, Adrian Bunk wrote: > This patch contains the following possible cleanups: > - make needlessly global code static Good catch. > - #if 0 the following unused global functions: > - name_table.c: tipc_nametbl_print() > - name_table.c: tipc_nametbl_dump() > - net.c: tipc_net_next_node() Thanks! I'll apply this to my tree. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: RFC: tipc: remove inlines from *.c
On Fri, 20 Jan 2006, Sam Ravnborg wrote: > With reference to latest discussions on linux-kernel with respect to > inline here is a patch for tipc to remove all inlines as used in > the .c files. See also chapter 14 in Documentation/CodingStyle. > > Before: >text data bss dec hex filename > 102990 52921752 110034 1add2 tipc.o > > Now: >text data bss dec hex filename > 101190 52921752 108234 1a6ca tipc.o > > This is a nice text size reduction which will improve icache usage. > In some cases bigger (> 4 lines) functions where declared inline > and used in many places, they are most probarly no longer inlined by gcc > resulting in the size reduction. > There are several one liners that no longer are declared inline, but gcc > should inline these just fine without the inline hint. I've applied this in my tree as well. Initial tests show no problems. > With this patch applied one warning is added about an unused static > function - that was hidded by utilising inline before. > The function in question were kept so this patch is solely a > inline removal patch. I've removed those. Thanks Sam! /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: tipc: fix simple sparse warnings
On Thu, 19 Jan 2006, Sam Ravnborg wrote: > Tried to run the new tipc stack through sparse. > Following patch fixes all cases where 0 was used > as replacement of NULL. > Use NULL to document this is a pointer and to silence sparse. > > This brough sparse warning count down with 127 to 24 warnings. I've applied this to my tree. Thanks a lot Sam! /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: TIPC needs some cleanup
Hi Stephen, On Tue, 17 Jan 2006, Stephen Hemminger wrote: [...] > Also, let's work with the current code. It is a lot easier to let others > clean it up, if the changes are against the mainline (or -mm) rather than > having to send it off to get put into yet another git repo. To make sure we work with "current code" we try to keep our git repo in sync with David's net-2.6 tree all the time. Our intention is not to let our repo deviate away from that, but instead only contain our not yet pulled patches rebased on top of David's latest net-2.6 tree. If someone wants to do some work on TIPC, than doing that based on Linus' or David's tree should not be a problem. We do not intend to sit around for long periods with lots of additional patches in out repo, but instead ask David to pull as soon as we have something to share. If I've totally misunderstood your point, please feel free to correct my thinkos, but I don't really see how the way we work with our repo is different from how people work with people/xxx/zzz.git repos on kernel.org. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PATCHES] TIPC fixes
Dave, Here is a set of patches in response to the initial criticism/comments that TIPC received. The reason why these patches touch so many files is the fix to avoid namespace pullution. Please see diffstat and commit log below. Please pull from: git://tipc.cslab.ericsson.net/pub/git/tipc.git Thanks /Per MAINTAINERS |6 include/linux/if_ether.h|1 include/linux/tipc_config.h |7 net/Kconfig |2 net/tipc/Kconfig|7 net/tipc/addr.c | 10 - net/tipc/addr.h |4 net/tipc/bcast.c| 166 ++-- net/tipc/bcast.h| 44 ++- net/tipc/bearer.c | 189 +++-- net/tipc/bearer.h | 40 +-- net/tipc/cluster.c | 156 ++- net/tipc/cluster.h | 42 +-- net/tipc/config.c | 218 --- net/tipc/config.h | 43 +-- net/tipc/core.c | 87 +++--- net/tipc/core.h | 35 +- net/tipc/dbg.c | 112 net/tipc/dbg.h | 18 + net/tipc/discover.c | 52 ++-- net/tipc/discover.h | 18 + net/tipc/eth_media.c| 20 + net/tipc/handler.c |6 net/tipc/link.c | 605 +-- net/tipc/link.h | 73 +++-- net/tipc/msg.c | 19 - net/tipc/msg.h | 18 + net/tipc/name_distr.c | 92 +++ net/tipc/name_distr.h | 10 - net/tipc/name_table.c | 206 +++ net/tipc/name_table.h | 26 +- net/tipc/net.c | 126 - net/tipc/net.h | 20 + net/tipc/netlink.c | 16 + net/tipc/node.c | 215 --- net/tipc/node.h | 50 ++-- net/tipc/node_subscr.c | 20 + net/tipc/node_subscr.h |6 net/tipc/port.c | 274 ++- net/tipc/port.h | 60 ++-- net/tipc/ref.c | 72 +++-- net/tipc/ref.h | 38 +-- net/tipc/socket.c | 12 - net/tipc/subscr.c | 58 ++-- net/tipc/subscr.h | 26 +- net/tipc/user_reg.c | 22 +- net/tipc/user_reg.h |8 - net/tipc/zone.c | 40 +-- net/tipc/zone.h | 20 + 49 files changed, 1706 insertions(+), 1709 deletions(-) commit 4323add67792ced172d0d93b8b2e6187023115f1 Author: Per Liden <[EMAIL PROTECTED]> Date: Wed Jan 18 00:38:21 2006 +0100 [TIPC] Avoid polluting the global namespace This patch adds a tipc_ prefix to all externally visible symbols. Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 1e63e681e06d438fdc542d40924a4f155d461bbd Author: Per Liden <[EMAIL PROTECTED]> Date: Mon Jan 16 16:39:13 2006 +0100 [TIPC] Group protocols with sub-options in Kconfig This is just a cosmetic change that moves the TIPC configuration entry next to the other protocols that also have sub-options. Makes the the networking options menu look a bit better. Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit c11ac3f236d73dd00c21ab4f06166606dea71ef3 Author: Per Liden <[EMAIL PROTECTED]> Date: Mon Jan 16 16:32:18 2006 +0100 [TIPC] Add help text for TIPC configuration option Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 50f9bcddf8be147678c2d4ef8ac5279222d0ae3a Author: Per Liden <[EMAIL PROTECTED]> Date: Mon Jan 16 12:42:35 2006 +0100 [TIPC] Remove unused #includes Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 33a9c4da5ab16192ef1e961d4c4e45c18031cd67 Author: Per Liden <[EMAIL PROTECTED]> Date: Mon Jan 16 11:42:12 2006 +0100 [TIPC] Move ethernet protocol id to linux/if_ether.h Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 7c2b2aaee45c365596a83bcf8758b1f222e0eca4 Author: Per Liden <[EMAIL PROTECTED]> Date: Sat Jan 14 12:42:21 2006 +0100 [TIPC] Provide real email addresses in MAINTAINERS Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 16cb4b333c9e7a00ce3b1d74ec0c9b4c2e956910 Author: Per Liden <[EMAIL PROTECTED]> Date: Fri Jan 13 22:22:22 2006 +0100 [TIPC] Updated link priority macros Added macros for min/default/max link priority in tipc_config.h. Also renamed TIPC_NUM_LINK_PRI to TIPC_MEDIA_LINK_PRI since that is a more accurate description of what it is used for. Signed-off-by: Per Liden <[EMAIL PROTECTED]> commit 5f7c3ff6a2e227418d363069ff89cf9d7f01fbc1 Author: Jon Maloy <[EMAIL PROTECTED]> Date: Fri Jan 13 10:45:44 2006 + [TIPC] Minor changes to #includes Signed-off-by: Jon Maloy <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: TIPC needs some cleanup
On Tue, 17 Jan 2006, Stephen Hemminger wrote: > TIPC got added to 2.6.16-rc1, but needs some work. > > Look at some of the global symbols, from tipc.ko > Standard practice is to restrict the namespace of modules to a small > set of prefixes (like tipc_). Yep, we are aware of the problem as Jamal also pointed this out when he reviewed the code. I'm working on fixing this as we speak. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] genetlink: don't touch module ref count
On Fri, 13 Jan 2006, David S. Miller wrote: > From: Per Liden <[EMAIL PROTECTED]> > Date: Fri, 13 Jan 2006 21:56:53 +0100 (CET) > > > Signed-off-by: Per Liden <[EMAIL PROTECTED]> > > BTW, don't do this, it should be a perfectly functioning > email address so that people can contact you. Ok, sorry, I'll avoid that in the future. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] genetlink: don't touch module ref count
On Fri, 13 Jan 2006, David S. Miller wrote: > From: Jamal Hadi Salim <[EMAIL PROTECTED]> > Date: Fri, 13 Jan 2006 09:30:27 -0500 > > > On Fri, 2006-13-01 at 09:27 +0100, Per Liden wrote: > > > Increasing the module ref count at registration will block the module from > > > ever being unloaded. In fact, genetlink should not care about the owner at > > > all. This patch removes the owner field from the struct registered with > > > genetlink. > > > > > > Signed-off-by: Per Liden <[EMAIL PROTECTED]> > > > > Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]> > > > > BTW, thinking in the background we may in the future need the owner > > field for users of those modules (not for gennetlink to increment) but > > lets worry about that in the future. > > I don't have a copy of this patch in my inbox, can someone > resend it to me? Thanks. Resending. /Per [PATCH] genetlink: don't touch module ref count Increasing the module ref count at registration will block the module from ever being unloaded. In fact, genetlink should not care about the owner at all. This patch removes the owner field from the struct registered with genetlink. Signed-off-by: Per Liden <[EMAIL PROTECTED]> Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]> --- include/net/genetlink.h |1 - net/netlink/genetlink.c |7 --- net/tipc/netlink.c |1 - 3 files changed, 0 insertions(+), 9 deletions(-) 4647eec00ae3dc1be979f5387d766529cb64e29c diff --git a/include/net/genetlink.h b/include/net/genetlink.h index c5b96b2..805de50 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -22,7 +22,6 @@ struct genl_family charname[GENL_NAMSIZ]; unsigned intversion; unsigned intmaxattr; - struct module * owner; struct nlattr **attrbuf;/* private */ struct list_headops_list; /* private */ struct list_headfamily_list;/* private */ diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 3b13784..4ae1538 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -222,11 +222,6 @@ int genl_register_family(struct genl_fam goto errout_locked; } - if (!try_module_get(family->owner)) { - err = -EBUSY; - goto errout_locked; - } - if (family->id == GENL_ID_GENERATE) { u16 newid = genl_generate_id(); @@ -283,7 +278,6 @@ int genl_unregister_family(struct genl_f INIT_LIST_HEAD(&family->ops_list); genl_unlock(); - module_put(family->owner); kfree(family->attrbuf); genl_ctrl_event(CTRL_CMD_DELFAMILY, family); return 0; @@ -535,7 +529,6 @@ static struct genl_family genl_ctrl = { .name = "nlctrl", .version = 0x1, .maxattr = CTRL_ATTR_MAX, - .owner = THIS_MODULE, }; static int __init genl_init(void) diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 6fe95ac..19b3f40 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c @@ -72,7 +72,6 @@ static struct genl_family family = { .version = TIPC_GENL_VERSION, .hdrsize = TIPC_GENL_HDRLEN, .maxattr = 0, - .owner = THIS_MODULE, }; static struct genl_ops ops = { -- 1.0.GIT - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] genetlink: don't touch module ref count
Hi Thomas, On Fri, 13 Jan 2006, Thomas Graf wrote: > * Per Liden <[EMAIL PROTECTED]> 2006-01-13 09:27 > > Increasing the module ref count at registration will block the module from > > ever being unloaded. In fact, genetlink should not care about the owner at > > all. This patch removes the owner field from the struct registered with > > genetlink. > > Why shouldn't it care? When registering you hand over control of your > family and callback structures which may not be accessed after the > module has been unloaded. Right, but to make sure the structure isn't accessed after the module is unloaded all the module has to do is to unregister it when its exit function is called. If the module doesn't do that, then that's a bug in the module which should be fixed. The genl_sem semaphore makes sure the module can't unregister its structure when it's actually in use (i.e. when a genetlink command for that family is in progress). > If you want to have your module unloaded, unregister your family first. No, think about it. This is exactly where the "deadlock" happens. To unregister your family you need to get a call on your module's exit function. However, that exit function will _never_ be called by the kernel since it will simply not allow that when the modules ref count is > 0. Hence, you will never be able to unload that module ever again. /Per - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] genetlink: don't touch module ref count
Increasing the module ref count at registration will block the module from ever being unloaded. In fact, genetlink should not care about the owner at all. This patch removes the owner field from the struct registered with genetlink. Signed-off-by: Per Liden <[EMAIL PROTECTED]> --- include/net/genetlink.h |1 - net/netlink/genetlink.c |7 --- net/tipc/netlink.c |1 - 3 files changed, 0 insertions(+), 9 deletions(-) 4647eec00ae3dc1be979f5387d766529cb64e29c diff --git a/include/net/genetlink.h b/include/net/genetlink.h index c5b96b2..805de50 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -22,7 +22,6 @@ struct genl_family charname[GENL_NAMSIZ]; unsigned intversion; unsigned intmaxattr; - struct module * owner; struct nlattr **attrbuf;/* private */ struct list_headops_list; /* private */ struct list_headfamily_list;/* private */ diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 3b13784..4ae1538 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -222,11 +222,6 @@ int genl_register_family(struct genl_fam goto errout_locked; } - if (!try_module_get(family->owner)) { - err = -EBUSY; - goto errout_locked; - } - if (family->id == GENL_ID_GENERATE) { u16 newid = genl_generate_id(); @@ -283,7 +278,6 @@ int genl_unregister_family(struct genl_f INIT_LIST_HEAD(&family->ops_list); genl_unlock(); - module_put(family->owner); kfree(family->attrbuf); genl_ctrl_event(CTRL_CMD_DELFAMILY, family); return 0; @@ -535,7 +529,6 @@ static struct genl_family genl_ctrl = { .name = "nlctrl", .version = 0x1, .maxattr = CTRL_ATTR_MAX, - .owner = THIS_MODULE, }; static int __init genl_init(void) diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 6fe95ac..19b3f40 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c @@ -72,7 +72,6 @@ static struct genl_family family = { .version = TIPC_GENL_VERSION, .hdrsize = TIPC_GENL_HDRLEN, .maxattr = 0, - .owner = THIS_MODULE, }; static struct genl_ops ops = { -- 1.0.GIT - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html