* [PATCH] [SCTP]: Bug fixes
@ 2008-04-10 18:18 Vlad Yasevich
2008-04-10 18:18 ` [PATCH 1/5] [SCTP]: Add check for hmac_algo parameter in sctp_verify_param() Vlad Yasevich
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-10 18:18 UTC (permalink / raw)
To: davem; +Cc: lksctp-developers, linux-sctp, netdev
Hi David
Here is a set of SCTP bugfixes for net-2.6. Please apply.
Thanks
-vlad
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/5] [SCTP]: Add check for hmac_algo parameter in sctp_verify_param()
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
@ 2008-04-10 18:18 ` Vlad Yasevich
2008-04-10 18:18 ` [PATCH 2/5] [SCTP]: Fix protocol violation when receiving an error lenght INIT-ACK Vlad Yasevich
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-10 18:18 UTC (permalink / raw)
To: davem; +Cc: lksctp-developers, linux-sctp, netdev, Wei Yongjun, Vlad Yasevich
From: Wei Yongjun <yjwei@cn.fujitsu.com>
RFC 4890 has the following text:
The HMAC algorithm based on SHA-1 MUST be supported and
included in the HMAC-ALGO parameter.
As a result, we need to check in sctp_verify_param() that HMAC_SHA1 is
present in the list. If not, we should probably treat this as a
protocol violation.
It should also be a protocol violation if the HMAC parameter is empty.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
net/sctp/sm_make_chunk.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 578630e..36ebb39 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1982,7 +1982,10 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
struct sctp_chunk *chunk,
struct sctp_chunk **err_chunk)
{
+ struct sctp_hmac_algo_param *hmacs;
int retval = SCTP_IERROR_NO_ERROR;
+ __u16 n_elt, id = 0;
+ int i;
/* FIXME - This routine is not looking at each parameter per the
* chunk type, i.e., unrecognized parameters should be further
@@ -2056,9 +2059,29 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
break;
case SCTP_PARAM_HMAC_ALGO:
- if (sctp_auth_enable)
- break;
- /* Fall Through */
+ if (!sctp_auth_enable)
+ goto fallthrough;
+
+ hmacs = (struct sctp_hmac_algo_param *)param.p;
+ n_elt = (ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) >> 1;
+
+ /* SCTP-AUTH: Section 6.1
+ * The HMAC algorithm based on SHA-1 MUST be supported and
+ * included in the HMAC-ALGO parameter.
+ */
+ for (i = 0; i < n_elt; i++) {
+ id = ntohs(hmacs->hmac_ids[i]);
+
+ if (id == SCTP_AUTH_HMAC_ID_SHA1)
+ break;
+ }
+
+ if (id != SCTP_AUTH_HMAC_ID_SHA1) {
+ sctp_process_inv_paramlength(asoc, param.p, chunk,
+ err_chunk);
+ retval = SCTP_IERROR_ABORT;
+ }
+ break;
fallthrough:
default:
SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n",
--
1.5.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] [SCTP]: Fix protocol violation when receiving an error lenght INIT-ACK
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
2008-04-10 18:18 ` [PATCH 1/5] [SCTP]: Add check for hmac_algo parameter in sctp_verify_param() Vlad Yasevich
@ 2008-04-10 18:18 ` Vlad Yasevich
2008-04-10 18:18 ` [PATCH 3/5] [SCTP]: Fix compiler warning about const qualifiers Vlad Yasevich
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-10 18:18 UTC (permalink / raw)
To: davem; +Cc: lksctp-developers, linux-sctp, netdev, Gui Jianfeng,
Vlad Yasevich
From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
When receiving an error length INIT-ACK during COOKIE-WAIT,
a 0-vtag ABORT will be responsed. This action violates the
protocol apparently. This patch achieves the following things.
1 If the INIT-ACK contains all the fixed parameters, use init-tag
recorded from INIT-ACK as vtag.
2 If the INIT-ACK doesn't contain all the fixed parameters,
just reflect its vtag.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
include/net/sctp/command.h | 1 +
net/sctp/outqueue.c | 3 +++
net/sctp/sm_sideeffect.c | 3 +++
net/sctp/sm_statefuns.c | 18 ++++++++++++++++++
4 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 10ae2da..35b1e83 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -104,6 +104,7 @@ typedef enum {
SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
+ SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
SCTP_CMD_LAST
} sctp_verb_t;
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 1bb3c5c..c071446 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -793,6 +793,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
break;
case SCTP_CID_ABORT:
+ if (sctp_test_T_bit(chunk)) {
+ packet->vtag = asoc->c.my_vtag;
+ }
case SCTP_CID_SACK:
case SCTP_CID_HEARTBEAT:
case SCTP_CID_HEARTBEAT_ACK:
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 28eb38e..a4763fd 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1536,6 +1536,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
error = sctp_auth_asoc_init_active_key(asoc,
GFP_ATOMIC);
break;
+ case SCTP_CMD_UPDATE_INITTAG:
+ asoc->peer.i.init_tag = cmd->obj.u32;
+ break;
default:
printk(KERN_WARNING "Impossible command: %u, %p\n",
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f2ed647..3ef9749 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4144,6 +4144,24 @@ static sctp_disposition_t sctp_sf_abort_violation(
goto nomem;
if (asoc) {
+ /* Treat INIT-ACK as a special case during COOKIE-WAIT. */
+ if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK &&
+ !asoc->peer.i.init_tag) {
+ sctp_initack_chunk_t *initack;
+
+ initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
+ if (!sctp_chunk_length_valid(chunk,
+ sizeof(sctp_initack_chunk_t)))
+ abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T;
+ else {
+ unsigned int inittag;
+
+ inittag = ntohl(initack->init_hdr.init_tag);
+ sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_INITTAG,
+ SCTP_U32(inittag));
+ }
+ }
+
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
--
1.5.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] [SCTP]: Fix compiler warning about const qualifiers
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
2008-04-10 18:18 ` [PATCH 1/5] [SCTP]: Add check for hmac_algo parameter in sctp_verify_param() Vlad Yasevich
2008-04-10 18:18 ` [PATCH 2/5] [SCTP]: Fix protocol violation when receiving an error lenght INIT-ACK Vlad Yasevich
@ 2008-04-10 18:18 ` Vlad Yasevich
2008-04-10 18:18 ` [PATCH 4/5] [SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event Vlad Yasevich
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-10 18:18 UTC (permalink / raw)
To: davem; +Cc: lksctp-developers, linux-sctp, netdev, Vlad Yasevich
Fix 3 warnings about discarding const qualifiers:
net/sctp/ulpevent.c:862: warning: passing argument 1 of 'sctp_event2skb' discards qualifiers from pointer target type
net/sctp/sm_statefuns.c:4393: warning: passing argument 1 of 'SCTP_ASOC' discards qualifiers from pointer target type
net/sctp/socket.c:5874: warning: passing argument 1 of 'cmsg_nxthdr' discards qualifiers from pointer target type
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
include/net/sctp/ulpevent.h | 2 +-
net/sctp/sm_statefuns.c | 5 +++--
net/sctp/socket.c | 5 +++--
net/sctp/ulpevent.c | 2 +-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 9bcfc12..7ea12e8 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -67,7 +67,7 @@ struct sctp_ulpevent {
};
/* Retrieve the skb this event sits inside of. */
-static inline struct sk_buff *sctp_event2skb(struct sctp_ulpevent *ev)
+static inline struct sk_buff *sctp_event2skb(const struct sctp_ulpevent *ev)
{
return container_of((void *)ev, struct sk_buff, cb);
}
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 3ef9749..07194c2 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4367,6 +4367,7 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *repl;
+ struct sctp_association* my_asoc;
/* The comment below says that we enter COOKIE-WAIT AFTER
* sending the INIT, but that doesn't actually work in our
@@ -4390,8 +4391,8 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
/* Cast away the const modifier, as we want to just
* rerun it through as a sideffect.
*/
- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC,
- SCTP_ASOC((struct sctp_association *) asoc));
+ my_asoc = (struct sctp_association *)asoc;
+ sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(my_asoc));
/* Choose transport for INIT. */
sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT,
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d994d82..998e63a 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5868,11 +5868,12 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *msg,
sctp_cmsgs_t *cmsgs)
{
struct cmsghdr *cmsg;
+ struct msghdr *my_msg = (struct msghdr *)msg;
for (cmsg = CMSG_FIRSTHDR(msg);
cmsg != NULL;
- cmsg = CMSG_NXTHDR((struct msghdr*)msg, cmsg)) {
- if (!CMSG_OK(msg, cmsg))
+ cmsg = CMSG_NXTHDR(my_msg, cmsg)) {
+ if (!CMSG_OK(my_msg, cmsg))
return -EINVAL;
/* Should we parse this header or ignore? */
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index b43f1f1..ce6cda6 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -859,7 +859,7 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
union sctp_notification *notification;
struct sk_buff *skb;
- skb = sctp_event2skb((struct sctp_ulpevent *)event);
+ skb = sctp_event2skb(event);
notification = (union sctp_notification *) skb->data;
return notification->sn_header.sn_type;
}
--
1.5.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] [SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event.
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
` (2 preceding siblings ...)
2008-04-10 18:18 ` [PATCH 3/5] [SCTP]: Fix compiler warning about const qualifiers Vlad Yasevich
@ 2008-04-10 18:18 ` Vlad Yasevich
2008-04-10 22:31 ` [PATCH] [SCTP]: Bug fixes David Miller
2008-04-13 1:41 ` David Miller
5 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-10 18:18 UTC (permalink / raw)
To: davem; +Cc: lksctp-developers, linux-sctp, netdev, Pavel Emelyanov,
Vlad Yasevich
From: Pavel Emelyanov <xemul@openvz.org>
All IP addresses that are present in a system are duplicated on
struct sctp_sockaddr_entry. They are linked in the global list
called sctp_local_addr_list. And this struct unions IPv4 and IPv6
addresses.
So, there can be rare case, when a sockaddr_in.sin_addr coincides
with the corresponding part of the sockaddr_in6 and the notifier
for IPv4 will carry away an IPv6 entry.
The fix is to check the family before comparing the addresses.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
net/sctp/ipv6.c | 5 +++--
net/sctp/protocol.c | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index b1e05d7..85f1495 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -110,8 +110,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
spin_lock_bh(&sctp_local_addr_lock);
list_for_each_entry_safe(addr, temp,
&sctp_local_addr_list, list) {
- if (ipv6_addr_equal(&addr->a.v6.sin6_addr,
- &ifa->addr)) {
+ if (addr->a.sa.sa_family == AF_INET6 &&
+ ipv6_addr_equal(&addr->a.v6.sin6_addr,
+ &ifa->addr)) {
found = 1;
addr->valid = 0;
list_del_rcu(&addr->list);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f90091a..c2dd65d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -647,7 +647,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
spin_lock_bh(&sctp_local_addr_lock);
list_for_each_entry_safe(addr, temp,
&sctp_local_addr_list, list) {
- if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) {
+ if (addr->a.sa.sa_family == AF_INET &&
+ addr->a.v4.sin_addr.s_addr ==
+ ifa->ifa_local) {
found = 1;
addr->valid = 0;
list_del_rcu(&addr->list);
--
1.5.3.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] [SCTP]: Bug fixes
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
` (3 preceding siblings ...)
2008-04-10 18:18 ` [PATCH 4/5] [SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event Vlad Yasevich
@ 2008-04-10 22:31 ` David Miller
2008-04-11 12:38 ` Vlad Yasevich
2008-04-13 1:41 ` David Miller
5 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2008-04-10 22:31 UTC (permalink / raw)
To: vladislav.yasevich; +Cc: lksctp-developers, linux-sctp, netdev
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Thu, 10 Apr 2008 14:18:29 -0400
> Here is a set of SCTP bugfixes for net-2.6. Please apply.
I don't have patch 5/5 in my inbox, any ideas?
Or were there really only 4 patches?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [SCTP]: Bug fixes
2008-04-10 22:31 ` [PATCH] [SCTP]: Bug fixes David Miller
@ 2008-04-11 12:38 ` Vlad Yasevich
0 siblings, 0 replies; 8+ messages in thread
From: Vlad Yasevich @ 2008-04-11 12:38 UTC (permalink / raw)
To: David Miller; +Cc: lksctp-developers, linux-sctp, netdev
David Miller wrote:
> From: Vlad Yasevich <vladislav.yasevich@hp.com>
> Date: Thu, 10 Apr 2008 14:18:29 -0400
>
>> Here is a set of SCTP bugfixes for net-2.6. Please apply.
>
> I don't have patch 5/5 in my inbox, any ideas?
> Or were there really only 4 patches?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
There are only 4. There used to be 5, but one moved to the 2.6.26
set.
Sorry.
-vlad
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [SCTP]: Bug fixes
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
` (4 preceding siblings ...)
2008-04-10 22:31 ` [PATCH] [SCTP]: Bug fixes David Miller
@ 2008-04-13 1:41 ` David Miller
5 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2008-04-13 1:41 UTC (permalink / raw)
To: vladislav.yasevich; +Cc: lksctp-developers, linux-sctp, netdev
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Thu, 10 Apr 2008 14:18:29 -0400
> Here is a set of SCTP bugfixes for net-2.6. Please apply.
All applied, thanks Vlad.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-04-13 1:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 18:18 [PATCH] [SCTP]: Bug fixes Vlad Yasevich
2008-04-10 18:18 ` [PATCH 1/5] [SCTP]: Add check for hmac_algo parameter in sctp_verify_param() Vlad Yasevich
2008-04-10 18:18 ` [PATCH 2/5] [SCTP]: Fix protocol violation when receiving an error lenght INIT-ACK Vlad Yasevich
2008-04-10 18:18 ` [PATCH 3/5] [SCTP]: Fix compiler warning about const qualifiers Vlad Yasevich
2008-04-10 18:18 ` [PATCH 4/5] [SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event Vlad Yasevich
2008-04-10 22:31 ` [PATCH] [SCTP]: Bug fixes David Miller
2008-04-11 12:38 ` Vlad Yasevich
2008-04-13 1:41 ` David Miller
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).