diff options
Diffstat (limited to 'net/sctp/protocol.c')
| -rw-r--r-- | net/sctp/protocol.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index a3c8988758b1..5027b83f1cc0 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #include <linux/bootmem.h> | 54 | #include <linux/bootmem.h> |
| 55 | #include <linux/highmem.h> | 55 | #include <linux/highmem.h> |
| 56 | #include <linux/swap.h> | 56 | #include <linux/swap.h> |
| 57 | #include <linux/slab.h> | ||
| 57 | #include <net/net_namespace.h> | 58 | #include <net/net_namespace.h> |
| 58 | #include <net/protocol.h> | 59 | #include <net/protocol.h> |
| 59 | #include <net/ip.h> | 60 | #include <net/ip.h> |
| @@ -188,7 +189,6 @@ static void sctp_v4_copy_addrlist(struct list_head *addrlist, | |||
| 188 | addr->a.v4.sin_addr.s_addr = ifa->ifa_local; | 189 | addr->a.v4.sin_addr.s_addr = ifa->ifa_local; |
| 189 | addr->valid = 1; | 190 | addr->valid = 1; |
| 190 | INIT_LIST_HEAD(&addr->list); | 191 | INIT_LIST_HEAD(&addr->list); |
| 191 | INIT_RCU_HEAD(&addr->rcu); | ||
| 192 | list_add_tail(&addr->list, addrlist); | 192 | list_add_tail(&addr->list, addrlist); |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| @@ -474,19 +474,23 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
| 474 | 474 | ||
| 475 | memset(&fl, 0x0, sizeof(struct flowi)); | 475 | memset(&fl, 0x0, sizeof(struct flowi)); |
| 476 | fl.fl4_dst = daddr->v4.sin_addr.s_addr; | 476 | fl.fl4_dst = daddr->v4.sin_addr.s_addr; |
| 477 | fl.fl_ip_dport = daddr->v4.sin_port; | ||
| 477 | fl.proto = IPPROTO_SCTP; | 478 | fl.proto = IPPROTO_SCTP; |
| 478 | if (asoc) { | 479 | if (asoc) { |
| 479 | fl.fl4_tos = RT_CONN_FLAGS(asoc->base.sk); | 480 | fl.fl4_tos = RT_CONN_FLAGS(asoc->base.sk); |
| 480 | fl.oif = asoc->base.sk->sk_bound_dev_if; | 481 | fl.oif = asoc->base.sk->sk_bound_dev_if; |
| 482 | fl.fl_ip_sport = htons(asoc->base.bind_addr.port); | ||
| 481 | } | 483 | } |
| 482 | if (saddr) | 484 | if (saddr) { |
| 483 | fl.fl4_src = saddr->v4.sin_addr.s_addr; | 485 | fl.fl4_src = saddr->v4.sin_addr.s_addr; |
| 486 | fl.fl_ip_sport = saddr->v4.sin_port; | ||
| 487 | } | ||
| 484 | 488 | ||
| 485 | SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", | 489 | SCTP_DEBUG_PRINTK("%s: DST:%pI4, SRC:%pI4 - ", |
| 486 | __func__, &fl.fl4_dst, &fl.fl4_src); | 490 | __func__, &fl.fl4_dst, &fl.fl4_src); |
| 487 | 491 | ||
| 488 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 492 | if (!ip_route_output_key(&init_net, &rt, &fl)) { |
| 489 | dst = &rt->u.dst; | 493 | dst = &rt->dst; |
| 490 | } | 494 | } |
| 491 | 495 | ||
| 492 | /* If there is no association or if a source address is passed, no | 496 | /* If there is no association or if a source address is passed, no |
| @@ -528,8 +532,9 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
| 528 | if ((laddr->state == SCTP_ADDR_SRC) && | 532 | if ((laddr->state == SCTP_ADDR_SRC) && |
| 529 | (AF_INET == laddr->a.sa.sa_family)) { | 533 | (AF_INET == laddr->a.sa.sa_family)) { |
| 530 | fl.fl4_src = laddr->a.v4.sin_addr.s_addr; | 534 | fl.fl4_src = laddr->a.v4.sin_addr.s_addr; |
| 535 | fl.fl_ip_sport = laddr->a.v4.sin_port; | ||
| 531 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 536 | if (!ip_route_output_key(&init_net, &rt, &fl)) { |
| 532 | dst = &rt->u.dst; | 537 | dst = &rt->dst; |
| 533 | goto out_unlock; | 538 | goto out_unlock; |
| 534 | } | 539 | } |
| 535 | } | 540 | } |
| @@ -854,7 +859,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
| 854 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; | 859 | IP_PMTUDISC_DO : IP_PMTUDISC_DONT; |
| 855 | 860 | ||
| 856 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 861 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
| 857 | return ip_queue_xmit(skb, 0); | 862 | return ip_queue_xmit(skb); |
| 858 | } | 863 | } |
| 859 | 864 | ||
| 860 | static struct sctp_af sctp_af_inet; | 865 | static struct sctp_af sctp_af_inet; |
| @@ -996,12 +1001,14 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family) | |||
| 996 | 1001 | ||
| 997 | static inline int init_sctp_mibs(void) | 1002 | static inline int init_sctp_mibs(void) |
| 998 | { | 1003 | { |
| 999 | return snmp_mib_init((void**)sctp_statistics, sizeof(struct sctp_mib)); | 1004 | return snmp_mib_init((void __percpu **)sctp_statistics, |
| 1005 | sizeof(struct sctp_mib), | ||
| 1006 | __alignof__(struct sctp_mib)); | ||
| 1000 | } | 1007 | } |
| 1001 | 1008 | ||
| 1002 | static inline void cleanup_sctp_mibs(void) | 1009 | static inline void cleanup_sctp_mibs(void) |
| 1003 | { | 1010 | { |
| 1004 | snmp_mib_free((void**)sctp_statistics); | 1011 | snmp_mib_free((void __percpu **)sctp_statistics); |
| 1005 | } | 1012 | } |
| 1006 | 1013 | ||
| 1007 | static void sctp_v4_pf_init(void) | 1014 | static void sctp_v4_pf_init(void) |
| @@ -1156,7 +1163,7 @@ SCTP_STATIC __init int sctp_init(void) | |||
| 1156 | /* Set the pressure threshold to be a fraction of global memory that | 1163 | /* Set the pressure threshold to be a fraction of global memory that |
| 1157 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of | 1164 | * is up to 1/2 at 256 MB, decreasing toward zero with the amount of |
| 1158 | * memory, with a floor of 128 pages. | 1165 | * memory, with a floor of 128 pages. |
| 1159 | * Note this initalizes the data in sctpv6_prot too | 1166 | * Note this initializes the data in sctpv6_prot too |
| 1160 | * Unabashedly stolen from tcp_init | 1167 | * Unabashedly stolen from tcp_init |
| 1161 | */ | 1168 | */ |
| 1162 | nr_pages = totalram_pages - totalhigh_pages; | 1169 | nr_pages = totalram_pages - totalhigh_pages; |
