Commit b01a2407 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

sctp: Make the mib per network namespace

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: default avatarVlad Yasevich <vyasevich@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb2db45b
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
struct sock; struct sock;
struct proc_dir_entry; struct proc_dir_entry;
struct sctp_mib;
struct netns_sctp { struct netns_sctp {
DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_net_sctp; struct proc_dir_entry *proc_net_sctp;
#endif #endif
......
...@@ -221,11 +221,10 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly; ...@@ -221,11 +221,10 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) #define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk)
/* SCTP SNMP MIB stats handlers */ /* SCTP SNMP MIB stats handlers */
DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); #define SCTP_INC_STATS(net, field) SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field) #define SCTP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->sctp.sctp_statistics, field)
#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field) #define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) #define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
#define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field)
#endif /* !TEST_FRAME */ #endif /* !TEST_FRAME */
......
...@@ -1150,7 +1150,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) ...@@ -1150,7 +1150,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
if (sctp_chunk_is_data(chunk)) if (sctp_chunk_is_data(chunk))
asoc->peer.last_data_from = chunk->transport; asoc->peer.last_data_from = chunk->transport;
else else
SCTP_INC_STATS(SCTP_MIB_INCTRLCHUNKS); SCTP_INC_STATS(sock_net(asoc->base.sk), SCTP_MIB_INCTRLCHUNKS);
if (chunk->transport) if (chunk->transport)
chunk->transport->last_time_heard = jiffies; chunk->transport->last_time_heard = jiffies;
......
...@@ -257,7 +257,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -257,7 +257,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
offset = 0; offset = 0;
if ((whole > 1) || (whole && over)) if ((whole > 1) || (whole && over))
SCTP_INC_STATS_USER(SCTP_MIB_FRAGUSRMSGS); SCTP_INC_STATS_USER(sock_net(asoc->base.sk), SCTP_MIB_FRAGUSRMSGS);
/* Create chunks for all the full sized DATA chunks. */ /* Create chunks for all the full sized DATA chunks. */
for (i=0, len=first_len; i < whole; i++) { for (i=0, len=first_len; i < whole; i++) {
......
...@@ -478,7 +478,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work) ...@@ -478,7 +478,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
if (asoc && sctp_chunk_is_data(chunk)) if (asoc && sctp_chunk_is_data(chunk))
asoc->peer.last_data_from = chunk->transport; asoc->peer.last_data_from = chunk->transport;
else else
SCTP_INC_STATS(SCTP_MIB_INCTRLCHUNKS); SCTP_INC_STATS(sock_net(ep->base.sk), SCTP_MIB_INCTRLCHUNKS);
if (chunk->transport) if (chunk->transport)
chunk->transport->last_time_heard = jiffies; chunk->transport->last_time_heard = jiffies;
......
...@@ -83,7 +83,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb); ...@@ -83,7 +83,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
/* Calculate the SCTP checksum of an SCTP packet. */ /* Calculate the SCTP checksum of an SCTP packet. */
static inline int sctp_rcv_checksum(struct sk_buff *skb) static inline int sctp_rcv_checksum(struct net *net, struct sk_buff *skb)
{ {
struct sctphdr *sh = sctp_hdr(skb); struct sctphdr *sh = sctp_hdr(skb);
__le32 cmp = sh->checksum; __le32 cmp = sh->checksum;
...@@ -99,7 +99,7 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb) ...@@ -99,7 +99,7 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb)
if (val != cmp) { if (val != cmp) {
/* CRC failure, dump it. */ /* CRC failure, dump it. */
SCTP_INC_STATS_BH(SCTP_MIB_CHECKSUMERRORS); SCTP_INC_STATS_BH(net, SCTP_MIB_CHECKSUMERRORS);
return -1; return -1;
} }
return 0; return 0;
...@@ -137,7 +137,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -137,7 +137,7 @@ int sctp_rcv(struct sk_buff *skb)
if (skb->pkt_type!=PACKET_HOST) if (skb->pkt_type!=PACKET_HOST)
goto discard_it; goto discard_it;
SCTP_INC_STATS_BH(SCTP_MIB_INSCTPPACKS); SCTP_INC_STATS_BH(net, SCTP_MIB_INSCTPPACKS);
if (skb_linearize(skb)) if (skb_linearize(skb))
goto discard_it; goto discard_it;
...@@ -149,7 +149,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -149,7 +149,7 @@ int sctp_rcv(struct sk_buff *skb)
if (skb->len < sizeof(struct sctphdr)) if (skb->len < sizeof(struct sctphdr))
goto discard_it; goto discard_it;
if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) && if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) &&
sctp_rcv_checksum(skb) < 0) sctp_rcv_checksum(net, skb) < 0)
goto discard_it; goto discard_it;
skb_pull(skb, sizeof(struct sctphdr)); skb_pull(skb, sizeof(struct sctphdr));
...@@ -220,7 +220,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -220,7 +220,7 @@ int sctp_rcv(struct sk_buff *skb)
*/ */
if (!asoc) { if (!asoc) {
if (sctp_rcv_ootb(skb)) { if (sctp_rcv_ootb(skb)) {
SCTP_INC_STATS_BH(SCTP_MIB_OUTOFBLUES); SCTP_INC_STATS_BH(net, SCTP_MIB_OUTOFBLUES);
goto discard_release; goto discard_release;
} }
} }
...@@ -276,9 +276,9 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -276,9 +276,9 @@ int sctp_rcv(struct sk_buff *skb)
skb = NULL; /* sctp_chunk_free already freed the skb */ skb = NULL; /* sctp_chunk_free already freed the skb */
goto discard_release; goto discard_release;
} }
SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG); SCTP_INC_STATS_BH(net, SCTP_MIB_IN_PKT_BACKLOG);
} else { } else {
SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_SOFTIRQ); SCTP_INC_STATS_BH(net, SCTP_MIB_IN_PKT_SOFTIRQ);
sctp_inq_push(&chunk->rcvr->inqueue, chunk); sctp_inq_push(&chunk->rcvr->inqueue, chunk);
} }
...@@ -293,7 +293,7 @@ int sctp_rcv(struct sk_buff *skb) ...@@ -293,7 +293,7 @@ int sctp_rcv(struct sk_buff *skb)
return 0; return 0;
discard_it: discard_it:
SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_DISCARDS); SCTP_INC_STATS_BH(net, SCTP_MIB_IN_PKT_DISCARDS);
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
...@@ -543,7 +543,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb, ...@@ -543,7 +543,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
* servers this needs to be solved differently. * servers this needs to be solved differently.
*/ */
if (sock_owned_by_user(sk)) if (sock_owned_by_user(sk))
NET_INC_STATS_BH(&init_net, LINUX_MIB_LOCKDROPPEDICMPS); NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
*app = asoc; *app = asoc;
*tpp = transport; *tpp = transport;
...@@ -593,7 +593,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -593,7 +593,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
struct net *net = dev_net(skb->dev); struct net *net = dev_net(skb->dev);
if (skb->len < ihlen + 8) { if (skb->len < ihlen + 8) {
ICMP_INC_STATS_BH(&init_net, ICMP_MIB_INERRORS); ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
return; return;
} }
...@@ -607,7 +607,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) ...@@ -607,7 +607,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
skb->network_header = saveip; skb->network_header = saveip;
skb->transport_header = savesctp; skb->transport_header = savesctp;
if (!sk) { if (!sk) {
ICMP_INC_STATS_BH(&init_net, ICMP_MIB_INERRORS); ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
return; return;
} }
/* Warning: The sock lock is held. Remember to call /* Warning: The sock lock is held. Remember to call
......
...@@ -169,7 +169,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -169,7 +169,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
skb->network_header = saveip; skb->network_header = saveip;
skb->transport_header = savesctp; skb->transport_header = savesctp;
if (!sk) { if (!sk) {
ICMP6_INC_STATS_BH(dev_net(skb->dev), idev, ICMP6_MIB_INERRORS); ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_INERRORS);
goto out; goto out;
} }
...@@ -243,7 +243,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport) ...@@ -243,7 +243,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)
__func__, skb, skb->len, __func__, skb, skb->len,
&fl6.saddr, &fl6.daddr); &fl6.saddr, &fl6.daddr);
SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); SCTP_INC_STATS(sock_net(sk), SCTP_MIB_OUTSCTPPACKS);
if (!(transport->param_flags & SPP_PMTUD_ENABLE)) if (!(transport->param_flags & SPP_PMTUD_ENABLE))
skb->local_df = 1; skb->local_df = 1;
......
...@@ -597,7 +597,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -597,7 +597,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
return err; return err;
no_route: no_route:
kfree_skb(nskb); kfree_skb(nskb);
IP_INC_STATS_BH(&init_net, IPSTATS_MIB_OUTNOROUTES); IP_INC_STATS_BH(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES);
/* FIXME: Returning the 'err' will effect all the associations /* FIXME: Returning the 'err' will effect all the associations
* associated with a socket, although only one of the paths of the * associated with a socket, although only one of the paths of the
......
...@@ -299,6 +299,7 @@ void sctp_outq_free(struct sctp_outq *q) ...@@ -299,6 +299,7 @@ void sctp_outq_free(struct sctp_outq *q)
/* Put a new chunk in an sctp_outq. */ /* Put a new chunk in an sctp_outq. */
int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk) int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
{ {
struct net *net = sock_net(q->asoc->base.sk);
int error = 0; int error = 0;
SCTP_DEBUG_PRINTK("sctp_outq_tail(%p, %p[%s])\n", SCTP_DEBUG_PRINTK("sctp_outq_tail(%p, %p[%s])\n",
...@@ -337,15 +338,15 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk) ...@@ -337,15 +338,15 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
sctp_outq_tail_data(q, chunk); sctp_outq_tail_data(q, chunk);
if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
SCTP_INC_STATS(SCTP_MIB_OUTUNORDERCHUNKS); SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS);
else else
SCTP_INC_STATS(SCTP_MIB_OUTORDERCHUNKS); SCTP_INC_STATS(net, SCTP_MIB_OUTORDERCHUNKS);
q->empty = 0; q->empty = 0;
break; break;
} }
} else { } else {
list_add_tail(&chunk->list, &q->control_chunk_list); list_add_tail(&chunk->list, &q->control_chunk_list);
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS);
} }
if (error < 0) if (error < 0)
...@@ -478,11 +479,12 @@ void sctp_retransmit_mark(struct sctp_outq *q, ...@@ -478,11 +479,12 @@ void sctp_retransmit_mark(struct sctp_outq *q,
void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
sctp_retransmit_reason_t reason) sctp_retransmit_reason_t reason)
{ {
struct net *net = sock_net(q->asoc->base.sk);
int error = 0; int error = 0;
switch(reason) { switch(reason) {
case SCTP_RTXR_T3_RTX: case SCTP_RTXR_T3_RTX:
SCTP_INC_STATS(SCTP_MIB_T3_RETRANSMITS); SCTP_INC_STATS(net, SCTP_MIB_T3_RETRANSMITS);
sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_T3_RTX); sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_T3_RTX);
/* Update the retran path if the T3-rtx timer has expired for /* Update the retran path if the T3-rtx timer has expired for
* the current retran path. * the current retran path.
...@@ -493,15 +495,15 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, ...@@ -493,15 +495,15 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport,
transport->asoc->unack_data; transport->asoc->unack_data;
break; break;
case SCTP_RTXR_FAST_RTX: case SCTP_RTXR_FAST_RTX:
SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); SCTP_INC_STATS(net, SCTP_MIB_FAST_RETRANSMITS);
sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX); sctp_transport_lower_cwnd(transport, SCTP_LOWER_CWND_FAST_RTX);
q->fast_rtx = 1; q->fast_rtx = 1;
break; break;
case SCTP_RTXR_PMTUD: case SCTP_RTXR_PMTUD:
SCTP_INC_STATS(SCTP_MIB_PMTUD_RETRANSMITS); SCTP_INC_STATS(net, SCTP_MIB_PMTUD_RETRANSMITS);
break; break;
case SCTP_RTXR_T1_RTX: case SCTP_RTXR_T1_RTX:
SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS); SCTP_INC_STATS(net, SCTP_MIB_T1_RETRANSMITS);
transport->asoc->init_retries++; transport->asoc->init_retries++;
break; break;
default: default:
...@@ -1914,6 +1916,6 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn) ...@@ -1914,6 +1916,6 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn)
if (ftsn_chunk) { if (ftsn_chunk) {
list_add_tail(&ftsn_chunk->list, &q->control_chunk_list); list_add_tail(&ftsn_chunk->list, &q->control_chunk_list);
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); SCTP_INC_STATS(sock_net(asoc->base.sk), SCTP_MIB_OUTCTRLCHUNKS);
} }
} }
...@@ -83,12 +83,9 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v) ...@@ -83,12 +83,9 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
struct net *net = seq->private; struct net *net = seq->private;
int i; int i;
if (!net_eq(net, &init_net))
return 0;
for (i = 0; sctp_snmp_list[i].name != NULL; i++) for (i = 0; sctp_snmp_list[i].name != NULL; i++)
seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
snmp_fold_field((void __percpu **)sctp_statistics, snmp_fold_field((void __percpu **)net->sctp.sctp_statistics,
sctp_snmp_list[i].entry)); sctp_snmp_list[i].entry));
return 0; return 0;
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
/* Global data structures. */ /* Global data structures. */
struct sctp_globals sctp_globals __read_mostly; struct sctp_globals sctp_globals __read_mostly;
DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics) __read_mostly;
struct idr sctp_assocs_id; struct idr sctp_assocs_id;
DEFINE_SPINLOCK(sctp_assocs_id_lock); DEFINE_SPINLOCK(sctp_assocs_id_lock);
...@@ -961,7 +960,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, ...@@ -961,7 +960,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ? inet->pmtudisc = transport->param_flags & SPP_PMTUD_ENABLE ?
IP_PMTUDISC_DO : IP_PMTUDISC_DONT; IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); SCTP_INC_STATS(sock_net(&inet->sk), SCTP_MIB_OUTSCTPPACKS);
return ip_queue_xmit(skb, &transport->fl); return ip_queue_xmit(skb, &transport->fl);
} }
...@@ -1102,16 +1101,16 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family) ...@@ -1102,16 +1101,16 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family)
return 1; return 1;
} }
static inline int init_sctp_mibs(void) static inline int init_sctp_mibs(struct net *net)
{ {
return snmp_mib_init((void __percpu **)sctp_statistics, return snmp_mib_init((void __percpu **)net->sctp.sctp_statistics,
sizeof(struct sctp_mib), sizeof(struct sctp_mib),
__alignof__(struct sctp_mib)); __alignof__(struct sctp_mib));
} }
static inline void cleanup_sctp_mibs(void) static inline void cleanup_sctp_mibs(struct net *net)
{ {
snmp_mib_free((void __percpu **)sctp_statistics); snmp_mib_free((void __percpu **)net->sctp.sctp_statistics);
} }
static void sctp_v4_pf_init(void) static void sctp_v4_pf_init(void)
...@@ -1170,6 +1169,11 @@ static int sctp_net_init(struct net *net) ...@@ -1170,6 +1169,11 @@ static int sctp_net_init(struct net *net)
{ {
int status; int status;
/* Allocate and initialise sctp mibs. */
status = init_sctp_mibs(net);
if (status)
goto err_init_mibs;
/* Initialize proc fs directory. */ /* Initialize proc fs directory. */
status = sctp_proc_init(net); status = sctp_proc_init(net);
if (status) if (status)
...@@ -1202,6 +1206,8 @@ static int sctp_net_init(struct net *net) ...@@ -1202,6 +1206,8 @@ static int sctp_net_init(struct net *net)
sctp_dbg_objcnt_exit(net); sctp_dbg_objcnt_exit(net);
sctp_proc_exit(net); sctp_proc_exit(net);
err_init_proc: err_init_proc:
cleanup_sctp_mibs(net);
err_init_mibs:
return status; return status;
} }
...@@ -1217,6 +1223,7 @@ static void sctp_net_exit(struct net *net) ...@@ -1217,6 +1223,7 @@ static void sctp_net_exit(struct net *net)
sctp_dbg_objcnt_exit(net); sctp_dbg_objcnt_exit(net);
sctp_proc_exit(net); sctp_proc_exit(net);
cleanup_sctp_mibs(net);
} }
static struct pernet_operations sctp_net_ops = { static struct pernet_operations sctp_net_ops = {
...@@ -1254,11 +1261,6 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1254,11 +1261,6 @@ SCTP_STATIC __init int sctp_init(void)
if (!sctp_chunk_cachep) if (!sctp_chunk_cachep)
goto err_chunk_cachep; goto err_chunk_cachep;
/* Allocate and initialise sctp mibs. */
status = init_sctp_mibs();
if (status)
goto err_init_mibs;
status = percpu_counter_init(&sctp_sockets_allocated, 0); status = percpu_counter_init(&sctp_sockets_allocated, 0);
if (status) if (status)
goto err_percpu_counter_init; goto err_percpu_counter_init;
...@@ -1474,8 +1476,6 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1474,8 +1476,6 @@ SCTP_STATIC __init int sctp_init(void)
err_ahash_alloc: err_ahash_alloc:
percpu_counter_destroy(&sctp_sockets_allocated); percpu_counter_destroy(&sctp_sockets_allocated);
err_percpu_counter_init: err_percpu_counter_init:
cleanup_sctp_mibs();
err_init_mibs:
kmem_cache_destroy(sctp_chunk_cachep); kmem_cache_destroy(sctp_chunk_cachep);
err_chunk_cachep: err_chunk_cachep:
kmem_cache_destroy(sctp_bucket_cachep); kmem_cache_destroy(sctp_bucket_cachep);
...@@ -1514,7 +1514,6 @@ SCTP_STATIC __exit void sctp_exit(void) ...@@ -1514,7 +1514,6 @@ SCTP_STATIC __exit void sctp_exit(void)
sizeof(struct sctp_bind_hashbucket))); sizeof(struct sctp_bind_hashbucket)));
percpu_counter_destroy(&sctp_sockets_allocated); percpu_counter_destroy(&sctp_sockets_allocated);
cleanup_sctp_mibs();
rcu_barrier(); /* Wait for completion of call_rcu()'s */ rcu_barrier(); /* Wait for completion of call_rcu()'s */
......
This diff is collapsed.
...@@ -326,7 +326,9 @@ static void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq, ...@@ -326,7 +326,9 @@ static void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq,
* payload was fragmented on the way and ip had to reassemble them. * payload was fragmented on the way and ip had to reassemble them.
* We add the rest of skb's to the first skb's fraglist. * We add the rest of skb's to the first skb's fraglist.
*/ */
static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *queue, struct sk_buff *f_frag, struct sk_buff *l_frag) static struct sctp_ulpevent *sctp_make_reassembled_event(struct net *net,
struct sk_buff_head *queue, struct sk_buff *f_frag,
struct sk_buff *l_frag)
{ {
struct sk_buff *pos; struct sk_buff *pos;
struct sk_buff *new = NULL; struct sk_buff *new = NULL;
...@@ -394,7 +396,7 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu ...@@ -394,7 +396,7 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu
} }
event = sctp_skb2event(f_frag); event = sctp_skb2event(f_frag);
SCTP_INC_STATS(SCTP_MIB_REASMUSRMSGS); SCTP_INC_STATS(net, SCTP_MIB_REASMUSRMSGS);
return event; return event;
} }
...@@ -493,7 +495,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ul ...@@ -493,7 +495,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ul
cevent = sctp_skb2event(pd_first); cevent = sctp_skb2event(pd_first);
pd_point = sctp_sk(asoc->base.sk)->pd_point; pd_point = sctp_sk(asoc->base.sk)->pd_point;
if (pd_point && pd_point <= pd_len) { if (pd_point && pd_point <= pd_len) {
retval = sctp_make_reassembled_event(&ulpq->reasm, retval = sctp_make_reassembled_event(sock_net(asoc->base.sk),
&ulpq->reasm,
pd_first, pd_first,
pd_last); pd_last);
if (retval) if (retval)
...@@ -503,7 +506,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ul ...@@ -503,7 +506,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_reassembled(struct sctp_ulpq *ul
done: done:
return retval; return retval;
found: found:
retval = sctp_make_reassembled_event(&ulpq->reasm, first_frag, pos); retval = sctp_make_reassembled_event(sock_net(ulpq->asoc->base.sk),
&ulpq->reasm, first_frag, pos);
if (retval) if (retval)
retval->msg_flags |= MSG_EOR; retval->msg_flags |= MSG_EOR;
goto done; goto done;
...@@ -563,7 +567,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_partial(struct sctp_ulpq *ulpq) ...@@ -563,7 +567,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_partial(struct sctp_ulpq *ulpq)
* further. * further.
*/ */
done: done:
retval = sctp_make_reassembled_event(&ulpq->reasm, first_frag, last_frag); retval = sctp_make_reassembled_event(sock_net(ulpq->asoc->base.sk),
&ulpq->reasm, first_frag, last_frag);
if (retval && is_last) if (retval && is_last)
retval->msg_flags |= MSG_EOR; retval->msg_flags |= MSG_EOR;
...@@ -655,7 +660,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_first(struct sctp_ulpq *ulpq) ...@@ -655,7 +660,8 @@ static struct sctp_ulpevent *sctp_ulpq_retrieve_first(struct sctp_ulpq *ulpq)
* further. * further.
*/ */
done: done:
retval = sctp_make_reassembled_event(&ulpq->reasm, first_frag, last_frag); retval = sctp_make_reassembled_event(sock_net(ulpq->asoc->base.sk),
&ulpq->reasm, first_frag, last_frag);
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment