diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-08-06 04:43:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-15 02:17:26 -0400 |
commit | 2ce955035081112cf1590c961da8d94324142b5e (patch) | |
tree | 1c9c9afdcac42e283a7383fa67842470753a0bb4 /net | |
parent | 4db67e808640e3934d82ce61ee8e2e89fd877ba8 (diff) |
sctp: Make the ctl_sock per network namespace
- Kill sctp_get_ctl_sock, it is useless now.
- Pass struct net where needed so net->sctp.ctl_sock is accessible.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/input.c | 4 | ||||
-rw-r--r-- | net/sctp/protocol.c | 47 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 45 |
3 files changed, 52 insertions, 44 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index a7e9a85b5acb..c9a0449bde53 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -204,7 +204,7 @@ int sctp_rcv(struct sk_buff *skb) | |||
204 | sctp_endpoint_put(ep); | 204 | sctp_endpoint_put(ep); |
205 | ep = NULL; | 205 | ep = NULL; |
206 | } | 206 | } |
207 | sk = sctp_get_ctl_sock(); | 207 | sk = net->sctp.ctl_sock; |
208 | ep = sctp_sk(sk)->ep; | 208 | ep = sctp_sk(sk)->ep; |
209 | sctp_endpoint_hold(ep); | 209 | sctp_endpoint_hold(ep); |
210 | rcvr = &ep->base; | 210 | rcvr = &ep->base; |
@@ -795,7 +795,7 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(struct net *net, | |||
795 | goto hit; | 795 | goto hit; |
796 | } | 796 | } |
797 | 797 | ||
798 | ep = sctp_sk((sctp_get_ctl_sock()))->ep; | 798 | ep = sctp_sk(net->sctp.ctl_sock)->ep; |
799 | 799 | ||
800 | hit: | 800 | hit: |
801 | sctp_endpoint_hold(ep); | 801 | sctp_endpoint_hold(ep); |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 7025d96bae5f..f20bd708e89c 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -78,12 +78,6 @@ struct proc_dir_entry *proc_net_sctp; | |||
78 | struct idr sctp_assocs_id; | 78 | struct idr sctp_assocs_id; |
79 | DEFINE_SPINLOCK(sctp_assocs_id_lock); | 79 | DEFINE_SPINLOCK(sctp_assocs_id_lock); |
80 | 80 | ||
81 | /* This is the global socket data structure used for responding to | ||
82 | * the Out-of-the-blue (OOTB) packets. A control sock will be created | ||
83 | * for this socket at the initialization time. | ||
84 | */ | ||
85 | static struct sock *sctp_ctl_sock; | ||
86 | |||
87 | static struct sctp_pf *sctp_pf_inet6_specific; | 81 | static struct sctp_pf *sctp_pf_inet6_specific; |
88 | static struct sctp_pf *sctp_pf_inet_specific; | 82 | static struct sctp_pf *sctp_pf_inet_specific; |
89 | static struct sctp_af *sctp_af_v4_specific; | 83 | static struct sctp_af *sctp_af_v4_specific; |
@@ -96,12 +90,6 @@ long sysctl_sctp_mem[3]; | |||
96 | int sysctl_sctp_rmem[3]; | 90 | int sysctl_sctp_rmem[3]; |
97 | int sysctl_sctp_wmem[3]; | 91 | int sysctl_sctp_wmem[3]; |
98 | 92 | ||
99 | /* Return the address of the control sock. */ | ||
100 | struct sock *sctp_get_ctl_sock(void) | ||
101 | { | ||
102 | return sctp_ctl_sock; | ||
103 | } | ||
104 | |||
105 | /* Set up the proc fs entry for the SCTP protocol. */ | 93 | /* Set up the proc fs entry for the SCTP protocol. */ |
106 | static __init int sctp_proc_init(void) | 94 | static __init int sctp_proc_init(void) |
107 | { | 95 | { |
@@ -822,7 +810,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | |||
822 | * Initialize the control inode/socket with a control endpoint data | 810 | * Initialize the control inode/socket with a control endpoint data |
823 | * structure. This endpoint is reserved exclusively for the OOTB processing. | 811 | * structure. This endpoint is reserved exclusively for the OOTB processing. |
824 | */ | 812 | */ |
825 | static int sctp_ctl_sock_init(void) | 813 | static int sctp_ctl_sock_init(struct net *net) |
826 | { | 814 | { |
827 | int err; | 815 | int err; |
828 | sa_family_t family = PF_INET; | 816 | sa_family_t family = PF_INET; |
@@ -830,14 +818,14 @@ static int sctp_ctl_sock_init(void) | |||
830 | if (sctp_get_pf_specific(PF_INET6)) | 818 | if (sctp_get_pf_specific(PF_INET6)) |
831 | family = PF_INET6; | 819 | family = PF_INET6; |
832 | 820 | ||
833 | err = inet_ctl_sock_create(&sctp_ctl_sock, family, | 821 | err = inet_ctl_sock_create(&net->sctp.ctl_sock, family, |
834 | SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); | 822 | SOCK_SEQPACKET, IPPROTO_SCTP, net); |
835 | 823 | ||
836 | /* If IPv6 socket could not be created, try the IPv4 socket */ | 824 | /* If IPv6 socket could not be created, try the IPv4 socket */ |
837 | if (err < 0 && family == PF_INET6) | 825 | if (err < 0 && family == PF_INET6) |
838 | err = inet_ctl_sock_create(&sctp_ctl_sock, AF_INET, | 826 | err = inet_ctl_sock_create(&net->sctp.ctl_sock, AF_INET, |
839 | SOCK_SEQPACKET, IPPROTO_SCTP, | 827 | SOCK_SEQPACKET, IPPROTO_SCTP, |
840 | &init_net); | 828 | net); |
841 | 829 | ||
842 | if (err < 0) { | 830 | if (err < 0) { |
843 | pr_err("Failed to create the SCTP control socket\n"); | 831 | pr_err("Failed to create the SCTP control socket\n"); |
@@ -1196,6 +1184,14 @@ static void sctp_v4_del_protocol(void) | |||
1196 | 1184 | ||
1197 | static int sctp_net_init(struct net *net) | 1185 | static int sctp_net_init(struct net *net) |
1198 | { | 1186 | { |
1187 | int status; | ||
1188 | |||
1189 | /* Initialize the control inode/socket for handling OOTB packets. */ | ||
1190 | if ((status = sctp_ctl_sock_init(net))) { | ||
1191 | pr_err("Failed to initialize the SCTP control sock\n"); | ||
1192 | goto err_ctl_sock_init; | ||
1193 | } | ||
1194 | |||
1199 | /* Initialize the local address list. */ | 1195 | /* Initialize the local address list. */ |
1200 | INIT_LIST_HEAD(&net->sctp.local_addr_list); | 1196 | INIT_LIST_HEAD(&net->sctp.local_addr_list); |
1201 | spin_lock_init(&net->sctp.local_addr_lock); | 1197 | spin_lock_init(&net->sctp.local_addr_lock); |
@@ -1210,6 +1206,9 @@ static int sctp_net_init(struct net *net) | |||
1210 | (unsigned long)net); | 1206 | (unsigned long)net); |
1211 | 1207 | ||
1212 | return 0; | 1208 | return 0; |
1209 | |||
1210 | err_ctl_sock_init: | ||
1211 | return status; | ||
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | static void sctp_net_exit(struct net *net) | 1214 | static void sctp_net_exit(struct net *net) |
@@ -1217,6 +1216,9 @@ static void sctp_net_exit(struct net *net) | |||
1217 | /* Free the local address list */ | 1216 | /* Free the local address list */ |
1218 | sctp_free_addr_wq(net); | 1217 | sctp_free_addr_wq(net); |
1219 | sctp_free_local_addr_list(net); | 1218 | sctp_free_local_addr_list(net); |
1219 | |||
1220 | /* Free the control endpoint. */ | ||
1221 | inet_ctl_sock_destroy(net->sctp.ctl_sock); | ||
1220 | } | 1222 | } |
1221 | 1223 | ||
1222 | static struct pernet_operations sctp_net_ops = { | 1224 | static struct pernet_operations sctp_net_ops = { |
@@ -1438,12 +1440,6 @@ SCTP_STATIC __init int sctp_init(void) | |||
1438 | if (status) | 1440 | if (status) |
1439 | goto err_v6_protosw_init; | 1441 | goto err_v6_protosw_init; |
1440 | 1442 | ||
1441 | /* Initialize the control inode/socket for handling OOTB packets. */ | ||
1442 | if ((status = sctp_ctl_sock_init())) { | ||
1443 | pr_err("Failed to initialize the SCTP control sock\n"); | ||
1444 | goto err_ctl_sock_init; | ||
1445 | } | ||
1446 | |||
1447 | status = register_pernet_subsys(&sctp_net_ops); | 1443 | status = register_pernet_subsys(&sctp_net_ops); |
1448 | if (status) | 1444 | if (status) |
1449 | goto err_register_pernet_subsys; | 1445 | goto err_register_pernet_subsys; |
@@ -1465,8 +1461,6 @@ err_v6_add_protocol: | |||
1465 | err_add_protocol: | 1461 | err_add_protocol: |
1466 | unregister_pernet_subsys(&sctp_net_ops); | 1462 | unregister_pernet_subsys(&sctp_net_ops); |
1467 | err_register_pernet_subsys: | 1463 | err_register_pernet_subsys: |
1468 | inet_ctl_sock_destroy(sctp_ctl_sock); | ||
1469 | err_ctl_sock_init: | ||
1470 | sctp_v6_protosw_exit(); | 1464 | sctp_v6_protosw_exit(); |
1471 | err_v6_protosw_init: | 1465 | err_v6_protosw_init: |
1472 | sctp_v4_protosw_exit(); | 1466 | sctp_v4_protosw_exit(); |
@@ -1506,9 +1500,6 @@ SCTP_STATIC __exit void sctp_exit(void) | |||
1506 | sctp_v6_del_protocol(); | 1500 | sctp_v6_del_protocol(); |
1507 | sctp_v4_del_protocol(); | 1501 | sctp_v4_del_protocol(); |
1508 | 1502 | ||
1509 | /* Free the control endpoint. */ | ||
1510 | inet_ctl_sock_destroy(sctp_ctl_sock); | ||
1511 | |||
1512 | unregister_pernet_subsys(&sctp_net_ops); | 1503 | unregister_pernet_subsys(&sctp_net_ops); |
1513 | 1504 | ||
1514 | /* Free protosw registrations */ | 1505 | /* Free protosw registrations */ |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 9fca10357350..f2daf615e8fe 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -74,7 +74,8 @@ static struct sctp_packet *sctp_abort_pkt_new(const struct sctp_endpoint *ep, | |||
74 | static int sctp_eat_data(const struct sctp_association *asoc, | 74 | static int sctp_eat_data(const struct sctp_association *asoc, |
75 | struct sctp_chunk *chunk, | 75 | struct sctp_chunk *chunk, |
76 | sctp_cmd_seq_t *commands); | 76 | sctp_cmd_seq_t *commands); |
77 | static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc, | 77 | static struct sctp_packet *sctp_ootb_pkt_new(struct net *net, |
78 | const struct sctp_association *asoc, | ||
78 | const struct sctp_chunk *chunk); | 79 | const struct sctp_chunk *chunk); |
79 | static void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep, | 80 | static void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep, |
80 | const struct sctp_association *asoc, | 81 | const struct sctp_association *asoc, |
@@ -301,6 +302,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, | |||
301 | struct sctp_chunk *err_chunk; | 302 | struct sctp_chunk *err_chunk; |
302 | struct sctp_packet *packet; | 303 | struct sctp_packet *packet; |
303 | sctp_unrecognized_param_t *unk_param; | 304 | sctp_unrecognized_param_t *unk_param; |
305 | struct net *net; | ||
304 | int len; | 306 | int len; |
305 | 307 | ||
306 | /* 6.10 Bundling | 308 | /* 6.10 Bundling |
@@ -318,7 +320,8 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, | |||
318 | /* If the packet is an OOTB packet which is temporarily on the | 320 | /* If the packet is an OOTB packet which is temporarily on the |
319 | * control endpoint, respond with an ABORT. | 321 | * control endpoint, respond with an ABORT. |
320 | */ | 322 | */ |
321 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) { | 323 | net = sock_net(ep->base.sk); |
324 | if (ep == sctp_sk(net->sctp.ctl_sock)->ep) { | ||
322 | SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES); | 325 | SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES); |
323 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); | 326 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); |
324 | } | 327 | } |
@@ -646,11 +649,13 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
646 | int error = 0; | 649 | int error = 0; |
647 | struct sctp_chunk *err_chk_p; | 650 | struct sctp_chunk *err_chk_p; |
648 | struct sock *sk; | 651 | struct sock *sk; |
652 | struct net *net; | ||
649 | 653 | ||
650 | /* If the packet is an OOTB packet which is temporarily on the | 654 | /* If the packet is an OOTB packet which is temporarily on the |
651 | * control endpoint, respond with an ABORT. | 655 | * control endpoint, respond with an ABORT. |
652 | */ | 656 | */ |
653 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) { | 657 | net = sock_net(ep->base.sk); |
658 | if (ep == sctp_sk(net->sctp.ctl_sock)->ep) { | ||
654 | SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES); | 659 | SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES); |
655 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); | 660 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); |
656 | } | 661 | } |
@@ -1171,7 +1176,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, | |||
1171 | /* Helper function to send out an abort for the restart | 1176 | /* Helper function to send out an abort for the restart |
1172 | * condition. | 1177 | * condition. |
1173 | */ | 1178 | */ |
1174 | static int sctp_sf_send_restart_abort(union sctp_addr *ssa, | 1179 | static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa, |
1175 | struct sctp_chunk *init, | 1180 | struct sctp_chunk *init, |
1176 | sctp_cmd_seq_t *commands) | 1181 | sctp_cmd_seq_t *commands) |
1177 | { | 1182 | { |
@@ -1197,7 +1202,7 @@ static int sctp_sf_send_restart_abort(union sctp_addr *ssa, | |||
1197 | errhdr->length = htons(len); | 1202 | errhdr->length = htons(len); |
1198 | 1203 | ||
1199 | /* Assign to the control socket. */ | 1204 | /* Assign to the control socket. */ |
1200 | ep = sctp_sk((sctp_get_ctl_sock()))->ep; | 1205 | ep = sctp_sk(net->sctp.ctl_sock)->ep; |
1201 | 1206 | ||
1202 | /* Association is NULL since this may be a restart attack and we | 1207 | /* Association is NULL since this may be a restart attack and we |
1203 | * want to send back the attacker's vtag. | 1208 | * want to send back the attacker's vtag. |
@@ -1240,6 +1245,7 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, | |||
1240 | struct sctp_chunk *init, | 1245 | struct sctp_chunk *init, |
1241 | sctp_cmd_seq_t *commands) | 1246 | sctp_cmd_seq_t *commands) |
1242 | { | 1247 | { |
1248 | struct net *net = sock_net(new_asoc->base.sk); | ||
1243 | struct sctp_transport *new_addr; | 1249 | struct sctp_transport *new_addr; |
1244 | int ret = 1; | 1250 | int ret = 1; |
1245 | 1251 | ||
@@ -1258,7 +1264,7 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, | |||
1258 | transports) { | 1264 | transports) { |
1259 | if (!list_has_sctp_addr(&asoc->peer.transport_addr_list, | 1265 | if (!list_has_sctp_addr(&asoc->peer.transport_addr_list, |
1260 | &new_addr->ipaddr)) { | 1266 | &new_addr->ipaddr)) { |
1261 | sctp_sf_send_restart_abort(&new_addr->ipaddr, init, | 1267 | sctp_sf_send_restart_abort(net, &new_addr->ipaddr, init, |
1262 | commands); | 1268 | commands); |
1263 | ret = 0; | 1269 | ret = 0; |
1264 | break; | 1270 | break; |
@@ -1650,10 +1656,11 @@ sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep, | |||
1650 | const sctp_subtype_t type, | 1656 | const sctp_subtype_t type, |
1651 | void *arg, sctp_cmd_seq_t *commands) | 1657 | void *arg, sctp_cmd_seq_t *commands) |
1652 | { | 1658 | { |
1659 | struct net *net = sock_net(ep->base.sk); | ||
1653 | /* Per the above section, we'll discard the chunk if we have an | 1660 | /* Per the above section, we'll discard the chunk if we have an |
1654 | * endpoint. If this is an OOTB INIT-ACK, treat it as such. | 1661 | * endpoint. If this is an OOTB INIT-ACK, treat it as such. |
1655 | */ | 1662 | */ |
1656 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) | 1663 | if (ep == sctp_sk(net->sctp.ctl_sock)->ep) |
1657 | return sctp_sf_ootb(ep, asoc, type, arg, commands); | 1664 | return sctp_sf_ootb(ep, asoc, type, arg, commands); |
1658 | else | 1665 | else |
1659 | return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); | 1666 | return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); |
@@ -3163,8 +3170,10 @@ static sctp_disposition_t sctp_sf_tabort_8_4_8(const struct sctp_endpoint *ep, | |||
3163 | struct sctp_packet *packet = NULL; | 3170 | struct sctp_packet *packet = NULL; |
3164 | struct sctp_chunk *chunk = arg; | 3171 | struct sctp_chunk *chunk = arg; |
3165 | struct sctp_chunk *abort; | 3172 | struct sctp_chunk *abort; |
3173 | struct net *net; | ||
3166 | 3174 | ||
3167 | packet = sctp_ootb_pkt_new(asoc, chunk); | 3175 | net = sock_net(ep->base.sk); |
3176 | packet = sctp_ootb_pkt_new(net, asoc, chunk); | ||
3168 | 3177 | ||
3169 | if (packet) { | 3178 | if (packet) { |
3170 | /* Make an ABORT. The T bit will be set if the asoc | 3179 | /* Make an ABORT. The T bit will be set if the asoc |
@@ -3425,8 +3434,10 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep, | |||
3425 | struct sctp_packet *packet = NULL; | 3434 | struct sctp_packet *packet = NULL; |
3426 | struct sctp_chunk *chunk = arg; | 3435 | struct sctp_chunk *chunk = arg; |
3427 | struct sctp_chunk *shut; | 3436 | struct sctp_chunk *shut; |
3437 | struct net *net; | ||
3428 | 3438 | ||
3429 | packet = sctp_ootb_pkt_new(asoc, chunk); | 3439 | net = sock_net(ep->base.sk); |
3440 | packet = sctp_ootb_pkt_new(net, asoc, chunk); | ||
3430 | 3441 | ||
3431 | if (packet) { | 3442 | if (packet) { |
3432 | /* Make an SHUTDOWN_COMPLETE. | 3443 | /* Make an SHUTDOWN_COMPLETE. |
@@ -4262,6 +4273,7 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4262 | struct sctp_packet *packet = NULL; | 4273 | struct sctp_packet *packet = NULL; |
4263 | struct sctp_chunk *chunk = arg; | 4274 | struct sctp_chunk *chunk = arg; |
4264 | struct sctp_chunk *abort = NULL; | 4275 | struct sctp_chunk *abort = NULL; |
4276 | struct net *net; | ||
4265 | 4277 | ||
4266 | /* SCTP-AUTH, Section 6.3: | 4278 | /* SCTP-AUTH, Section 6.3: |
4267 | * It should be noted that if the receiver wants to tear | 4279 | * It should be noted that if the receiver wants to tear |
@@ -4282,6 +4294,7 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4282 | if (!abort) | 4294 | if (!abort) |
4283 | goto nomem; | 4295 | goto nomem; |
4284 | 4296 | ||
4297 | net = sock_net(ep->base.sk); | ||
4285 | if (asoc) { | 4298 | if (asoc) { |
4286 | /* Treat INIT-ACK as a special case during COOKIE-WAIT. */ | 4299 | /* Treat INIT-ACK as a special case during COOKIE-WAIT. */ |
4287 | if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && | 4300 | if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK && |
@@ -4319,7 +4332,7 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4319 | SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); | 4332 | SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); |
4320 | } | 4333 | } |
4321 | } else { | 4334 | } else { |
4322 | packet = sctp_ootb_pkt_new(asoc, chunk); | 4335 | packet = sctp_ootb_pkt_new(net, asoc, chunk); |
4323 | 4336 | ||
4324 | if (!packet) | 4337 | if (!packet) |
4325 | goto nomem_pkt; | 4338 | goto nomem_pkt; |
@@ -5825,8 +5838,10 @@ static struct sctp_packet *sctp_abort_pkt_new(const struct sctp_endpoint *ep, | |||
5825 | { | 5838 | { |
5826 | struct sctp_packet *packet; | 5839 | struct sctp_packet *packet; |
5827 | struct sctp_chunk *abort; | 5840 | struct sctp_chunk *abort; |
5841 | struct net *net; | ||
5828 | 5842 | ||
5829 | packet = sctp_ootb_pkt_new(asoc, chunk); | 5843 | net = sock_net(ep->base.sk); |
5844 | packet = sctp_ootb_pkt_new(net, asoc, chunk); | ||
5830 | 5845 | ||
5831 | if (packet) { | 5846 | if (packet) { |
5832 | /* Make an ABORT. | 5847 | /* Make an ABORT. |
@@ -5858,7 +5873,8 @@ static struct sctp_packet *sctp_abort_pkt_new(const struct sctp_endpoint *ep, | |||
5858 | } | 5873 | } |
5859 | 5874 | ||
5860 | /* Allocate a packet for responding in the OOTB conditions. */ | 5875 | /* Allocate a packet for responding in the OOTB conditions. */ |
5861 | static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc, | 5876 | static struct sctp_packet *sctp_ootb_pkt_new(struct net *net, |
5877 | const struct sctp_association *asoc, | ||
5862 | const struct sctp_chunk *chunk) | 5878 | const struct sctp_chunk *chunk) |
5863 | { | 5879 | { |
5864 | struct sctp_packet *packet; | 5880 | struct sctp_packet *packet; |
@@ -5919,7 +5935,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(const struct sctp_association *asoc | |||
5919 | * the source address. | 5935 | * the source address. |
5920 | */ | 5936 | */ |
5921 | sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, | 5937 | sctp_transport_route(transport, (union sctp_addr *)&chunk->dest, |
5922 | sctp_sk(sctp_get_ctl_sock())); | 5938 | sctp_sk(net->sctp.ctl_sock)); |
5923 | 5939 | ||
5924 | packet = sctp_packet_init(&transport->packet, transport, sport, dport); | 5940 | packet = sctp_packet_init(&transport->packet, transport, sport, dport); |
5925 | packet = sctp_packet_config(packet, vtag, 0); | 5941 | packet = sctp_packet_config(packet, vtag, 0); |
@@ -5946,7 +5962,8 @@ static void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep, | |||
5946 | struct sctp_packet *packet; | 5962 | struct sctp_packet *packet; |
5947 | 5963 | ||
5948 | if (err_chunk) { | 5964 | if (err_chunk) { |
5949 | packet = sctp_ootb_pkt_new(asoc, chunk); | 5965 | struct net *net = sock_net(ep->base.sk); |
5966 | packet = sctp_ootb_pkt_new(net, asoc, chunk); | ||
5950 | if (packet) { | 5967 | if (packet) { |
5951 | struct sctp_signed_cookie *cookie; | 5968 | struct sctp_signed_cookie *cookie; |
5952 | 5969 | ||