netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	lksctp <linux-sctp@vger.kernel.org>
Subject: [PATCH net-next-2.6 7/8] sctp: Allow bindx_del to accept 0 port
Date: Tue, 19 Apr 2011 13:14:47 +0800	[thread overview]
Message-ID: <4DAD1A47.5080007@cn.fujitsu.com> (raw)
In-Reply-To: <4DAD18AB.3040401@cn.fujitsu.com>

From: Vlad Yasevich <vladislav.yasevich@hp.com>

We allow 0 port when adding new addresses.  It only
makes sence to allow 0 port when removing addresses.
When removing the currently bound port will be used
when the port in the address is set to 0.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 net/sctp/socket.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 5c9980a..431b890 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -658,11 +658,15 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
 			goto err_bindx_rem;
 		}
 
-		if (sa_addr->v4.sin_port != htons(bp->port)) {
+		if (sa_addr->v4.sin_port &&
+		    sa_addr->v4.sin_port != htons(bp->port)) {
 			retval = -EINVAL;
 			goto err_bindx_rem;
 		}
 
+		if (!sa_addr->v4.sin_port)
+			sa_addr->v4.sin_port = htons(bp->port);
+
 		/* FIXME - There is probably a need to check if sk->sk_saddr and
 		 * sk->sk_rcv_addr are currently set to one of the addresses to
 		 * be removed. This is something which needs to be looked into
-- 
1.6.5.2



  parent reply	other threads:[~2011-04-19  5:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-19  5:07 [PATCH net-next-2.6 0/8] sctp: some cleanup and tiny fix for add/del ip Wei Yongjun
2011-04-19  5:09 ` [PATCH net-next-2.6 1/8] sctp: delete unused macro definition of sctp_chunk_is_control Wei Yongjun
2011-04-19  5:19   ` [PATCH net-next-2.6 1/8 v2] " Wei Yongjun
2011-04-20  4:47     ` David Miller
2011-04-19  5:11 ` [PATCH net-next-2.6 2/8] sctp: fix the comment of sctp_sf_violation_paramlen() Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:11 ` [PATCH net-next-2.6 3/8] sctp: use common head of addr parameter to access member in addr-unrelated code Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:12 ` [PATCH net-next-2.6 4/8] sctp: kill abandoned SCTP_CMD_TRANSMIT command Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:13 ` [PATCH net-next-2.6 5/8] sctp: use memdup_user to copy data from userspace Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:13 ` [PATCH net-next-2.6 6/8] sctp: teach CACC algorithm about removed transports Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:14 ` Wei Yongjun [this message]
2011-04-20  4:47   ` [PATCH net-next-2.6 7/8] sctp: Allow bindx_del to accept 0 port David Miller
2011-04-19  5:15 ` [PATCH net-next-2.6 8/8] sctp: Release all routes when processing acks ADD_IP or DEL_IP Wei Yongjun
2011-04-20  4:47   ` David Miller
2011-04-19  5:31 ` [PATCH net-next-2.6 0/8] sctp: some cleanup and tiny fix for add/del ip Shan Wei
2011-04-19  8:10 ` Nicolas Dichtel
2011-04-19  8:18   ` Wei Yongjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DAD1A47.5080007@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).