* [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6
@ 2011-04-26 3:44 Wei Yongjun
2011-04-26 3:45 ` [PATCH net-next-2.6 1/7] sctp: fix sctp to work with ipv6 source address routing Wei Yongjun
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:44 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
Hi David
Here is a set of SCTP patches for net-next-2.6, the last part
from vlad's lksctp-dev tree, update SCTP IPv6 routing and IPSec
issues. Please apply.
Vlad Yasevich (4):
sctp: cache the ipv6 source after route lookup
sctp: make sctp over IPv6 work with IPsec
sctp: remove useless arguments from get_saddr() call
sctp: clean up route lookup calls
Wei Yongjun (2):
sctp: clean up IPv6 route and XFRM lookups
sctp: fix IPv6 source address output routing with IPsec
Weixing Shi (1):
sctp: fix sctp to work with ipv6 source address routing
include/net/sctp/structs.h | 17 ++--
net/sctp/ipv6.c | 186 ++++++++++++++++++++++++++-----------------
net/sctp/protocol.c | 57 ++++++-------
net/sctp/socket.c | 2 +-
net/sctp/transport.c | 28 ++++---
5 files changed, 162 insertions(+), 128 deletions(-)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 1/7] sctp: fix sctp to work with ipv6 source address routing
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
@ 2011-04-26 3:45 ` Wei Yongjun
2011-04-26 3:46 ` [PATCH net-next-2.6 2/7] sctp: cache the ipv6 source after route lookup Wei Yongjun
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
From: Weixing Shi <Weixing.Shi@windriver.com>
in the below test case, using the source address routing,
sctp can not work.
Node-A
1)ifconfig eth0 inet6 add 2001:1::1/64
2)ip -6 rule add from 2001:1::1 table 100 pref 100
3)ip -6 route add 2001:2::1 dev eth0 table 100
4)sctp_darn -H 2001:1::1 -P 250 -l &
Node-B
1)ifconfig eth0 inet6 add 2001:2::1/64
2)ip -6 rule add from 2001:2::1 table 100 pref 100
3)ip -6 route add 2001:1::1 dev eth0 table 100
4)sctp_darn -H 2001:2::1 -P 250 -h 2001:1::1 -p 250 -s
root cause:
Node-A and Node-B use the source address routing, and
at begining, source address will be NULL,sctp will
search the routing table by the destination address,
because using the source address routing table, and
the result dst_entry will be NULL.
solution:
walk through the bind address list to get the source
address and then lookup the routing table again to get
the correct dst_entry.
Signed-off-by: Weixing Shi <Weixing.Shi@windriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/ipv6.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 321f175..5adf585 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -80,6 +80,9 @@
#include <asm/uaccess.h>
+static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
+ union sctp_addr *s2);
+
/* Event handler for inet6 address addition/deletion events.
* The sctp_local_addr_list needs to be protocted by a spin lock since
* multiple notifiers (say IPv4 and IPv6) may be running at the same
@@ -244,8 +247,14 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
union sctp_addr *daddr,
union sctp_addr *saddr)
{
- struct dst_entry *dst;
+ struct dst_entry *dst = NULL;
struct flowi6 fl6;
+ struct sctp_bind_addr *bp;
+ struct sctp_sockaddr_entry *laddr;
+ union sctp_addr *baddr = NULL;
+ __u8 matchlen = 0;
+ __u8 bmatchlen;
+ sctp_scope_t scope;
memset(&fl6, 0, sizeof(fl6));
ipv6_addr_copy(&fl6.daddr, &daddr->v6.sin6_addr);
@@ -261,6 +270,39 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
}
dst = ip6_route_output(&init_net, NULL, &fl6);
+ if (!asoc || saddr)
+ goto out;
+
+ if (dst->error) {
+ dst_release(dst);
+ dst = NULL;
+ bp = &asoc->base.bind_addr;
+ scope = sctp_scope(daddr);
+ /* Walk through the bind address list and try to get a dst that
+ * matches a bind address as the source address.
+ */
+ rcu_read_lock();
+ list_for_each_entry_rcu(laddr, &bp->address_list, list) {
+ if (!laddr->valid)
+ continue;
+ if ((laddr->state == SCTP_ADDR_SRC) &&
+ (laddr->a.sa.sa_family == AF_INET6) &&
+ (scope <= sctp_scope(&laddr->a))) {
+ bmatchlen = sctp_v6_addr_match_len(daddr,
+ &laddr->a);
+ if (!baddr || (matchlen < bmatchlen)) {
+ baddr = &laddr->a;
+ matchlen = bmatchlen;
+ }
+ }
+ }
+ rcu_read_unlock();
+ if (baddr) {
+ ipv6_addr_copy(&fl6.saddr, &baddr->v6.sin6_addr);
+ dst = ip6_route_output(&init_net, NULL, &fl6);
+ }
+ }
+out:
if (!dst->error) {
struct rt6_info *rt;
rt = (struct rt6_info *)dst;
@@ -269,7 +311,8 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
return dst;
}
SCTP_DEBUG_PRINTK("NO ROUTE\n");
- dst_release(dst);
+ if (dst)
+ dst_release(dst);
return NULL;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 2/7] sctp: cache the ipv6 source after route lookup
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
2011-04-26 3:45 ` [PATCH net-next-2.6 1/7] sctp: fix sctp to work with ipv6 source address routing Wei Yongjun
@ 2011-04-26 3:46 ` Wei Yongjun
2011-04-26 3:47 ` [PATCH net-next-2.6 3/7] sctp: make sctp over IPv6 work with IPsec Wei Yongjun
` (5 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
From: Vlad Yasevich <vladislav.yasevich@hp.com>
The ipv6 routing lookup does give us a source address,
but instead of filling it into the dst, it's stored in
the flowi. We can use that instead of going through the
entire source address selection again. Now we pass
the flowi around to get at the source for ipv6, but let
ipv4 still deal with dst.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
include/net/sctp/structs.h | 13 ++--
net/sctp/ipv6.c | 163 +++++++++++++++++++++-----------------------
net/sctp/protocol.c | 50 +++++++-------
net/sctp/socket.c | 2 +-
net/sctp/transport.c | 15 +++--
5 files changed, 119 insertions(+), 124 deletions(-)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5c9bada..a98d36f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -566,16 +566,17 @@ struct sctp_af {
int __user *optlen);
struct dst_entry *(*get_dst) (struct sctp_association *asoc,
union sctp_addr *daddr,
- union sctp_addr *saddr);
+ union sctp_addr *saddr,
+ struct flowi *fl,
+ struct sock *sk);
void (*get_saddr) (struct sctp_sock *sk,
- struct sctp_association *asoc,
- struct dst_entry *dst,
+ struct sctp_transport *t,
union sctp_addr *daddr,
- union sctp_addr *saddr);
+ struct flowi *fl);
void (*copy_addrlist) (struct list_head *,
struct net_device *);
void (*dst_saddr) (union sctp_addr *saddr,
- struct dst_entry *dst,
+ void *from,
__be16 port);
int (*cmp_addr) (const union sctp_addr *addr1,
const union sctp_addr *addr2);
@@ -1061,7 +1062,7 @@ void sctp_transport_set_owner(struct sctp_transport *,
struct sctp_association *);
void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
struct sctp_sock *);
-void sctp_transport_pmtu(struct sctp_transport *);
+void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk);
void sctp_transport_free(struct sctp_transport *);
void sctp_transport_reset_timers(struct sctp_transport *);
void sctp_transport_hold(struct sctp_transport *);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 5adf585..cc9ea37 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -82,6 +82,10 @@
static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
union sctp_addr *s2);
+static void sctp_v6_dst_saddr(union sctp_addr *addr, void *from,
+ __be16 port);
+static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
+ const union sctp_addr *addr2);
/* Event handler for inet6 address addition/deletion events.
* The sctp_local_addr_list needs to be protocted by a spin lock since
@@ -245,69 +249,97 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
*/
static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
union sctp_addr *daddr,
- union sctp_addr *saddr)
+ union sctp_addr *saddr,
+ struct flowi *fl,
+ struct sock *sk)
{
struct dst_entry *dst = NULL;
- struct flowi6 fl6;
+ struct flowi6 *fl6 = &fl->u.ip6;
struct sctp_bind_addr *bp;
struct sctp_sockaddr_entry *laddr;
union sctp_addr *baddr = NULL;
+ union sctp_addr dst_saddr;
__u8 matchlen = 0;
__u8 bmatchlen;
sctp_scope_t scope;
+ int err = 0;
- memset(&fl6, 0, sizeof(fl6));
- ipv6_addr_copy(&fl6.daddr, &daddr->v6.sin6_addr);
+ memset(fl6, 0, sizeof(struct flowi6));
+ ipv6_addr_copy(&fl6->daddr, &daddr->v6.sin6_addr);
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
- fl6.flowi6_oif = daddr->v6.sin6_scope_id;
+ fl6->flowi6_oif = daddr->v6.sin6_scope_id;
- SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl6.daddr);
+ SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl6->daddr);
if (saddr) {
- ipv6_addr_copy(&fl6.saddr, &saddr->v6.sin6_addr);
- SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl6.saddr);
+ ipv6_addr_copy(&fl6->saddr, &saddr->v6.sin6_addr);
+ SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl6->saddr);
}
- dst = ip6_route_output(&init_net, NULL, &fl6);
+ err = ip6_dst_lookup(sk, &dst, fl6);
if (!asoc || saddr)
goto out;
- if (dst->error) {
- dst_release(dst);
- dst = NULL;
- bp = &asoc->base.bind_addr;
- scope = sctp_scope(daddr);
- /* Walk through the bind address list and try to get a dst that
- * matches a bind address as the source address.
+ bp = &asoc->base.bind_addr;
+ scope = sctp_scope(daddr);
+ /* ip6_dst_lookup has filled in the fl6->saddr for us. Check
+ * to see if we can use it.
+ */
+ if (!err) {
+ /* Walk through the bind address list and look for a bind
+ * address that matches the source address of the returned dst.
*/
+ sctp_v6_dst_saddr(&dst_saddr, fl6, htons(bp->port));
rcu_read_lock();
list_for_each_entry_rcu(laddr, &bp->address_list, list) {
- if (!laddr->valid)
+ if (!laddr->valid || (laddr->state != SCTP_ADDR_SRC))
continue;
- if ((laddr->state == SCTP_ADDR_SRC) &&
- (laddr->a.sa.sa_family == AF_INET6) &&
- (scope <= sctp_scope(&laddr->a))) {
- bmatchlen = sctp_v6_addr_match_len(daddr,
- &laddr->a);
- if (!baddr || (matchlen < bmatchlen)) {
- baddr = &laddr->a;
- matchlen = bmatchlen;
- }
+
+ /* Do not compare against v4 addrs */
+ if ((laddr->a.sa.sa_family == AF_INET6) &&
+ (sctp_v6_cmp_addr(&dst_saddr, &laddr->a))) {
+ rcu_read_unlock();
+ goto out;
}
}
rcu_read_unlock();
- if (baddr) {
- ipv6_addr_copy(&fl6.saddr, &baddr->v6.sin6_addr);
- dst = ip6_route_output(&init_net, NULL, &fl6);
+ /* None of the bound addresses match the source address of the
+ * dst. So release it.
+ */
+ dst_release(dst);
+ dst = NULL;
+ }
+
+ /* Walk through the bind address list and try to get the
+ * best source address for a given destination.
+ */
+ rcu_read_lock();
+ list_for_each_entry_rcu(laddr, &bp->address_list, list) {
+ if (!laddr->valid)
+ continue;
+ if ((laddr->state == SCTP_ADDR_SRC) &&
+ (laddr->a.sa.sa_family == AF_INET6) &&
+ (scope <= sctp_scope(&laddr->a))) {
+ bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
+ if (!baddr || (matchlen < bmatchlen)) {
+ baddr = &laddr->a;
+ matchlen = bmatchlen;
+ }
}
}
+ rcu_read_unlock();
+ if (baddr) {
+ ipv6_addr_copy(&fl6->saddr, &baddr->v6.sin6_addr);
+ err = ip6_dst_lookup(sk, &dst, fl6);
+ }
+
out:
- if (!dst->error) {
+ if (dst) {
struct rt6_info *rt;
rt = (struct rt6_info *)dst;
SCTP_DEBUG_PRINTK("rt6_dst:%pI6 rt6_src:%pI6\n",
- &rt->rt6i_dst.addr, &rt->rt6i_src.addr);
+ &rt->rt6i_dst.addr, &fl6->saddr);
return dst;
}
SCTP_DEBUG_PRINTK("NO ROUTE\n");
@@ -329,64 +361,21 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
* and asoc's bind address list.
*/
static void sctp_v6_get_saddr(struct sctp_sock *sk,
- struct sctp_association *asoc,
- struct dst_entry *dst,
+ struct sctp_transport *t,
union sctp_addr *daddr,
- union sctp_addr *saddr)
+ struct flowi *fl)
{
- struct sctp_bind_addr *bp;
- struct sctp_sockaddr_entry *laddr;
- sctp_scope_t scope;
- union sctp_addr *baddr = NULL;
- __u8 matchlen = 0;
- __u8 bmatchlen;
+ struct flowi6 *fl6 = &fl->u.ip6;
+ union sctp_addr *saddr = &t->saddr;
SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p daddr:%pI6 ",
- __func__, asoc, dst, &daddr->v6.sin6_addr);
-
- if (!asoc) {
- ipv6_dev_get_saddr(sock_net(sctp_opt2sk(sk)),
- dst ? ip6_dst_idev(dst)->dev : NULL,
- &daddr->v6.sin6_addr,
- inet6_sk(&sk->inet.sk)->srcprefs,
- &saddr->v6.sin6_addr);
- SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
- &saddr->v6.sin6_addr);
- return;
- }
+ __func__, t->asoc, t->dst, &daddr->v6.sin6_addr);
- scope = sctp_scope(daddr);
-
- bp = &asoc->base.bind_addr;
-
- /* Go through the bind address list and find the best source address
- * that matches the scope of the destination address.
- */
- rcu_read_lock();
- list_for_each_entry_rcu(laddr, &bp->address_list, list) {
- if (!laddr->valid)
- continue;
- if ((laddr->state == SCTP_ADDR_SRC) &&
- (laddr->a.sa.sa_family == AF_INET6) &&
- (scope <= sctp_scope(&laddr->a))) {
- bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
- if (!baddr || (matchlen < bmatchlen)) {
- baddr = &laddr->a;
- matchlen = bmatchlen;
- }
- }
- }
- if (baddr) {
- memcpy(saddr, baddr, sizeof(union sctp_addr));
- SCTP_DEBUG_PRINTK("saddr: %pI6\n", &saddr->v6.sin6_addr);
- } else {
- pr_err("%s: asoc:%p Could not find a valid source "
- "address for the dest:%pI6\n",
- __func__, asoc, &daddr->v6.sin6_addr);
+ if (t->dst) {
+ saddr->v6.sin6_family = AF_INET6;
+ ipv6_addr_copy(&saddr->v6.sin6_addr, &fl6->saddr);
}
-
- rcu_read_unlock();
}
/* Make a copy of all potential local addresses. */
@@ -508,14 +497,16 @@ static int sctp_v6_to_addr_param(const union sctp_addr *addr,
return length;
}
-/* Initialize a sctp_addr from a dst_entry. */
-static void sctp_v6_dst_saddr(union sctp_addr *addr, struct dst_entry *dst,
+/* Initialize a sctp_addr from a dst_entry. Problem is that v6 dst
+ * entries do not carry the source, so we pass a flowi instead.
+ */
+static void sctp_v6_dst_saddr(union sctp_addr *addr, void *from,
__be16 port)
{
- struct rt6_info *rt = (struct rt6_info *)dst;
+ struct flowi6 *fl6 = (struct flowi6 *)from;
addr->sa.sa_family = AF_INET6;
addr->v6.sin6_port = port;
- ipv6_addr_copy(&addr->v6.sin6_addr, &rt->rt6i_src.addr);
+ ipv6_addr_copy(&addr->v6.sin6_addr, &fl6->saddr);
}
/* Compare addresses exactly.
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d5bf91d..7be5df6 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -339,10 +339,10 @@ static int sctp_v4_to_addr_param(const union sctp_addr *addr,
}
/* Initialize a sctp_addr from a dst_entry. */
-static void sctp_v4_dst_saddr(union sctp_addr *saddr, struct dst_entry *dst,
+static void sctp_v4_dst_saddr(union sctp_addr *saddr, void *from,
__be16 port)
{
- struct rtable *rt = (struct rtable *)dst;
+ struct rtable *rt = (struct rtable *)from;
saddr->v4.sin_family = AF_INET;
saddr->v4.sin_port = port;
saddr->v4.sin_addr.s_addr = rt->rt_src;
@@ -465,33 +465,35 @@ static sctp_scope_t sctp_v4_scope(union sctp_addr *addr)
*/
static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
union sctp_addr *daddr,
- union sctp_addr *saddr)
+ union sctp_addr *saddr,
+ struct flowi *fl,
+ struct sock *sk)
{
struct rtable *rt;
- struct flowi4 fl4;
+ struct flowi4 *fl4 = &fl->u.ip4;
struct sctp_bind_addr *bp;
struct sctp_sockaddr_entry *laddr;
struct dst_entry *dst = NULL;
union sctp_addr dst_saddr;
- memset(&fl4, 0x0, sizeof(struct flowi4));
- fl4.daddr = daddr->v4.sin_addr.s_addr;
- fl4.fl4_dport = daddr->v4.sin_port;
- fl4.flowi4_proto = IPPROTO_SCTP;
+ memset(fl4, 0x0, sizeof(struct flowi4));
+ fl4->daddr = daddr->v4.sin_addr.s_addr;
+ fl4->fl4_dport = daddr->v4.sin_port;
+ fl4->flowi4_proto = IPPROTO_SCTP;
if (asoc) {
- fl4.flowi4_tos = RT_CONN_FLAGS(asoc->base.sk);
- fl4.flowi4_oif = asoc->base.sk->sk_bound_dev_if;
- fl4.fl4_sport = htons(asoc->base.bind_addr.port);
+ fl4->flowi4_tos = RT_CONN_FLAGS(asoc->base.sk);
+ fl4->flowi4_oif = asoc->base.sk->sk_bound_dev_if;
+ fl4->fl4_sport = htons(asoc->base.bind_addr.port);
}
if (saddr) {
- fl4.saddr = saddr->v4.sin_addr.s_addr;
- fl4.fl4_sport = saddr->v4.sin_port;
+ fl4->saddr = saddr->v4.sin_addr.s_addr;
+ fl4->fl4_sport = saddr->v4.sin_port;
}
SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ",
- __func__, &fl4.daddr, &fl4.saddr);
+ __func__, &fl4->daddr, &fl4->saddr);
- rt = ip_route_output_key(&init_net, &fl4);
+ rt = ip_route_output_key(&init_net, fl4);
if (!IS_ERR(rt))
dst = &rt->dst;
@@ -533,9 +535,9 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
continue;
if ((laddr->state == SCTP_ADDR_SRC) &&
(AF_INET == laddr->a.sa.sa_family)) {
- fl4.saddr = laddr->a.v4.sin_addr.s_addr;
- fl4.fl4_sport = laddr->a.v4.sin_port;
- rt = ip_route_output_key(&init_net, &fl4);
+ fl4->saddr = laddr->a.v4.sin_addr.s_addr;
+ fl4->fl4_sport = laddr->a.v4.sin_port;
+ rt = ip_route_output_key(&init_net, fl4);
if (!IS_ERR(rt)) {
dst = &rt->dst;
goto out_unlock;
@@ -559,19 +561,15 @@ out:
* to cache it separately and hence this is an empty routine.
*/
static void sctp_v4_get_saddr(struct sctp_sock *sk,
- struct sctp_association *asoc,
- struct dst_entry *dst,
+ struct sctp_transport *t,
union sctp_addr *daddr,
- union sctp_addr *saddr)
+ struct flowi *fl)
{
- struct rtable *rt = (struct rtable *)dst;
-
- if (!asoc)
- return;
+ union sctp_addr *saddr = &t->saddr;
+ struct rtable *rt = (struct rtable *)t->dst;
if (rt) {
saddr->v4.sin_family = AF_INET;
- saddr->v4.sin_port = htons(asoc->base.bind_addr.port);
saddr->v4.sin_addr.s_addr = rt->rt_src;
}
}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index f694ee1..33d9ee6 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2287,7 +2287,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
trans->param_flags =
(trans->param_flags & ~SPP_PMTUD) | pmtud_change;
if (update) {
- sctp_transport_pmtu(trans);
+ sctp_transport_pmtu(trans, sctp_opt2sk(sp));
sctp_assoc_sync_pmtu(asoc);
}
} else if (asoc) {
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index d3ae493..2544b9b 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -211,11 +211,15 @@ void sctp_transport_set_owner(struct sctp_transport *transport,
}
/* Initialize the pmtu of a transport. */
-void sctp_transport_pmtu(struct sctp_transport *transport)
+void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
{
struct dst_entry *dst;
+ struct flowi fl;
- dst = transport->af_specific->get_dst(NULL, &transport->ipaddr, NULL);
+ dst = transport->af_specific->get_dst(transport->asoc,
+ &transport->ipaddr,
+ &transport->saddr,
+ &fl, sk);
if (dst) {
transport->pathmtu = dst_mtu(dst);
@@ -272,15 +276,16 @@ void sctp_transport_route(struct sctp_transport *transport,
struct sctp_af *af = transport->af_specific;
union sctp_addr *daddr = &transport->ipaddr;
struct dst_entry *dst;
+ struct flowi fl;
- dst = af->get_dst(asoc, daddr, saddr);
+ dst = af->get_dst(asoc, daddr, saddr, &fl, sctp_opt2sk(opt));
+ transport->dst = dst;
if (saddr)
memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
else
- af->get_saddr(opt, asoc, dst, daddr, &transport->saddr);
+ af->get_saddr(opt, transport, daddr, &fl);
- transport->dst = dst;
if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
return;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 3/7] sctp: make sctp over IPv6 work with IPsec
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
2011-04-26 3:45 ` [PATCH net-next-2.6 1/7] sctp: fix sctp to work with ipv6 source address routing Wei Yongjun
2011-04-26 3:46 ` [PATCH net-next-2.6 2/7] sctp: cache the ipv6 source after route lookup Wei Yongjun
@ 2011-04-26 3:47 ` Wei Yongjun
2011-04-26 3:47 ` [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call Wei Yongjun
` (4 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
From: Vlad Yasevich <vladislav.yasevich@hp.com>
SCTP never called xfrm_output after it's v6 route lookups so
that never really worked with ipsec. Additioanlly, we never
passed port nubmers in the flowi, so any port based policies were
never applied as well. Now that we can fixed ipv6 routing lookup
code, we can add xfrm_output calls and pass port numbers.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/ipv6.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index cc9ea37..74fe28c 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -244,6 +244,30 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
return ip6_xmit(sk, skb, &fl6, np->opt);
}
+/* Small helper function that combines route and XFRM lookups. This is
+ * done since we might be looping through route lookups.
+ */
+static int sctp_v6_dst_lookup(struct sock *sk, struct dst_entry **dst,
+ struct flowi6 *fl6)
+{
+ int err;
+
+ err = ip6_dst_lookup(sk, dst, fl6);
+ if (err)
+ goto done;
+
+ err = xfrm_lookup(sock_net(sk), *dst, flowi6_to_flowi(fl6), sk, 0);
+ if (err)
+ goto done;
+
+ return 0;
+
+done:
+ dst_release(*dst);
+ *dst = NULL;
+ return err;
+}
+
/* Returns the dst cache entry for the given source and destination ip
* addresses.
*/
@@ -266,18 +290,23 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
memset(fl6, 0, sizeof(struct flowi6));
ipv6_addr_copy(&fl6->daddr, &daddr->v6.sin6_addr);
+ fl6->fl6_dport = daddr->v6.sin6_port;
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
fl6->flowi6_oif = daddr->v6.sin6_scope_id;
SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl6->daddr);
+ if (asoc)
+ fl6->fl6_sport = htons(asoc->base.bind_addr.port);
+
if (saddr) {
ipv6_addr_copy(&fl6->saddr, &saddr->v6.sin6_addr);
+ fl6->fl6_sport = saddr->v6.sin6_port;
SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl6->saddr);
}
- err = ip6_dst_lookup(sk, &dst, fl6);
+ err = sctp_v6_dst_lookup(sk, &dst, fl6);
if (!asoc || saddr)
goto out;
@@ -331,7 +360,8 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
rcu_read_unlock();
if (baddr) {
ipv6_addr_copy(&fl6->saddr, &baddr->v6.sin6_addr);
- err = ip6_dst_lookup(sk, &dst, fl6);
+ fl6->fl6_sport = baddr->v6.sin6_port;
+ err = sctp_v6_dst_lookup(sk, &dst, fl6);
}
out:
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
` (2 preceding siblings ...)
2011-04-26 3:47 ` [PATCH net-next-2.6 3/7] sctp: make sctp over IPv6 work with IPsec Wei Yongjun
@ 2011-04-26 3:47 ` Wei Yongjun
2011-04-26 7:12 ` David Miller
2011-04-26 3:48 ` [PATCH net-next-2.6 5/7] sctp: clean up route lookup calls Wei Yongjun
` (3 subsequent siblings)
7 siblings, 1 reply; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
From: Vlad Yasevich <vladislav.yasevich@hp.com>
There is no point in passing a destination address to
a get_saddr() call.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
include/net/sctp/structs.h | 1 -
net/sctp/ipv6.c | 2 +-
net/sctp/protocol.c | 1 -
net/sctp/transport.c | 2 +-
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index a98d36f..cd4aea9 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -571,7 +571,6 @@ struct sctp_af {
struct sock *sk);
void (*get_saddr) (struct sctp_sock *sk,
struct sctp_transport *t,
- union sctp_addr *daddr,
struct flowi *fl);
void (*copy_addrlist) (struct list_head *,
struct net_device *);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 74fe28c..31b6f35 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -392,11 +392,11 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
*/
static void sctp_v6_get_saddr(struct sctp_sock *sk,
struct sctp_transport *t,
- union sctp_addr *daddr,
struct flowi *fl)
{
struct flowi6 *fl6 = &fl->u.ip6;
union sctp_addr *saddr = &t->saddr;
+ union sctp_addr *daddr = &t->ipaddr;
SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p daddr:%pI6 ",
__func__, t->asoc, t->dst, &daddr->v6.sin6_addr);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 7be5df6..92b8b91 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -562,7 +562,6 @@ out:
*/
static void sctp_v4_get_saddr(struct sctp_sock *sk,
struct sctp_transport *t,
- union sctp_addr *daddr,
struct flowi *fl)
{
union sctp_addr *saddr = &t->saddr;
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 2544b9b..1fbb920 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -284,7 +284,7 @@ void sctp_transport_route(struct sctp_transport *transport,
if (saddr)
memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
else
- af->get_saddr(opt, transport, daddr, &fl);
+ af->get_saddr(opt, transport, &fl);
if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
return;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 5/7] sctp: clean up route lookup calls
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
` (3 preceding siblings ...)
2011-04-26 3:47 ` [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call Wei Yongjun
@ 2011-04-26 3:48 ` Wei Yongjun
2011-04-26 3:48 ` [PATCH net-next-2.6 6/7] sctp: clean up IPv6 route and XFRM lookups Wei Yongjun
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:48 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Change the call to take the transport parameter and set the
cached 'dst' appropriately inside the get_dst() function calls.
This will allow us in the future to clean up source address
storage as well.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
include/net/sctp/structs.h | 3 +--
net/sctp/ipv6.c | 19 +++++++------------
net/sctp/protocol.c | 12 +++++-------
net/sctp/transport.c | 23 ++++++++++-------------
4 files changed, 23 insertions(+), 34 deletions(-)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index cd4aea9..c9c0021 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -564,8 +564,7 @@ struct sctp_af {
int optname,
char __user *optval,
int __user *optlen);
- struct dst_entry *(*get_dst) (struct sctp_association *asoc,
- union sctp_addr *daddr,
+ void (*get_dst) (struct sctp_transport *t,
union sctp_addr *saddr,
struct flowi *fl,
struct sock *sk);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 31b6f35..60601f3 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -271,17 +271,16 @@ done:
/* Returns the dst cache entry for the given source and destination ip
* addresses.
*/
-static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
- union sctp_addr *daddr,
- union sctp_addr *saddr,
- struct flowi *fl,
- struct sock *sk)
+static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
+ struct flowi *fl, struct sock *sk)
{
+ struct sctp_association *asoc = t->asoc;
struct dst_entry *dst = NULL;
struct flowi6 *fl6 = &fl->u.ip6;
struct sctp_bind_addr *bp;
struct sctp_sockaddr_entry *laddr;
union sctp_addr *baddr = NULL;
+ union sctp_addr *daddr = &t->ipaddr;
union sctp_addr dst_saddr;
__u8 matchlen = 0;
__u8 bmatchlen;
@@ -294,7 +293,6 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
fl6->flowi6_oif = daddr->v6.sin6_scope_id;
-
SCTP_DEBUG_PRINTK("%s: DST=%pI6 ", __func__, &fl6->daddr);
if (asoc)
@@ -365,17 +363,14 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
}
out:
+ t->dst = dst;
if (dst) {
struct rt6_info *rt;
rt = (struct rt6_info *)dst;
SCTP_DEBUG_PRINTK("rt6_dst:%pI6 rt6_src:%pI6\n",
&rt->rt6i_dst.addr, &fl6->saddr);
- return dst;
- }
- SCTP_DEBUG_PRINTK("NO ROUTE\n");
- if (dst)
- dst_release(dst);
- return NULL;
+ } else
+ SCTP_DEBUG_PRINTK("NO ROUTE\n");
}
/* Returns the number of consecutive initial bits that match in the 2 ipv6
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 92b8b91..38115ce 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -463,17 +463,16 @@ static sctp_scope_t sctp_v4_scope(union sctp_addr *addr)
* addresses. If an association is passed, trys to get a dst entry with a
* source address that matches an address in the bind address list.
*/
-static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
- union sctp_addr *daddr,
- union sctp_addr *saddr,
- struct flowi *fl,
- struct sock *sk)
+static void sctp_v4_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
+ struct flowi *fl, struct sock *sk)
{
+ struct sctp_association *asoc = t->asoc;
struct rtable *rt;
struct flowi4 *fl4 = &fl->u.ip4;
struct sctp_bind_addr *bp;
struct sctp_sockaddr_entry *laddr;
struct dst_entry *dst = NULL;
+ union sctp_addr *daddr = &t->ipaddr;
union sctp_addr dst_saddr;
memset(fl4, 0x0, sizeof(struct flowi4));
@@ -548,13 +547,12 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
out_unlock:
rcu_read_unlock();
out:
+ t->dst = dst;
if (dst)
SCTP_DEBUG_PRINTK("rt_dst:%pI4, rt_src:%pI4\n",
&rt->rt_dst, &rt->rt_src);
else
SCTP_DEBUG_PRINTK("NO ROUTE\n");
-
- return dst;
}
/* For v4, the source address is cached in the route entry(dst). So no need
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 1fbb920..d8595dd 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -213,17 +213,17 @@ void sctp_transport_set_owner(struct sctp_transport *transport,
/* Initialize the pmtu of a transport. */
void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
{
- struct dst_entry *dst;
struct flowi fl;
- dst = transport->af_specific->get_dst(transport->asoc,
- &transport->ipaddr,
- &transport->saddr,
+ /* If we don't have a fresh route, look one up */
+ if (!transport->dst || transport->dst->obsolete > 1) {
+ dst_release(transport->dst);
+ transport->af_specific->get_dst(transport, &transport->saddr,
&fl, sk);
+ }
- if (dst) {
- transport->pathmtu = dst_mtu(dst);
- dst_release(dst);
+ if (transport->dst) {
+ transport->pathmtu = dst_mtu(transport->dst);
} else
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
}
@@ -274,12 +274,9 @@ void sctp_transport_route(struct sctp_transport *transport,
{
struct sctp_association *asoc = transport->asoc;
struct sctp_af *af = transport->af_specific;
- union sctp_addr *daddr = &transport->ipaddr;
- struct dst_entry *dst;
struct flowi fl;
- dst = af->get_dst(asoc, daddr, saddr, &fl, sctp_opt2sk(opt));
- transport->dst = dst;
+ af->get_dst(transport, saddr, &fl, sctp_opt2sk(opt));
if (saddr)
memcpy(&transport->saddr, saddr, sizeof(union sctp_addr));
@@ -289,8 +286,8 @@ void sctp_transport_route(struct sctp_transport *transport,
if ((transport->param_flags & SPP_PMTUD_DISABLE) && transport->pathmtu) {
return;
}
- if (dst) {
- transport->pathmtu = dst_mtu(dst);
+ if (transport->dst) {
+ transport->pathmtu = dst_mtu(transport->dst);
/* Initialize sk->sk_rcv_saddr, if the transport is the
* association's active path for getsockname().
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 6/7] sctp: clean up IPv6 route and XFRM lookups
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
` (4 preceding siblings ...)
2011-04-26 3:48 ` [PATCH net-next-2.6 5/7] sctp: clean up route lookup calls Wei Yongjun
@ 2011-04-26 3:48 ` Wei Yongjun
2011-04-26 3:49 ` [PATCH net-next-2.6 7/7] sctp: fix IPv6 source address output routing with IPsec Wei Yongjun
2011-04-26 7:12 ` [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 David Miller
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:48 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
Using ip6_dst_lookup_flow() instead of ip6_dst_lookup()
and then do xfrm_lookup().
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/ipv6.c | 40 +++++++++-------------------------------
1 files changed, 9 insertions(+), 31 deletions(-)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 60601f3..cbbfe20 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -244,30 +244,6 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
return ip6_xmit(sk, skb, &fl6, np->opt);
}
-/* Small helper function that combines route and XFRM lookups. This is
- * done since we might be looping through route lookups.
- */
-static int sctp_v6_dst_lookup(struct sock *sk, struct dst_entry **dst,
- struct flowi6 *fl6)
-{
- int err;
-
- err = ip6_dst_lookup(sk, dst, fl6);
- if (err)
- goto done;
-
- err = xfrm_lookup(sock_net(sk), *dst, flowi6_to_flowi(fl6), sk, 0);
- if (err)
- goto done;
-
- return 0;
-
-done:
- dst_release(*dst);
- *dst = NULL;
- return err;
-}
-
/* Returns the dst cache entry for the given source and destination ip
* addresses.
*/
@@ -285,7 +261,6 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
__u8 matchlen = 0;
__u8 bmatchlen;
sctp_scope_t scope;
- int err = 0;
memset(fl6, 0, sizeof(struct flowi6));
ipv6_addr_copy(&fl6->daddr, &daddr->v6.sin6_addr);
@@ -304,7 +279,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
SCTP_DEBUG_PRINTK("SRC=%pI6 - ", &fl6->saddr);
}
- err = sctp_v6_dst_lookup(sk, &dst, fl6);
+ dst = ip6_dst_lookup_flow(sk, fl6, NULL, false);
+
if (!asoc || saddr)
goto out;
@@ -313,7 +289,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
/* ip6_dst_lookup has filled in the fl6->saddr for us. Check
* to see if we can use it.
*/
- if (!err) {
+ if (!IS_ERR(dst)) {
/* Walk through the bind address list and look for a bind
* address that matches the source address of the returned dst.
*/
@@ -359,18 +335,20 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
if (baddr) {
ipv6_addr_copy(&fl6->saddr, &baddr->v6.sin6_addr);
fl6->fl6_sport = baddr->v6.sin6_port;
- err = sctp_v6_dst_lookup(sk, &dst, fl6);
+ dst = ip6_dst_lookup_flow(sk, fl6, NULL, false);
}
out:
- t->dst = dst;
- if (dst) {
+ if (!IS_ERR(dst)) {
struct rt6_info *rt;
rt = (struct rt6_info *)dst;
+ t->dst = dst;
SCTP_DEBUG_PRINTK("rt6_dst:%pI6 rt6_src:%pI6\n",
&rt->rt6i_dst.addr, &fl6->saddr);
- } else
+ } else {
+ t->dst = NULL;
SCTP_DEBUG_PRINTK("NO ROUTE\n");
+ }
}
/* Returns the number of consecutive initial bits that match in the 2 ipv6
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next-2.6 7/7] sctp: fix IPv6 source address output routing with IPsec
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
` (5 preceding siblings ...)
2011-04-26 3:48 ` [PATCH net-next-2.6 6/7] sctp: clean up IPv6 route and XFRM lookups Wei Yongjun
@ 2011-04-26 3:49 ` Wei Yongjun
2011-04-26 7:12 ` [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 David Miller
7 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 3:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, lksctp
When do IPv6 source address output routing, the flowi6_proto
field is missing, different router will be return under IPsec.
This patch fixed it.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
net/sctp/ipv6.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index cbbfe20..180495e 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -265,6 +265,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
memset(fl6, 0, sizeof(struct flowi6));
ipv6_addr_copy(&fl6->daddr, &daddr->v6.sin6_addr);
fl6->fl6_dport = daddr->v6.sin6_port;
+ fl6->flowi6_proto = IPPROTO_SCTP;
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
fl6->flowi6_oif = daddr->v6.sin6_scope_id;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call
2011-04-26 3:47 ` [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call Wei Yongjun
@ 2011-04-26 7:12 ` David Miller
2011-04-26 7:20 ` David Miller
0 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2011-04-26 7:12 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Tue, 26 Apr 2011 11:47:39 +0800
> @@ -392,11 +392,11 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
> */
> static void sctp_v6_get_saddr(struct sctp_sock *sk,
> struct sctp_transport *t,
> - union sctp_addr *daddr,
> struct flowi *fl)
> {
> struct flowi6 *fl6 = &fl->u.ip6;
> union sctp_addr *saddr = &t->saddr;
> + union sctp_addr *daddr = &t->ipaddr;
>
> SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p daddr:%pI6 ",
> __func__, t->asoc, t->dst, &daddr->v6.sin6_addr);
I really get grumpy when I have to fix up stuff like this:
net/sctp/ipv6.c: In function ‘sctp_v6_get_saddr’:
net/sctp/ipv6.c:382: warning: unused variable ‘daddr’
You guys know I'm going to immediately run make on any patch you send
me and look for new warnings.
Why waste my time and not look for them yourselves before posting the
patch?
This wasn't even one of those cases where the warning goes away at
the end of the patch series, and only exists somewhere in the middle.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
` (6 preceding siblings ...)
2011-04-26 3:49 ` [PATCH net-next-2.6 7/7] sctp: fix IPv6 source address output routing with IPsec Wei Yongjun
@ 2011-04-26 7:12 ` David Miller
2011-04-26 21:51 ` David Miller
7 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2011-04-26 7:12 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Tue, 26 Apr 2011 11:44:05 +0800
> Hi David
>
> Here is a set of SCTP patches for net-next-2.6, the last part
> from vlad's lksctp-dev tree, update SCTP IPv6 routing and IPSec
> issues. Please apply.
>
> Vlad Yasevich (4):
> sctp: cache the ipv6 source after route lookup
> sctp: make sctp over IPv6 work with IPsec
> sctp: remove useless arguments from get_saddr() call
> sctp: clean up route lookup calls
>
> Wei Yongjun (2):
> sctp: clean up IPv6 route and XFRM lookups
> sctp: fix IPv6 source address output routing with IPsec
>
> Weixing Shi (1):
> sctp: fix sctp to work with ipv6 source address routing
All applied, with the warning fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call
2011-04-26 7:12 ` David Miller
@ 2011-04-26 7:20 ` David Miller
2011-04-26 8:06 ` Wei Yongjun
0 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2011-04-26 7:20 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
From: David Miller <davem@davemloft.net>
Date: Tue, 26 Apr 2011 00:12:27 -0700 (PDT)
> I really get grumpy when I have to fix up stuff like this:
>
> net/sctp/ipv6.c: In function ‘sctp_v6_get_saddr’:
> net/sctp/ipv6.c:382: warning: unused variable ‘daddr’
Now I'm even more grumpy, if I only apply the first 3 patches:
net/sctp/ipv6.c: In function ‘sctp_v6_dst_lookup’:
net/sctp/ipv6.c:259: warning: assignment makes integer from pointer without a cast
it goes away later but you're not testing the intermediate steps
of your SCTP patch backports and as a result you are going to
break bisecting.
I'm reverting this patch series, fix this up and actually test
the intermediate builds and functionality before resubmission.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call
2011-04-26 7:20 ` David Miller
@ 2011-04-26 8:06 ` Wei Yongjun
0 siblings, 0 replies; 15+ messages in thread
From: Wei Yongjun @ 2011-04-26 8:06 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp
> From: David Miller <davem@davemloft.net>
> Date: Tue, 26 Apr 2011 00:12:27 -0700 (PDT)
>
>> I really get grumpy when I have to fix up stuff like this:
>>
>> net/sctp/ipv6.c: In function ‘sctp_v6_get_saddr’:
>> net/sctp/ipv6.c:382: warning: unused variable ‘daddr’
> Now I'm even more grumpy, if I only apply the first 3 patches:
>
> net/sctp/ipv6.c: In function ‘sctp_v6_dst_lookup’:
> net/sctp/ipv6.c:259: warning: assignment makes integer from pointer without a cast
>
> it goes away later but you're not testing the intermediate steps
> of your SCTP patch backports and as a result you are going to
> break bisecting.
>
> I'm reverting this patch series, fix this up and actually test
> the intermediate builds and functionality before resubmission.
Hi David
Sorry for sending those garbage and wasted your time so much,
I will fix those up and do all of the test before resubmit
those patch to you.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6
2011-04-26 7:12 ` [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 David Miller
@ 2011-04-26 21:51 ` David Miller
2011-04-27 0:59 ` Wei Yongjun
0 siblings, 1 reply; 15+ messages in thread
From: David Miller @ 2011-04-26 21:51 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
Wei, while you are re-spinning this patch set I want to bring up
something I just noticed in the SCTP code.
The ->dst_saddr() method is not used by anything, it appears.
The ipv4 variant, sctp_v4_dst_saddr() is called internally by the
ipv4 specific code, but that's it.
So I think the ->dst_saddr member of sctp_pf can be completely
removed, as can sctp_v6_dst_saddr().
The sctp_v4_dst_saddr() function, of course, will need to be retained.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6
2011-04-26 21:51 ` David Miller
@ 2011-04-27 0:59 ` Wei Yongjun
2011-04-27 1:47 ` David Miller
0 siblings, 1 reply; 15+ messages in thread
From: Wei Yongjun @ 2011-04-27 0:59 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-sctp
> Wei, while you are re-spinning this patch set I want to bring up
> something I just noticed in the SCTP code.
>
> The ->dst_saddr() method is not used by anything, it appears.
>
> The ipv4 variant, sctp_v4_dst_saddr() is called internally by the
> ipv4 specific code, but that's it.
>
> So I think the ->dst_saddr member of sctp_pf can be completely
> removed, as can sctp_v6_dst_saddr().
>
> The sctp_v4_dst_saddr() function, of course, will need to be retained.
David, thanks to noticed this. I will cleanup it.
And I have a stupid question about the rule of backport. Since those
patchs have existed so long time, when I backport those patchs, I'd better
fix the bug in the original patch, or create new patch to fix it? Also how
about some thing need to improvement like the ->dst_saddr() method?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6
2011-04-27 0:59 ` Wei Yongjun
@ 2011-04-27 1:47 ` David Miller
0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2011-04-27 1:47 UTC (permalink / raw)
To: yjwei; +Cc: netdev, linux-sctp
From: Wei Yongjun <yjwei@cn.fujitsu.com>
Date: Wed, 27 Apr 2011 08:59:16 +0800
> And I have a stupid question about the rule of backport. Since those
> patchs have existed so long time, when I backport those patchs, I'd better
> fix the bug in the original patch, or create new patch to fix it? Also how
> about some thing need to improvement like the ->dst_saddr() method?
I think, since these are going in as patches, you should make any
corrections to those patches by fixing the patch.
Adding new patches is just going to keep the bug in there if people
try to bisect through these changes, and that's no good.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2011-04-27 1:48 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-26 3:44 [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 Wei Yongjun
2011-04-26 3:45 ` [PATCH net-next-2.6 1/7] sctp: fix sctp to work with ipv6 source address routing Wei Yongjun
2011-04-26 3:46 ` [PATCH net-next-2.6 2/7] sctp: cache the ipv6 source after route lookup Wei Yongjun
2011-04-26 3:47 ` [PATCH net-next-2.6 3/7] sctp: make sctp over IPv6 work with IPsec Wei Yongjun
2011-04-26 3:47 ` [PATCH net-next-2.6 4/7] sctp: remove useless arguments from get_saddr() call Wei Yongjun
2011-04-26 7:12 ` David Miller
2011-04-26 7:20 ` David Miller
2011-04-26 8:06 ` Wei Yongjun
2011-04-26 3:48 ` [PATCH net-next-2.6 5/7] sctp: clean up route lookup calls Wei Yongjun
2011-04-26 3:48 ` [PATCH net-next-2.6 6/7] sctp: clean up IPv6 route and XFRM lookups Wei Yongjun
2011-04-26 3:49 ` [PATCH net-next-2.6 7/7] sctp: fix IPv6 source address output routing with IPsec Wei Yongjun
2011-04-26 7:12 ` [PATCH net-next-2.6 0/7] SCTP updates for net-next-2.6 David Miller
2011-04-26 21:51 ` David Miller
2011-04-27 0:59 ` Wei Yongjun
2011-04-27 1:47 ` 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).