diff options
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/associola.c | 42 | ||||
-rw-r--r-- | net/sctp/bind_addr.c | 15 | ||||
-rw-r--r-- | net/sctp/chunk.c | 23 | ||||
-rw-r--r-- | net/sctp/command.c | 10 | ||||
-rw-r--r-- | net/sctp/input.c | 3 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 17 | ||||
-rw-r--r-- | net/sctp/output.c | 14 | ||||
-rw-r--r-- | net/sctp/outqueue.c | 66 | ||||
-rw-r--r-- | net/sctp/proc.c | 27 | ||||
-rw-r--r-- | net/sctp/protocol.c | 50 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 12 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 29 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 38 | ||||
-rw-r--r-- | net/sctp/socket.c | 81 | ||||
-rw-r--r-- | net/sctp/transport.c | 10 |
15 files changed, 174 insertions, 263 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index d29f792e0529..b4cd2b71953f 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -718,12 +718,11 @@ struct sctp_transport *sctp_assoc_lookup_paddr( | |||
718 | const union sctp_addr *address) | 718 | const union sctp_addr *address) |
719 | { | 719 | { |
720 | struct sctp_transport *t; | 720 | struct sctp_transport *t; |
721 | struct list_head *pos; | ||
722 | 721 | ||
723 | /* Cycle through all transports searching for a peer address. */ | 722 | /* Cycle through all transports searching for a peer address. */ |
724 | 723 | ||
725 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 724 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
726 | t = list_entry(pos, struct sctp_transport, transports); | 725 | transports) { |
727 | if (sctp_cmp_addr_exact(address, &t->ipaddr)) | 726 | if (sctp_cmp_addr_exact(address, &t->ipaddr)) |
728 | return t; | 727 | return t; |
729 | } | 728 | } |
@@ -762,7 +761,6 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
762 | struct sctp_transport *second; | 761 | struct sctp_transport *second; |
763 | struct sctp_ulpevent *event; | 762 | struct sctp_ulpevent *event; |
764 | struct sockaddr_storage addr; | 763 | struct sockaddr_storage addr; |
765 | struct list_head *pos; | ||
766 | int spc_state = 0; | 764 | int spc_state = 0; |
767 | 765 | ||
768 | /* Record the transition on the transport. */ | 766 | /* Record the transition on the transport. */ |
@@ -814,8 +812,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
814 | */ | 812 | */ |
815 | first = NULL; second = NULL; | 813 | first = NULL; second = NULL; |
816 | 814 | ||
817 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 815 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
818 | t = list_entry(pos, struct sctp_transport, transports); | 816 | transports) { |
819 | 817 | ||
820 | if ((t->state == SCTP_INACTIVE) || | 818 | if ((t->state == SCTP_INACTIVE) || |
821 | (t->state == SCTP_UNCONFIRMED)) | 819 | (t->state == SCTP_UNCONFIRMED)) |
@@ -932,7 +930,6 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
932 | { | 930 | { |
933 | struct sctp_transport *active; | 931 | struct sctp_transport *active; |
934 | struct sctp_transport *match; | 932 | struct sctp_transport *match; |
935 | struct list_head *entry, *pos; | ||
936 | struct sctp_transport *transport; | 933 | struct sctp_transport *transport; |
937 | struct sctp_chunk *chunk; | 934 | struct sctp_chunk *chunk; |
938 | __be32 key = htonl(tsn); | 935 | __be32 key = htonl(tsn); |
@@ -956,8 +953,8 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
956 | 953 | ||
957 | active = asoc->peer.active_path; | 954 | active = asoc->peer.active_path; |
958 | 955 | ||
959 | list_for_each(entry, &active->transmitted) { | 956 | list_for_each_entry(chunk, &active->transmitted, |
960 | chunk = list_entry(entry, struct sctp_chunk, transmitted_list); | 957 | transmitted_list) { |
961 | 958 | ||
962 | if (key == chunk->subh.data_hdr->tsn) { | 959 | if (key == chunk->subh.data_hdr->tsn) { |
963 | match = active; | 960 | match = active; |
@@ -966,14 +963,13 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
966 | } | 963 | } |
967 | 964 | ||
968 | /* If not found, go search all the other transports. */ | 965 | /* If not found, go search all the other transports. */ |
969 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 966 | list_for_each_entry(transport, &asoc->peer.transport_addr_list, |
970 | transport = list_entry(pos, struct sctp_transport, transports); | 967 | transports) { |
971 | 968 | ||
972 | if (transport == active) | 969 | if (transport == active) |
973 | break; | 970 | break; |
974 | list_for_each(entry, &transport->transmitted) { | 971 | list_for_each_entry(chunk, &transport->transmitted, |
975 | chunk = list_entry(entry, struct sctp_chunk, | 972 | transmitted_list) { |
976 | transmitted_list); | ||
977 | if (key == chunk->subh.data_hdr->tsn) { | 973 | if (key == chunk->subh.data_hdr->tsn) { |
978 | match = transport; | 974 | match = transport; |
979 | goto out; | 975 | goto out; |
@@ -1154,9 +1150,8 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
1154 | 1150 | ||
1155 | } else { | 1151 | } else { |
1156 | /* Add any peer addresses from the new association. */ | 1152 | /* Add any peer addresses from the new association. */ |
1157 | list_for_each(pos, &new->peer.transport_addr_list) { | 1153 | list_for_each_entry(trans, &new->peer.transport_addr_list, |
1158 | trans = list_entry(pos, struct sctp_transport, | 1154 | transports) { |
1159 | transports); | ||
1160 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) | 1155 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) |
1161 | sctp_assoc_add_peer(asoc, &trans->ipaddr, | 1156 | sctp_assoc_add_peer(asoc, &trans->ipaddr, |
1162 | GFP_ATOMIC, trans->state); | 1157 | GFP_ATOMIC, trans->state); |
@@ -1306,15 +1301,14 @@ struct sctp_transport *sctp_assoc_choose_shutdown_transport( | |||
1306 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc) | 1301 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc) |
1307 | { | 1302 | { |
1308 | struct sctp_transport *t; | 1303 | struct sctp_transport *t; |
1309 | struct list_head *pos; | ||
1310 | __u32 pmtu = 0; | 1304 | __u32 pmtu = 0; |
1311 | 1305 | ||
1312 | if (!asoc) | 1306 | if (!asoc) |
1313 | return; | 1307 | return; |
1314 | 1308 | ||
1315 | /* Get the lowest pmtu of all the transports. */ | 1309 | /* Get the lowest pmtu of all the transports. */ |
1316 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 1310 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
1317 | t = list_entry(pos, struct sctp_transport, transports); | 1311 | transports) { |
1318 | if (t->pmtu_pending && t->dst) { | 1312 | if (t->pmtu_pending && t->dst) { |
1319 | sctp_transport_update_pmtu(t, dst_mtu(t->dst)); | 1313 | sctp_transport_update_pmtu(t, dst_mtu(t->dst)); |
1320 | t->pmtu_pending = 0; | 1314 | t->pmtu_pending = 0; |
@@ -1330,7 +1324,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc) | |||
1330 | } | 1324 | } |
1331 | 1325 | ||
1332 | SCTP_DEBUG_PRINTK("%s: asoc:%p, pmtu:%d, frag_point:%d\n", | 1326 | SCTP_DEBUG_PRINTK("%s: asoc:%p, pmtu:%d, frag_point:%d\n", |
1333 | __FUNCTION__, asoc, asoc->pathmtu, asoc->frag_point); | 1327 | __func__, asoc, asoc->pathmtu, asoc->frag_point); |
1334 | } | 1328 | } |
1335 | 1329 | ||
1336 | /* Should we send a SACK to update our peer? */ | 1330 | /* Should we send a SACK to update our peer? */ |
@@ -1370,7 +1364,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned len) | |||
1370 | } | 1364 | } |
1371 | 1365 | ||
1372 | SCTP_DEBUG_PRINTK("%s: asoc %p rwnd increased by %d to (%u, %u) " | 1366 | SCTP_DEBUG_PRINTK("%s: asoc %p rwnd increased by %d to (%u, %u) " |
1373 | "- %u\n", __FUNCTION__, asoc, len, asoc->rwnd, | 1367 | "- %u\n", __func__, asoc, len, asoc->rwnd, |
1374 | asoc->rwnd_over, asoc->a_rwnd); | 1368 | asoc->rwnd_over, asoc->a_rwnd); |
1375 | 1369 | ||
1376 | /* Send a window update SACK if the rwnd has increased by at least the | 1370 | /* Send a window update SACK if the rwnd has increased by at least the |
@@ -1381,7 +1375,7 @@ void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned len) | |||
1381 | if (sctp_peer_needs_update(asoc)) { | 1375 | if (sctp_peer_needs_update(asoc)) { |
1382 | asoc->a_rwnd = asoc->rwnd; | 1376 | asoc->a_rwnd = asoc->rwnd; |
1383 | SCTP_DEBUG_PRINTK("%s: Sending window update SACK- asoc: %p " | 1377 | SCTP_DEBUG_PRINTK("%s: Sending window update SACK- asoc: %p " |
1384 | "rwnd: %u a_rwnd: %u\n", __FUNCTION__, | 1378 | "rwnd: %u a_rwnd: %u\n", __func__, |
1385 | asoc, asoc->rwnd, asoc->a_rwnd); | 1379 | asoc, asoc->rwnd, asoc->a_rwnd); |
1386 | sack = sctp_make_sack(asoc); | 1380 | sack = sctp_make_sack(asoc); |
1387 | if (!sack) | 1381 | if (!sack) |
@@ -1410,7 +1404,7 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned len) | |||
1410 | asoc->rwnd = 0; | 1404 | asoc->rwnd = 0; |
1411 | } | 1405 | } |
1412 | SCTP_DEBUG_PRINTK("%s: asoc %p rwnd decreased by %d to (%u, %u)\n", | 1406 | SCTP_DEBUG_PRINTK("%s: asoc %p rwnd decreased by %d to (%u, %u)\n", |
1413 | __FUNCTION__, asoc, len, asoc->rwnd, | 1407 | __func__, asoc, len, asoc->rwnd, |
1414 | asoc->rwnd_over); | 1408 | asoc->rwnd_over); |
1415 | } | 1409 | } |
1416 | 1410 | ||
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index ceefda025e2d..80e6df06967a 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -67,15 +67,13 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
67 | int flags) | 67 | int flags) |
68 | { | 68 | { |
69 | struct sctp_sockaddr_entry *addr; | 69 | struct sctp_sockaddr_entry *addr; |
70 | struct list_head *pos; | ||
71 | int error = 0; | 70 | int error = 0; |
72 | 71 | ||
73 | /* All addresses share the same port. */ | 72 | /* All addresses share the same port. */ |
74 | dest->port = src->port; | 73 | dest->port = src->port; |
75 | 74 | ||
76 | /* Extract the addresses which are relevant for this scope. */ | 75 | /* Extract the addresses which are relevant for this scope. */ |
77 | list_for_each(pos, &src->address_list) { | 76 | list_for_each_entry(addr, &src->address_list, list) { |
78 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | ||
79 | error = sctp_copy_one_addr(dest, &addr->a, scope, | 77 | error = sctp_copy_one_addr(dest, &addr->a, scope, |
80 | gfp, flags); | 78 | gfp, flags); |
81 | if (error < 0) | 79 | if (error < 0) |
@@ -87,9 +85,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
87 | * the assumption that we must be sitting behind a NAT. | 85 | * the assumption that we must be sitting behind a NAT. |
88 | */ | 86 | */ |
89 | if (list_empty(&dest->address_list) && (SCTP_SCOPE_GLOBAL == scope)) { | 87 | if (list_empty(&dest->address_list) && (SCTP_SCOPE_GLOBAL == scope)) { |
90 | list_for_each(pos, &src->address_list) { | 88 | list_for_each_entry(addr, &src->address_list, list) { |
91 | addr = list_entry(pos, struct sctp_sockaddr_entry, | ||
92 | list); | ||
93 | error = sctp_copy_one_addr(dest, &addr->a, | 89 | error = sctp_copy_one_addr(dest, &addr->a, |
94 | SCTP_SCOPE_LINK, gfp, | 90 | SCTP_SCOPE_LINK, gfp, |
95 | flags); | 91 | flags); |
@@ -115,14 +111,12 @@ int sctp_bind_addr_dup(struct sctp_bind_addr *dest, | |||
115 | gfp_t gfp) | 111 | gfp_t gfp) |
116 | { | 112 | { |
117 | struct sctp_sockaddr_entry *addr; | 113 | struct sctp_sockaddr_entry *addr; |
118 | struct list_head *pos; | ||
119 | int error = 0; | 114 | int error = 0; |
120 | 115 | ||
121 | /* All addresses share the same port. */ | 116 | /* All addresses share the same port. */ |
122 | dest->port = src->port; | 117 | dest->port = src->port; |
123 | 118 | ||
124 | list_for_each(pos, &src->address_list) { | 119 | list_for_each_entry(addr, &src->address_list, list) { |
125 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | ||
126 | error = sctp_add_bind_addr(dest, &addr->a, 1, gfp); | 120 | error = sctp_add_bind_addr(dest, &addr->a, 1, gfp); |
127 | if (error < 0) | 121 | if (error < 0) |
128 | break; | 122 | break; |
@@ -273,8 +267,7 @@ union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, | |||
273 | 267 | ||
274 | addrparms = retval; | 268 | addrparms = retval; |
275 | 269 | ||
276 | list_for_each(pos, &bp->address_list) { | 270 | list_for_each_entry(addr, &bp->address_list, list) { |
277 | addr = list_entry(pos, struct sctp_sockaddr_entry, list); | ||
278 | af = sctp_get_af_specific(addr->a.v4.sin_family); | 271 | af = sctp_get_af_specific(addr->a.v4.sin_family); |
279 | len = af->to_addr_param(&addr->a, &rawaddr); | 272 | len = af->to_addr_param(&addr->a, &rawaddr); |
280 | memcpy(addrparms.v, &rawaddr, len); | 273 | memcpy(addrparms.v, &rawaddr, len); |
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index 4d3128f5ccc3..1748ef90950c 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
@@ -66,9 +66,10 @@ SCTP_STATIC struct sctp_datamsg *sctp_datamsg_new(gfp_t gfp) | |||
66 | { | 66 | { |
67 | struct sctp_datamsg *msg; | 67 | struct sctp_datamsg *msg; |
68 | msg = kmalloc(sizeof(struct sctp_datamsg), gfp); | 68 | msg = kmalloc(sizeof(struct sctp_datamsg), gfp); |
69 | if (msg) | 69 | if (msg) { |
70 | sctp_datamsg_init(msg); | 70 | sctp_datamsg_init(msg); |
71 | SCTP_DBG_OBJCNT_INC(datamsg); | 71 | SCTP_DBG_OBJCNT_INC(datamsg); |
72 | } | ||
72 | return msg; | 73 | return msg; |
73 | } | 74 | } |
74 | 75 | ||
@@ -136,20 +137,6 @@ void sctp_datamsg_put(struct sctp_datamsg *msg) | |||
136 | sctp_datamsg_destroy(msg); | 137 | sctp_datamsg_destroy(msg); |
137 | } | 138 | } |
138 | 139 | ||
139 | /* Free a message. Really just give up a reference, the | ||
140 | * really free happens in sctp_datamsg_destroy(). | ||
141 | */ | ||
142 | void sctp_datamsg_free(struct sctp_datamsg *msg) | ||
143 | { | ||
144 | sctp_datamsg_put(msg); | ||
145 | } | ||
146 | |||
147 | /* Hold on to all the fragments until all chunks have been sent. */ | ||
148 | void sctp_datamsg_track(struct sctp_chunk *chunk) | ||
149 | { | ||
150 | sctp_chunk_hold(chunk); | ||
151 | } | ||
152 | |||
153 | /* Assign a chunk to this datamsg. */ | 140 | /* Assign a chunk to this datamsg. */ |
154 | static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) | 141 | static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) |
155 | { | 142 | { |
@@ -189,7 +176,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
189 | msecs_to_jiffies(sinfo->sinfo_timetolive); | 176 | msecs_to_jiffies(sinfo->sinfo_timetolive); |
190 | msg->can_abandon = 1; | 177 | msg->can_abandon = 1; |
191 | SCTP_DEBUG_PRINTK("%s: msg:%p expires_at: %ld jiffies:%ld\n", | 178 | SCTP_DEBUG_PRINTK("%s: msg:%p expires_at: %ld jiffies:%ld\n", |
192 | __FUNCTION__, msg, msg->expires_at, jiffies); | 179 | __func__, msg, msg->expires_at, jiffies); |
193 | } | 180 | } |
194 | 181 | ||
195 | max = asoc->frag_point; | 182 | max = asoc->frag_point; |
@@ -295,7 +282,7 @@ errout: | |||
295 | chunk = list_entry(pos, struct sctp_chunk, frag_list); | 282 | chunk = list_entry(pos, struct sctp_chunk, frag_list); |
296 | sctp_chunk_free(chunk); | 283 | sctp_chunk_free(chunk); |
297 | } | 284 | } |
298 | sctp_datamsg_free(msg); | 285 | sctp_datamsg_put(msg); |
299 | return NULL; | 286 | return NULL; |
300 | } | 287 | } |
301 | 288 | ||
diff --git a/net/sctp/command.c b/net/sctp/command.c index bb977330002a..c0044019db9e 100644 --- a/net/sctp/command.c +++ b/net/sctp/command.c | |||
@@ -52,18 +52,12 @@ int sctp_init_cmd_seq(sctp_cmd_seq_t *seq) | |||
52 | /* Add a command to a sctp_cmd_seq_t. | 52 | /* Add a command to a sctp_cmd_seq_t. |
53 | * Return 0 if the command sequence is full. | 53 | * Return 0 if the command sequence is full. |
54 | */ | 54 | */ |
55 | int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj) | 55 | void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj) |
56 | { | 56 | { |
57 | if (seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS) | 57 | BUG_ON(seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS); |
58 | goto fail; | ||
59 | 58 | ||
60 | seq->cmds[seq->next_free_slot].verb = verb; | 59 | seq->cmds[seq->next_free_slot].verb = verb; |
61 | seq->cmds[seq->next_free_slot++].obj = obj; | 60 | seq->cmds[seq->next_free_slot++].obj = obj; |
62 | |||
63 | return 1; | ||
64 | |||
65 | fail: | ||
66 | return 0; | ||
67 | } | 61 | } |
68 | 62 | ||
69 | /* Return the next command structure in a sctp_cmd_seq. | 63 | /* Return the next command structure in a sctp_cmd_seq. |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 812ff1756c3e..ca6b022b1df2 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -409,7 +409,7 @@ void sctp_icmp_proto_unreachable(struct sock *sk, | |||
409 | struct sctp_association *asoc, | 409 | struct sctp_association *asoc, |
410 | struct sctp_transport *t) | 410 | struct sctp_transport *t) |
411 | { | 411 | { |
412 | SCTP_DEBUG_PRINTK("%s\n", __FUNCTION__); | 412 | SCTP_DEBUG_PRINTK("%s\n", __func__); |
413 | 413 | ||
414 | sctp_do_sm(SCTP_EVENT_T_OTHER, | 414 | sctp_do_sm(SCTP_EVENT_T_OTHER, |
415 | SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), | 415 | SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), |
@@ -725,7 +725,6 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l | |||
725 | } | 725 | } |
726 | 726 | ||
727 | ep = sctp_sk((sctp_get_ctl_sock()))->ep; | 727 | ep = sctp_sk((sctp_get_ctl_sock()))->ep; |
728 | epb = &ep->base; | ||
729 | 728 | ||
730 | hit: | 729 | hit: |
731 | sctp_endpoint_hold(ep); | 730 | sctp_endpoint_hold(ep); |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 85f1495e0edc..e45e44c60635 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -226,7 +226,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport, | |||
226 | 226 | ||
227 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " | 227 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " |
228 | "src:" NIP6_FMT " dst:" NIP6_FMT "\n", | 228 | "src:" NIP6_FMT " dst:" NIP6_FMT "\n", |
229 | __FUNCTION__, skb, skb->len, | 229 | __func__, skb, skb->len, |
230 | NIP6(fl.fl6_src), NIP6(fl.fl6_dst)); | 230 | NIP6(fl.fl6_src), NIP6(fl.fl6_dst)); |
231 | 231 | ||
232 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 232 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
@@ -251,7 +251,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, | |||
251 | 251 | ||
252 | 252 | ||
253 | SCTP_DEBUG_PRINTK("%s: DST=" NIP6_FMT " ", | 253 | SCTP_DEBUG_PRINTK("%s: DST=" NIP6_FMT " ", |
254 | __FUNCTION__, NIP6(fl.fl6_dst)); | 254 | __func__, NIP6(fl.fl6_dst)); |
255 | 255 | ||
256 | if (saddr) { | 256 | if (saddr) { |
257 | ipv6_addr_copy(&fl.fl6_src, &saddr->v6.sin6_addr); | 257 | ipv6_addr_copy(&fl.fl6_src, &saddr->v6.sin6_addr); |
@@ -260,7 +260,7 @@ static struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, | |||
260 | NIP6(fl.fl6_src)); | 260 | NIP6(fl.fl6_src)); |
261 | } | 261 | } |
262 | 262 | ||
263 | dst = ip6_route_output(NULL, &fl); | 263 | dst = ip6_route_output(&init_net, NULL, &fl); |
264 | if (!dst->error) { | 264 | if (!dst->error) { |
265 | struct rt6_info *rt; | 265 | struct rt6_info *rt; |
266 | rt = (struct rt6_info *)dst; | 266 | rt = (struct rt6_info *)dst; |
@@ -313,10 +313,13 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc, | |||
313 | 313 | ||
314 | SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p " | 314 | SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p " |
315 | "daddr:" NIP6_FMT " ", | 315 | "daddr:" NIP6_FMT " ", |
316 | __FUNCTION__, asoc, dst, NIP6(daddr->v6.sin6_addr)); | 316 | __func__, asoc, dst, NIP6(daddr->v6.sin6_addr)); |
317 | 317 | ||
318 | if (!asoc) { | 318 | if (!asoc) { |
319 | ipv6_get_saddr(dst, &daddr->v6.sin6_addr,&saddr->v6.sin6_addr); | 319 | ipv6_dev_get_saddr(dst ? ip6_dst_idev(dst)->dev : NULL, |
320 | &daddr->v6.sin6_addr, | ||
321 | inet6_sk(asoc->base.sk)->srcprefs, | ||
322 | &saddr->v6.sin6_addr); | ||
320 | SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n", | 323 | SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " NIP6_FMT "\n", |
321 | NIP6(saddr->v6.sin6_addr)); | 324 | NIP6(saddr->v6.sin6_addr)); |
322 | return; | 325 | return; |
@@ -351,7 +354,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc, | |||
351 | } else { | 354 | } else { |
352 | printk(KERN_ERR "%s: asoc:%p Could not find a valid source " | 355 | printk(KERN_ERR "%s: asoc:%p Could not find a valid source " |
353 | "address for the dest:" NIP6_FMT "\n", | 356 | "address for the dest:" NIP6_FMT "\n", |
354 | __FUNCTION__, asoc, NIP6(daddr->v6.sin6_addr)); | 357 | __func__, asoc, NIP6(daddr->v6.sin6_addr)); |
355 | } | 358 | } |
356 | 359 | ||
357 | rcu_read_unlock(); | 360 | rcu_read_unlock(); |
@@ -634,7 +637,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
634 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 637 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
635 | struct sctp6_sock *newsctp6sk; | 638 | struct sctp6_sock *newsctp6sk; |
636 | 639 | ||
637 | newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot); | 640 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot); |
638 | if (!newsk) | 641 | if (!newsk) |
639 | goto out; | 642 | goto out; |
640 | 643 | ||
diff --git a/net/sctp/output.c b/net/sctp/output.c index aa700feea76c..cf4f9fb6819d 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -74,7 +74,7 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet, | |||
74 | { | 74 | { |
75 | struct sctp_chunk *chunk = NULL; | 75 | struct sctp_chunk *chunk = NULL; |
76 | 76 | ||
77 | SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __FUNCTION__, | 77 | SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, |
78 | packet, vtag); | 78 | packet, vtag); |
79 | 79 | ||
80 | packet->vtag = vtag; | 80 | packet->vtag = vtag; |
@@ -106,7 +106,7 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *packet, | |||
106 | struct sctp_association *asoc = transport->asoc; | 106 | struct sctp_association *asoc = transport->asoc; |
107 | size_t overhead; | 107 | size_t overhead; |
108 | 108 | ||
109 | SCTP_DEBUG_PRINTK("%s: packet:%p transport:%p\n", __FUNCTION__, | 109 | SCTP_DEBUG_PRINTK("%s: packet:%p transport:%p\n", __func__, |
110 | packet, transport); | 110 | packet, transport); |
111 | 111 | ||
112 | packet->transport = transport; | 112 | packet->transport = transport; |
@@ -138,7 +138,7 @@ void sctp_packet_free(struct sctp_packet *packet) | |||
138 | { | 138 | { |
139 | struct sctp_chunk *chunk, *tmp; | 139 | struct sctp_chunk *chunk, *tmp; |
140 | 140 | ||
141 | SCTP_DEBUG_PRINTK("%s: packet:%p\n", __FUNCTION__, packet); | 141 | SCTP_DEBUG_PRINTK("%s: packet:%p\n", __func__, packet); |
142 | 142 | ||
143 | list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { | 143 | list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { |
144 | list_del_init(&chunk->list); | 144 | list_del_init(&chunk->list); |
@@ -162,7 +162,7 @@ sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *packet, | |||
162 | sctp_xmit_t retval; | 162 | sctp_xmit_t retval; |
163 | int error = 0; | 163 | int error = 0; |
164 | 164 | ||
165 | SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __FUNCTION__, | 165 | SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __func__, |
166 | packet, chunk); | 166 | packet, chunk); |
167 | 167 | ||
168 | switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { | 168 | switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { |
@@ -264,7 +264,7 @@ sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *packet, | |||
264 | size_t pmtu; | 264 | size_t pmtu; |
265 | int too_big; | 265 | int too_big; |
266 | 266 | ||
267 | SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __FUNCTION__, packet, | 267 | SCTP_DEBUG_PRINTK("%s: packet:%p chunk:%p\n", __func__, packet, |
268 | chunk); | 268 | chunk); |
269 | 269 | ||
270 | /* Try to bundle AUTH chunk */ | 270 | /* Try to bundle AUTH chunk */ |
@@ -372,7 +372,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) | |||
372 | unsigned char *auth = NULL; /* pointer to auth in skb data */ | 372 | unsigned char *auth = NULL; /* pointer to auth in skb data */ |
373 | __u32 cksum_buf_len = sizeof(struct sctphdr); | 373 | __u32 cksum_buf_len = sizeof(struct sctphdr); |
374 | 374 | ||
375 | SCTP_DEBUG_PRINTK("%s: packet:%p\n", __FUNCTION__, packet); | 375 | SCTP_DEBUG_PRINTK("%s: packet:%p\n", __func__, packet); |
376 | 376 | ||
377 | /* Do NOT generate a chunkless packet. */ | 377 | /* Do NOT generate a chunkless packet. */ |
378 | if (list_empty(&packet->chunk_list)) | 378 | if (list_empty(&packet->chunk_list)) |
@@ -677,7 +677,7 @@ static sctp_xmit_t sctp_packet_append_data(struct sctp_packet *packet, | |||
677 | "transport: %p, cwnd: %d, " | 677 | "transport: %p, cwnd: %d, " |
678 | "ssthresh: %d, flight_size: %d, " | 678 | "ssthresh: %d, flight_size: %d, " |
679 | "pba: %d\n", | 679 | "pba: %d\n", |
680 | __FUNCTION__, transport, | 680 | __func__, transport, |
681 | transport->cwnd, | 681 | transport->cwnd, |
682 | transport->ssthresh, | 682 | transport->ssthresh, |
683 | transport->flight_size, | 683 | transport->flight_size, |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index c0714469233c..a7ba9e146dff 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -221,12 +221,12 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | |||
221 | void sctp_outq_teardown(struct sctp_outq *q) | 221 | void sctp_outq_teardown(struct sctp_outq *q) |
222 | { | 222 | { |
223 | struct sctp_transport *transport; | 223 | struct sctp_transport *transport; |
224 | struct list_head *lchunk, *pos, *temp; | 224 | struct list_head *lchunk, *temp; |
225 | struct sctp_chunk *chunk, *tmp; | 225 | struct sctp_chunk *chunk, *tmp; |
226 | 226 | ||
227 | /* Throw away unacknowledged chunks. */ | 227 | /* Throw away unacknowledged chunks. */ |
228 | list_for_each(pos, &q->asoc->peer.transport_addr_list) { | 228 | list_for_each_entry(transport, &q->asoc->peer.transport_addr_list, |
229 | transport = list_entry(pos, struct sctp_transport, transports); | 229 | transports) { |
230 | while ((lchunk = sctp_list_dequeue(&transport->transmitted)) != NULL) { | 230 | while ((lchunk = sctp_list_dequeue(&transport->transmitted)) != NULL) { |
231 | chunk = list_entry(lchunk, struct sctp_chunk, | 231 | chunk = list_entry(lchunk, struct sctp_chunk, |
232 | transmitted_list); | 232 | transmitted_list); |
@@ -469,7 +469,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
469 | 469 | ||
470 | SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, " | 470 | SCTP_DEBUG_PRINTK("%s: transport: %p, reason: %d, " |
471 | "cwnd: %d, ssthresh: %d, flight_size: %d, " | 471 | "cwnd: %d, ssthresh: %d, flight_size: %d, " |
472 | "pba: %d\n", __FUNCTION__, | 472 | "pba: %d\n", __func__, |
473 | transport, reason, | 473 | transport, reason, |
474 | transport->cwnd, transport->ssthresh, | 474 | transport->cwnd, transport->ssthresh, |
475 | transport->flight_size, | 475 | transport->flight_size, |
@@ -494,6 +494,8 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, | |||
494 | */ | 494 | */ |
495 | if (transport == transport->asoc->peer.retran_path) | 495 | if (transport == transport->asoc->peer.retran_path) |
496 | sctp_assoc_update_retran_path(transport->asoc); | 496 | sctp_assoc_update_retran_path(transport->asoc); |
497 | transport->asoc->rtx_data_chunks += | ||
498 | transport->asoc->unack_data; | ||
497 | break; | 499 | break; |
498 | case SCTP_RTXR_FAST_RTX: | 500 | case SCTP_RTXR_FAST_RTX: |
499 | SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); | 501 | SCTP_INC_STATS(SCTP_MIB_FAST_RETRANSMITS); |
@@ -504,6 +506,7 @@ void sctp_retransmit(struct sctp_outq *q, struct sctp_transport *transport, | |||
504 | break; | 506 | break; |
505 | case SCTP_RTXR_T1_RTX: | 507 | case SCTP_RTXR_T1_RTX: |
506 | SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS); | 508 | SCTP_INC_STATS(SCTP_MIB_T1_RETRANSMITS); |
509 | transport->asoc->init_retries++; | ||
507 | break; | 510 | break; |
508 | default: | 511 | default: |
509 | BUG(); | 512 | BUG(); |
@@ -535,7 +538,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
535 | int rtx_timeout, int *start_timer) | 538 | int rtx_timeout, int *start_timer) |
536 | { | 539 | { |
537 | struct list_head *lqueue; | 540 | struct list_head *lqueue; |
538 | struct list_head *lchunk, *lchunk1; | 541 | struct list_head *lchunk; |
539 | struct sctp_transport *transport = pkt->transport; | 542 | struct sctp_transport *transport = pkt->transport; |
540 | sctp_xmit_t status; | 543 | sctp_xmit_t status; |
541 | struct sctp_chunk *chunk, *chunk1; | 544 | struct sctp_chunk *chunk, *chunk1; |
@@ -646,9 +649,7 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt, | |||
646 | * to be marked as ineligible for a subsequent fast retransmit. | 649 | * to be marked as ineligible for a subsequent fast retransmit. |
647 | */ | 650 | */ |
648 | if (rtx_timeout && !lchunk) { | 651 | if (rtx_timeout && !lchunk) { |
649 | list_for_each(lchunk1, lqueue) { | 652 | list_for_each_entry(chunk1, lqueue, transmitted_list) { |
650 | chunk1 = list_entry(lchunk1, struct sctp_chunk, | ||
651 | transmitted_list); | ||
652 | if (chunk1->fast_retransmit > 0) | 653 | if (chunk1->fast_retransmit > 0) |
653 | chunk1->fast_retransmit = -1; | 654 | chunk1->fast_retransmit = -1; |
654 | } | 655 | } |
@@ -1037,7 +1038,6 @@ static void sctp_sack_update_unack_data(struct sctp_association *assoc, | |||
1037 | static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, | 1038 | static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, |
1038 | struct sctp_association *asoc) | 1039 | struct sctp_association *asoc) |
1039 | { | 1040 | { |
1040 | struct list_head *ltransport, *lchunk; | ||
1041 | struct sctp_transport *transport; | 1041 | struct sctp_transport *transport; |
1042 | struct sctp_chunk *chunk; | 1042 | struct sctp_chunk *chunk; |
1043 | __u32 highest_new_tsn, tsn; | 1043 | __u32 highest_new_tsn, tsn; |
@@ -1045,12 +1045,9 @@ static __u32 sctp_highest_new_tsn(struct sctp_sackhdr *sack, | |||
1045 | 1045 | ||
1046 | highest_new_tsn = ntohl(sack->cum_tsn_ack); | 1046 | highest_new_tsn = ntohl(sack->cum_tsn_ack); |
1047 | 1047 | ||
1048 | list_for_each(ltransport, transport_list) { | 1048 | list_for_each_entry(transport, transport_list, transports) { |
1049 | transport = list_entry(ltransport, struct sctp_transport, | 1049 | list_for_each_entry(chunk, &transport->transmitted, |
1050 | transports); | 1050 | transmitted_list) { |
1051 | list_for_each(lchunk, &transport->transmitted) { | ||
1052 | chunk = list_entry(lchunk, struct sctp_chunk, | ||
1053 | transmitted_list); | ||
1054 | tsn = ntohl(chunk->subh.data_hdr->tsn); | 1051 | tsn = ntohl(chunk->subh.data_hdr->tsn); |
1055 | 1052 | ||
1056 | if (!chunk->tsn_gap_acked && | 1053 | if (!chunk->tsn_gap_acked && |
@@ -1073,7 +1070,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1073 | struct sctp_association *asoc = q->asoc; | 1070 | struct sctp_association *asoc = q->asoc; |
1074 | struct sctp_transport *transport; | 1071 | struct sctp_transport *transport; |
1075 | struct sctp_chunk *tchunk = NULL; | 1072 | struct sctp_chunk *tchunk = NULL; |
1076 | struct list_head *lchunk, *transport_list, *pos, *temp; | 1073 | struct list_head *lchunk, *transport_list, *temp; |
1077 | sctp_sack_variable_t *frags = sack->variable; | 1074 | sctp_sack_variable_t *frags = sack->variable; |
1078 | __u32 sack_ctsn, ctsn, tsn; | 1075 | __u32 sack_ctsn, ctsn, tsn; |
1079 | __u32 highest_tsn, highest_new_tsn; | 1076 | __u32 highest_tsn, highest_new_tsn; |
@@ -1099,9 +1096,8 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1099 | */ | 1096 | */ |
1100 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { | 1097 | if (TSN_lte(primary->cacc.next_tsn_at_change, sack_ctsn)) { |
1101 | primary->cacc.changeover_active = 0; | 1098 | primary->cacc.changeover_active = 0; |
1102 | list_for_each(pos, transport_list) { | 1099 | list_for_each_entry(transport, transport_list, |
1103 | transport = list_entry(pos, struct sctp_transport, | 1100 | transports) { |
1104 | transports); | ||
1105 | transport->cacc.cycling_changeover = 0; | 1101 | transport->cacc.cycling_changeover = 0; |
1106 | } | 1102 | } |
1107 | } | 1103 | } |
@@ -1116,9 +1112,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1116 | */ | 1112 | */ |
1117 | if (sack->num_gap_ack_blocks && | 1113 | if (sack->num_gap_ack_blocks && |
1118 | primary->cacc.changeover_active) { | 1114 | primary->cacc.changeover_active) { |
1119 | list_for_each(pos, transport_list) { | 1115 | list_for_each_entry(transport, transport_list, transports) { |
1120 | transport = list_entry(pos, struct sctp_transport, | ||
1121 | transports); | ||
1122 | transport->cacc.cacc_saw_newack = 0; | 1116 | transport->cacc.cacc_saw_newack = 0; |
1123 | } | 1117 | } |
1124 | } | 1118 | } |
@@ -1147,9 +1141,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1147 | * | 1141 | * |
1148 | * This is a MASSIVE candidate for optimization. | 1142 | * This is a MASSIVE candidate for optimization. |
1149 | */ | 1143 | */ |
1150 | list_for_each(pos, transport_list) { | 1144 | list_for_each_entry(transport, transport_list, transports) { |
1151 | transport = list_entry(pos, struct sctp_transport, | ||
1152 | transports); | ||
1153 | sctp_check_transmitted(q, &transport->transmitted, | 1145 | sctp_check_transmitted(q, &transport->transmitted, |
1154 | transport, sack, highest_new_tsn); | 1146 | transport, sack, highest_new_tsn); |
1155 | /* | 1147 | /* |
@@ -1161,9 +1153,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1161 | count_of_newacks ++; | 1153 | count_of_newacks ++; |
1162 | } | 1154 | } |
1163 | 1155 | ||
1164 | list_for_each(pos, transport_list) { | 1156 | list_for_each_entry(transport, transport_list, transports) { |
1165 | transport = list_entry(pos, struct sctp_transport, | ||
1166 | transports); | ||
1167 | sctp_mark_missing(q, &transport->transmitted, transport, | 1157 | sctp_mark_missing(q, &transport->transmitted, transport, |
1168 | highest_new_tsn, count_of_newacks); | 1158 | highest_new_tsn, count_of_newacks); |
1169 | } | 1159 | } |
@@ -1206,10 +1196,10 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1206 | sctp_generate_fwdtsn(q, sack_ctsn); | 1196 | sctp_generate_fwdtsn(q, sack_ctsn); |
1207 | 1197 | ||
1208 | SCTP_DEBUG_PRINTK("%s: sack Cumulative TSN Ack is 0x%x.\n", | 1198 | SCTP_DEBUG_PRINTK("%s: sack Cumulative TSN Ack is 0x%x.\n", |
1209 | __FUNCTION__, sack_ctsn); | 1199 | __func__, sack_ctsn); |
1210 | SCTP_DEBUG_PRINTK("%s: Cumulative TSN Ack of association, " | 1200 | SCTP_DEBUG_PRINTK("%s: Cumulative TSN Ack of association, " |
1211 | "%p is 0x%x. Adv peer ack point: 0x%x\n", | 1201 | "%p is 0x%x. Adv peer ack point: 0x%x\n", |
1212 | __FUNCTION__, asoc, ctsn, asoc->adv_peer_ack_point); | 1202 | __func__, asoc, ctsn, asoc->adv_peer_ack_point); |
1213 | 1203 | ||
1214 | /* See if all chunks are acked. | 1204 | /* See if all chunks are acked. |
1215 | * Make sure the empty queue handler will get run later. | 1205 | * Make sure the empty queue handler will get run later. |
@@ -1220,9 +1210,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_sackhdr *sack) | |||
1220 | if (!q->empty) | 1210 | if (!q->empty) |
1221 | goto finish; | 1211 | goto finish; |
1222 | 1212 | ||
1223 | list_for_each(pos, transport_list) { | 1213 | list_for_each_entry(transport, transport_list, transports) { |
1224 | transport = list_entry(pos, struct sctp_transport, | ||
1225 | transports); | ||
1226 | q->empty = q->empty && list_empty(&transport->transmitted); | 1214 | q->empty = q->empty && list_empty(&transport->transmitted); |
1227 | if (!q->empty) | 1215 | if (!q->empty) |
1228 | goto finish; | 1216 | goto finish; |
@@ -1444,7 +1432,7 @@ static void sctp_check_transmitted(struct sctp_outq *q, | |||
1444 | if (tchunk->tsn_gap_acked) { | 1432 | if (tchunk->tsn_gap_acked) { |
1445 | SCTP_DEBUG_PRINTK("%s: Receiver reneged on " | 1433 | SCTP_DEBUG_PRINTK("%s: Receiver reneged on " |
1446 | "data TSN: 0x%x\n", | 1434 | "data TSN: 0x%x\n", |
1447 | __FUNCTION__, | 1435 | __func__, |
1448 | tsn); | 1436 | tsn); |
1449 | tchunk->tsn_gap_acked = 0; | 1437 | tchunk->tsn_gap_acked = 0; |
1450 | 1438 | ||
@@ -1561,7 +1549,7 @@ static void sctp_check_transmitted(struct sctp_outq *q, | |||
1561 | (sack_ctsn+2 == q->asoc->next_tsn)) { | 1549 | (sack_ctsn+2 == q->asoc->next_tsn)) { |
1562 | SCTP_DEBUG_PRINTK("%s: SACK received for zero " | 1550 | SCTP_DEBUG_PRINTK("%s: SACK received for zero " |
1563 | "window probe: %u\n", | 1551 | "window probe: %u\n", |
1564 | __FUNCTION__, sack_ctsn); | 1552 | __func__, sack_ctsn); |
1565 | q->asoc->overall_error_count = 0; | 1553 | q->asoc->overall_error_count = 0; |
1566 | transport->error_count = 0; | 1554 | transport->error_count = 0; |
1567 | } | 1555 | } |
@@ -1596,14 +1584,12 @@ static void sctp_mark_missing(struct sctp_outq *q, | |||
1596 | int count_of_newacks) | 1584 | int count_of_newacks) |
1597 | { | 1585 | { |
1598 | struct sctp_chunk *chunk; | 1586 | struct sctp_chunk *chunk; |
1599 | struct list_head *pos; | ||
1600 | __u32 tsn; | 1587 | __u32 tsn; |
1601 | char do_fast_retransmit = 0; | 1588 | char do_fast_retransmit = 0; |
1602 | struct sctp_transport *primary = q->asoc->peer.primary_path; | 1589 | struct sctp_transport *primary = q->asoc->peer.primary_path; |
1603 | 1590 | ||
1604 | list_for_each(pos, transmitted_queue) { | 1591 | list_for_each_entry(chunk, transmitted_queue, transmitted_list) { |
1605 | 1592 | ||
1606 | chunk = list_entry(pos, struct sctp_chunk, transmitted_list); | ||
1607 | tsn = ntohl(chunk->subh.data_hdr->tsn); | 1593 | tsn = ntohl(chunk->subh.data_hdr->tsn); |
1608 | 1594 | ||
1609 | /* RFC 2960 7.2.4, sctpimpguide-05 2.8.2 M3) Examine all | 1595 | /* RFC 2960 7.2.4, sctpimpguide-05 2.8.2 M3) Examine all |
@@ -1626,7 +1612,7 @@ static void sctp_mark_missing(struct sctp_outq *q, | |||
1626 | 1612 | ||
1627 | SCTP_DEBUG_PRINTK( | 1613 | SCTP_DEBUG_PRINTK( |
1628 | "%s: TSN 0x%x missing counter: %d\n", | 1614 | "%s: TSN 0x%x missing counter: %d\n", |
1629 | __FUNCTION__, tsn, | 1615 | __func__, tsn, |
1630 | chunk->tsn_missing_report); | 1616 | chunk->tsn_missing_report); |
1631 | } | 1617 | } |
1632 | } | 1618 | } |
@@ -1649,7 +1635,7 @@ static void sctp_mark_missing(struct sctp_outq *q, | |||
1649 | 1635 | ||
1650 | SCTP_DEBUG_PRINTK("%s: transport: %p, cwnd: %d, " | 1636 | SCTP_DEBUG_PRINTK("%s: transport: %p, cwnd: %d, " |
1651 | "ssthresh: %d, flight_size: %d, pba: %d\n", | 1637 | "ssthresh: %d, flight_size: %d, pba: %d\n", |
1652 | __FUNCTION__, transport, transport->cwnd, | 1638 | __func__, transport, transport->cwnd, |
1653 | transport->ssthresh, transport->flight_size, | 1639 | transport->ssthresh, transport->flight_size, |
1654 | transport->partial_bytes_acked); | 1640 | transport->partial_bytes_acked); |
1655 | } | 1641 | } |
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index 973f1dbc2ec3..0aba759cb9b7 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -124,7 +124,6 @@ void sctp_snmp_proc_exit(void) | |||
124 | /* Dump local addresses of an association/endpoint. */ | 124 | /* Dump local addresses of an association/endpoint. */ |
125 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) | 125 | static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb) |
126 | { | 126 | { |
127 | struct list_head *pos; | ||
128 | struct sctp_association *asoc; | 127 | struct sctp_association *asoc; |
129 | struct sctp_sockaddr_entry *laddr; | 128 | struct sctp_sockaddr_entry *laddr; |
130 | struct sctp_transport *peer; | 129 | struct sctp_transport *peer; |
@@ -137,8 +136,7 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo | |||
137 | primary = &peer->saddr; | 136 | primary = &peer->saddr; |
138 | } | 137 | } |
139 | 138 | ||
140 | list_for_each(pos, &epb->bind_addr.address_list) { | 139 | list_for_each_entry(laddr, &epb->bind_addr.address_list, list) { |
141 | laddr = list_entry(pos, struct sctp_sockaddr_entry, list); | ||
142 | addr = &laddr->a; | 140 | addr = &laddr->a; |
143 | af = sctp_get_af_specific(addr->sa.sa_family); | 141 | af = sctp_get_af_specific(addr->sa.sa_family); |
144 | if (primary && af->cmp_addr(addr, primary)) { | 142 | if (primary && af->cmp_addr(addr, primary)) { |
@@ -151,14 +149,13 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo | |||
151 | /* Dump remote addresses of an association. */ | 149 | /* Dump remote addresses of an association. */ |
152 | static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_association *assoc) | 150 | static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_association *assoc) |
153 | { | 151 | { |
154 | struct list_head *pos; | ||
155 | struct sctp_transport *transport; | 152 | struct sctp_transport *transport; |
156 | union sctp_addr *addr, *primary; | 153 | union sctp_addr *addr, *primary; |
157 | struct sctp_af *af; | 154 | struct sctp_af *af; |
158 | 155 | ||
159 | primary = &assoc->peer.primary_addr; | 156 | primary = &assoc->peer.primary_addr; |
160 | list_for_each(pos, &assoc->peer.transport_addr_list) { | 157 | list_for_each_entry(transport, &assoc->peer.transport_addr_list, |
161 | transport = list_entry(pos, struct sctp_transport, transports); | 158 | transports) { |
162 | addr = &transport->ipaddr; | 159 | addr = &transport->ipaddr; |
163 | af = sctp_get_af_specific(addr->sa.sa_family); | 160 | af = sctp_get_af_specific(addr->sa.sa_family); |
164 | if (af->cmp_addr(addr, primary)) { | 161 | if (af->cmp_addr(addr, primary)) { |
@@ -279,8 +276,10 @@ static void * sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos) | |||
279 | *pos = 0; | 276 | *pos = 0; |
280 | 277 | ||
281 | if (*pos == 0) | 278 | if (*pos == 0) |
282 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " | 279 | seq_printf(seq, " ASSOC SOCK STY SST ST HBKT " |
283 | "RPORT LADDRS <-> RADDRS\n"); | 280 | "ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT " |
281 | "RPORT LADDRS <-> RADDRS " | ||
282 | "HBINT INS OUTS MAXRT T1X T2X RTXC\n"); | ||
284 | 283 | ||
285 | return (void *)pos; | 284 | return (void *)pos; |
286 | } | 285 | } |
@@ -319,19 +318,25 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) | |||
319 | assoc = sctp_assoc(epb); | 318 | assoc = sctp_assoc(epb); |
320 | sk = epb->sk; | 319 | sk = epb->sk; |
321 | seq_printf(seq, | 320 | seq_printf(seq, |
322 | "%8p %8p %-3d %-3d %-2d %-4d %4d %8d %8d %7d %5lu %-5d %5d ", | 321 | "%8p %8p %-3d %-3d %-2d %-4d " |
322 | "%4d %8d %8d %7d %5lu %-5d %5d ", | ||
323 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, | 323 | assoc, sk, sctp_sk(sk)->type, sk->sk_state, |
324 | assoc->state, hash, assoc->assoc_id, | 324 | assoc->state, hash, |
325 | assoc->assoc_id, | ||
325 | assoc->sndbuf_used, | 326 | assoc->sndbuf_used, |
326 | atomic_read(&assoc->rmem_alloc), | 327 | atomic_read(&assoc->rmem_alloc), |
327 | sock_i_uid(sk), sock_i_ino(sk), | 328 | sock_i_uid(sk), sock_i_ino(sk), |
328 | epb->bind_addr.port, | 329 | epb->bind_addr.port, |
329 | assoc->peer.port); | 330 | assoc->peer.port); |
330 | |||
331 | seq_printf(seq, " "); | 331 | seq_printf(seq, " "); |
332 | sctp_seq_dump_local_addrs(seq, epb); | 332 | sctp_seq_dump_local_addrs(seq, epb); |
333 | seq_printf(seq, "<-> "); | 333 | seq_printf(seq, "<-> "); |
334 | sctp_seq_dump_remote_addrs(seq, assoc); | 334 | sctp_seq_dump_remote_addrs(seq, assoc); |
335 | seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d ", | ||
336 | assoc->hbinterval, assoc->c.sinit_max_instreams, | ||
337 | assoc->c.sinit_num_ostreams, assoc->max_retrans, | ||
338 | assoc->init_retries, assoc->shutdown_retries, | ||
339 | assoc->rtx_data_chunks); | ||
335 | seq_printf(seq, "\n"); | 340 | seq_printf(seq, "\n"); |
336 | } | 341 | } |
337 | read_unlock(&head->lock); | 342 | read_unlock(&head->lock); |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index c2dd65d9f38d..0ec234b762c2 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -74,7 +74,7 @@ DEFINE_SPINLOCK(sctp_assocs_id_lock); | |||
74 | * the Out-of-the-blue (OOTB) packets. A control sock will be created | 74 | * the Out-of-the-blue (OOTB) packets. A control sock will be created |
75 | * for this socket at the initialization time. | 75 | * for this socket at the initialization time. |
76 | */ | 76 | */ |
77 | static struct socket *sctp_ctl_socket; | 77 | static struct sock *sctp_ctl_sock; |
78 | 78 | ||
79 | static struct sctp_pf *sctp_pf_inet6_specific; | 79 | static struct sctp_pf *sctp_pf_inet6_specific; |
80 | static struct sctp_pf *sctp_pf_inet_specific; | 80 | static struct sctp_pf *sctp_pf_inet_specific; |
@@ -91,7 +91,7 @@ int sysctl_sctp_wmem[3]; | |||
91 | /* Return the address of the control sock. */ | 91 | /* Return the address of the control sock. */ |
92 | struct sock *sctp_get_ctl_sock(void) | 92 | struct sock *sctp_get_ctl_sock(void) |
93 | { | 93 | { |
94 | return sctp_ctl_socket->sk; | 94 | return sctp_ctl_sock; |
95 | } | 95 | } |
96 | 96 | ||
97 | /* Set up the proc fs entry for the SCTP protocol. */ | 97 | /* Set up the proc fs entry for the SCTP protocol. */ |
@@ -363,7 +363,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr, | |||
363 | return 0; | 363 | return 0; |
364 | 364 | ||
365 | /* Is this a broadcast address? */ | 365 | /* Is this a broadcast address? */ |
366 | if (skb && ((struct rtable *)skb->dst)->rt_flags & RTCF_BROADCAST) | 366 | if (skb && skb->rtable->rt_flags & RTCF_BROADCAST) |
367 | return 0; | 367 | return 0; |
368 | 368 | ||
369 | return 1; | 369 | return 1; |
@@ -451,7 +451,7 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc, | |||
451 | fl.fl4_src = saddr->v4.sin_addr.s_addr; | 451 | fl.fl4_src = saddr->v4.sin_addr.s_addr; |
452 | 452 | ||
453 | SCTP_DEBUG_PRINTK("%s: DST:%u.%u.%u.%u, SRC:%u.%u.%u.%u - ", | 453 | SCTP_DEBUG_PRINTK("%s: DST:%u.%u.%u.%u, SRC:%u.%u.%u.%u - ", |
454 | __FUNCTION__, NIPQUAD(fl.fl4_dst), | 454 | __func__, NIPQUAD(fl.fl4_dst), |
455 | NIPQUAD(fl.fl4_src)); | 455 | NIPQUAD(fl.fl4_src)); |
456 | 456 | ||
457 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 457 | if (!ip_route_output_key(&init_net, &rt, &fl)) { |
@@ -539,7 +539,7 @@ static void sctp_v4_get_saddr(struct sctp_association *asoc, | |||
539 | /* What interface did this skb arrive on? */ | 539 | /* What interface did this skb arrive on? */ |
540 | static int sctp_v4_skb_iif(const struct sk_buff *skb) | 540 | static int sctp_v4_skb_iif(const struct sk_buff *skb) |
541 | { | 541 | { |
542 | return ((struct rtable *)skb->dst)->rt_iif; | 542 | return skb->rtable->rt_iif; |
543 | } | 543 | } |
544 | 544 | ||
545 | /* Was this packet marked by Explicit Congestion Notification? */ | 545 | /* Was this packet marked by Explicit Congestion Notification? */ |
@@ -554,7 +554,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, | |||
554 | { | 554 | { |
555 | struct inet_sock *inet = inet_sk(sk); | 555 | struct inet_sock *inet = inet_sk(sk); |
556 | struct inet_sock *newinet; | 556 | struct inet_sock *newinet; |
557 | struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL, | 557 | struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, |
558 | sk->sk_prot); | 558 | sk->sk_prot); |
559 | 559 | ||
560 | if (!newsk) | 560 | if (!newsk) |
@@ -630,6 +630,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | |||
630 | struct sctp_sockaddr_entry *temp; | 630 | struct sctp_sockaddr_entry *temp; |
631 | int found = 0; | 631 | int found = 0; |
632 | 632 | ||
633 | if (dev_net(ifa->ifa_dev->dev) != &init_net) | ||
634 | return NOTIFY_DONE; | ||
635 | |||
633 | switch (ev) { | 636 | switch (ev) { |
634 | case NETDEV_UP: | 637 | case NETDEV_UP: |
635 | addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); | 638 | addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); |
@@ -679,16 +682,13 @@ static int sctp_ctl_sock_init(void) | |||
679 | else | 682 | else |
680 | family = PF_INET; | 683 | family = PF_INET; |
681 | 684 | ||
682 | err = sock_create_kern(family, SOCK_SEQPACKET, IPPROTO_SCTP, | 685 | err = inet_ctl_sock_create(&sctp_ctl_sock, family, |
683 | &sctp_ctl_socket); | 686 | SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); |
684 | if (err < 0) { | 687 | if (err < 0) { |
685 | printk(KERN_ERR | 688 | printk(KERN_ERR |
686 | "SCTP: Failed to create the SCTP control socket.\n"); | 689 | "SCTP: Failed to create the SCTP control socket.\n"); |
687 | return err; | 690 | return err; |
688 | } | 691 | } |
689 | sctp_ctl_socket->sk->sk_allocation = GFP_ATOMIC; | ||
690 | inet_sk(sctp_ctl_socket->sk)->uc_ttl = -1; | ||
691 | |||
692 | return 0; | 692 | return 0; |
693 | } | 693 | } |
694 | 694 | ||
@@ -828,9 +828,9 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
828 | { | 828 | { |
829 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " | 829 | SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " |
830 | "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", | 830 | "src:%u.%u.%u.%u, dst:%u.%u.%u.%u\n", |
831 | __FUNCTION__, skb, skb->len, | 831 | __func__, skb, skb->len, |
832 | NIPQUAD(((struct rtable *)skb->dst)->rt_src), | 832 | NIPQUAD(skb->rtable->rt_src), |
833 | NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); | 833 | NIPQUAD(skb->rtable->rt_dst)); |
834 | 834 | ||
835 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 835 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
836 | return ip_queue_xmit(skb, ipfragok); | 836 | return ip_queue_xmit(skb, ipfragok); |
@@ -974,24 +974,14 @@ int sctp_register_pf(struct sctp_pf *pf, sa_family_t family) | |||
974 | return 1; | 974 | return 1; |
975 | } | 975 | } |
976 | 976 | ||
977 | static int __init init_sctp_mibs(void) | 977 | static inline int init_sctp_mibs(void) |
978 | { | 978 | { |
979 | sctp_statistics[0] = alloc_percpu(struct sctp_mib); | 979 | return snmp_mib_init((void**)sctp_statistics, sizeof(struct sctp_mib)); |
980 | if (!sctp_statistics[0]) | ||
981 | return -ENOMEM; | ||
982 | sctp_statistics[1] = alloc_percpu(struct sctp_mib); | ||
983 | if (!sctp_statistics[1]) { | ||
984 | free_percpu(sctp_statistics[0]); | ||
985 | return -ENOMEM; | ||
986 | } | ||
987 | return 0; | ||
988 | |||
989 | } | 980 | } |
990 | 981 | ||
991 | static void cleanup_sctp_mibs(void) | 982 | static inline void cleanup_sctp_mibs(void) |
992 | { | 983 | { |
993 | free_percpu(sctp_statistics[0]); | 984 | snmp_mib_free((void**)sctp_statistics); |
994 | free_percpu(sctp_statistics[1]); | ||
995 | } | 985 | } |
996 | 986 | ||
997 | static void sctp_v4_pf_init(void) | 987 | static void sctp_v4_pf_init(void) |
@@ -1286,7 +1276,7 @@ err_v6_add_protocol: | |||
1286 | sctp_v6_del_protocol(); | 1276 | sctp_v6_del_protocol(); |
1287 | err_add_protocol: | 1277 | err_add_protocol: |
1288 | sctp_v4_del_protocol(); | 1278 | sctp_v4_del_protocol(); |
1289 | sock_release(sctp_ctl_socket); | 1279 | inet_ctl_sock_destroy(sctp_ctl_sock); |
1290 | err_ctl_sock_init: | 1280 | err_ctl_sock_init: |
1291 | sctp_v6_protosw_exit(); | 1281 | sctp_v6_protosw_exit(); |
1292 | err_v6_protosw_init: | 1282 | err_v6_protosw_init: |
@@ -1330,7 +1320,7 @@ SCTP_STATIC __exit void sctp_exit(void) | |||
1330 | sctp_v4_del_protocol(); | 1320 | sctp_v4_del_protocol(); |
1331 | 1321 | ||
1332 | /* Free the control endpoint. */ | 1322 | /* Free the control endpoint. */ |
1333 | sock_release(sctp_ctl_socket); | 1323 | inet_ctl_sock_destroy(sctp_ctl_sock); |
1334 | 1324 | ||
1335 | /* Free protosw registrations */ | 1325 | /* Free protosw registrations */ |
1336 | sctp_v6_protosw_exit(); | 1326 | sctp_v6_protosw_exit(); |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 36ebb392472e..81b606424e12 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1782,7 +1782,7 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc, | |||
1782 | const struct sctp_chunk *chunk, | 1782 | const struct sctp_chunk *chunk, |
1783 | struct sctp_chunk **errp) | 1783 | struct sctp_chunk **errp) |
1784 | { | 1784 | { |
1785 | char error[] = "The following parameter had invalid length:"; | 1785 | static const char error[] = "The following parameter had invalid length:"; |
1786 | size_t payload_len = WORD_ROUND(sizeof(error)) + | 1786 | size_t payload_len = WORD_ROUND(sizeof(error)) + |
1787 | sizeof(sctp_paramhdr_t); | 1787 | sizeof(sctp_paramhdr_t); |
1788 | 1788 | ||
@@ -2269,8 +2269,8 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid, | |||
2269 | * high (for example, implementations MAY use the size of the receiver | 2269 | * high (for example, implementations MAY use the size of the receiver |
2270 | * advertised window). | 2270 | * advertised window). |
2271 | */ | 2271 | */ |
2272 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 2272 | list_for_each_entry(transport, &asoc->peer.transport_addr_list, |
2273 | transport = list_entry(pos, struct sctp_transport, transports); | 2273 | transports) { |
2274 | transport->ssthresh = asoc->peer.i.a_rwnd; | 2274 | transport->ssthresh = asoc->peer.i.a_rwnd; |
2275 | } | 2275 | } |
2276 | 2276 | ||
@@ -3066,7 +3066,6 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, | |||
3066 | union sctp_addr addr; | 3066 | union sctp_addr addr; |
3067 | struct sctp_bind_addr *bp = &asoc->base.bind_addr; | 3067 | struct sctp_bind_addr *bp = &asoc->base.bind_addr; |
3068 | union sctp_addr_param *addr_param; | 3068 | union sctp_addr_param *addr_param; |
3069 | struct list_head *pos; | ||
3070 | struct sctp_transport *transport; | 3069 | struct sctp_transport *transport; |
3071 | struct sctp_sockaddr_entry *saddr; | 3070 | struct sctp_sockaddr_entry *saddr; |
3072 | int retval = 0; | 3071 | int retval = 0; |
@@ -3094,9 +3093,8 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, | |||
3094 | local_bh_disable(); | 3093 | local_bh_disable(); |
3095 | retval = sctp_del_bind_addr(bp, &addr); | 3094 | retval = sctp_del_bind_addr(bp, &addr); |
3096 | local_bh_enable(); | 3095 | local_bh_enable(); |
3097 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 3096 | list_for_each_entry(transport, &asoc->peer.transport_addr_list, |
3098 | transport = list_entry(pos, struct sctp_transport, | 3097 | transports) { |
3099 | transports); | ||
3100 | dst_release(transport->dst); | 3098 | dst_release(transport->dst); |
3101 | sctp_transport_route(transport, NULL, | 3099 | sctp_transport_route(transport, NULL, |
3102 | sctp_sk(asoc->base.sk)); | 3100 | sctp_sk(asoc->base.sk)); |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index a4763fd24fd8..23a9f1a95b7d 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -243,7 +243,7 @@ void sctp_generate_t3_rtx_event(unsigned long peer) | |||
243 | 243 | ||
244 | sctp_bh_lock_sock(asoc->base.sk); | 244 | sctp_bh_lock_sock(asoc->base.sk); |
245 | if (sock_owned_by_user(asoc->base.sk)) { | 245 | if (sock_owned_by_user(asoc->base.sk)) { |
246 | SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __FUNCTION__); | 246 | SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); |
247 | 247 | ||
248 | /* Try again later. */ | 248 | /* Try again later. */ |
249 | if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20))) | 249 | if (!mod_timer(&transport->T3_rtx_timer, jiffies + (HZ/20))) |
@@ -283,7 +283,7 @@ static void sctp_generate_timeout_event(struct sctp_association *asoc, | |||
283 | sctp_bh_lock_sock(asoc->base.sk); | 283 | sctp_bh_lock_sock(asoc->base.sk); |
284 | if (sock_owned_by_user(asoc->base.sk)) { | 284 | if (sock_owned_by_user(asoc->base.sk)) { |
285 | SCTP_DEBUG_PRINTK("%s:Sock is busy: timer %d\n", | 285 | SCTP_DEBUG_PRINTK("%s:Sock is busy: timer %d\n", |
286 | __FUNCTION__, | 286 | __func__, |
287 | timeout_type); | 287 | timeout_type); |
288 | 288 | ||
289 | /* Try again later. */ | 289 | /* Try again later. */ |
@@ -361,7 +361,7 @@ void sctp_generate_heartbeat_event(unsigned long data) | |||
361 | 361 | ||
362 | sctp_bh_lock_sock(asoc->base.sk); | 362 | sctp_bh_lock_sock(asoc->base.sk); |
363 | if (sock_owned_by_user(asoc->base.sk)) { | 363 | if (sock_owned_by_user(asoc->base.sk)) { |
364 | SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __FUNCTION__); | 364 | SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); |
365 | 365 | ||
366 | /* Try again later. */ | 366 | /* Try again later. */ |
367 | if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20))) | 367 | if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20))) |
@@ -545,14 +545,12 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds, | |||
545 | struct sctp_association *asoc) | 545 | struct sctp_association *asoc) |
546 | { | 546 | { |
547 | struct sctp_transport *t; | 547 | struct sctp_transport *t; |
548 | struct list_head *pos; | ||
549 | 548 | ||
550 | /* Start a heartbeat timer for each transport on the association. | 549 | /* Start a heartbeat timer for each transport on the association. |
551 | * hold a reference on the transport to make sure none of | 550 | * hold a reference on the transport to make sure none of |
552 | * the needed data structures go away. | 551 | * the needed data structures go away. |
553 | */ | 552 | */ |
554 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 553 | list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) { |
555 | t = list_entry(pos, struct sctp_transport, transports); | ||
556 | 554 | ||
557 | if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t))) | 555 | if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t))) |
558 | sctp_transport_hold(t); | 556 | sctp_transport_hold(t); |
@@ -563,12 +561,11 @@ static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds, | |||
563 | struct sctp_association *asoc) | 561 | struct sctp_association *asoc) |
564 | { | 562 | { |
565 | struct sctp_transport *t; | 563 | struct sctp_transport *t; |
566 | struct list_head *pos; | ||
567 | 564 | ||
568 | /* Stop all heartbeat timers. */ | 565 | /* Stop all heartbeat timers. */ |
569 | 566 | ||
570 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 567 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
571 | t = list_entry(pos, struct sctp_transport, transports); | 568 | transports) { |
572 | if (del_timer(&t->hb_timer)) | 569 | if (del_timer(&t->hb_timer)) |
573 | sctp_transport_put(t); | 570 | sctp_transport_put(t); |
574 | } | 571 | } |
@@ -579,10 +576,9 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds, | |||
579 | struct sctp_association *asoc) | 576 | struct sctp_association *asoc) |
580 | { | 577 | { |
581 | struct sctp_transport *t; | 578 | struct sctp_transport *t; |
582 | struct list_head *pos; | ||
583 | 579 | ||
584 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 580 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
585 | t = list_entry(pos, struct sctp_transport, transports); | 581 | transports) { |
586 | if (timer_pending(&t->T3_rtx_timer) && | 582 | if (timer_pending(&t->T3_rtx_timer) && |
587 | del_timer(&t->T3_rtx_timer)) { | 583 | del_timer(&t->T3_rtx_timer)) { |
588 | sctp_transport_put(t); | 584 | sctp_transport_put(t); |
@@ -593,7 +589,6 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds, | |||
593 | 589 | ||
594 | /* Helper function to update the heartbeat timer. */ | 590 | /* Helper function to update the heartbeat timer. */ |
595 | static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds, | 591 | static void sctp_cmd_hb_timer_update(sctp_cmd_seq_t *cmds, |
596 | struct sctp_association *asoc, | ||
597 | struct sctp_transport *t) | 592 | struct sctp_transport *t) |
598 | { | 593 | { |
599 | /* Update the heartbeat timer. */ | 594 | /* Update the heartbeat timer. */ |
@@ -1065,7 +1060,6 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1065 | struct sctp_chunk *new_obj; | 1060 | struct sctp_chunk *new_obj; |
1066 | struct sctp_chunk *chunk = NULL; | 1061 | struct sctp_chunk *chunk = NULL; |
1067 | struct sctp_packet *packet; | 1062 | struct sctp_packet *packet; |
1068 | struct list_head *pos; | ||
1069 | struct timer_list *timer; | 1063 | struct timer_list *timer; |
1070 | unsigned long timeout; | 1064 | unsigned long timeout; |
1071 | struct sctp_transport *t; | 1065 | struct sctp_transport *t; |
@@ -1397,9 +1391,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1397 | /* If we've sent any data bundled with | 1391 | /* If we've sent any data bundled with |
1398 | * COOKIE-ECHO we need to resend. | 1392 | * COOKIE-ECHO we need to resend. |
1399 | */ | 1393 | */ |
1400 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 1394 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
1401 | t = list_entry(pos, struct sctp_transport, | 1395 | transports) { |
1402 | transports); | ||
1403 | sctp_retransmit_mark(&asoc->outqueue, t, | 1396 | sctp_retransmit_mark(&asoc->outqueue, t, |
1404 | SCTP_RTXR_T1_RTX); | 1397 | SCTP_RTXR_T1_RTX); |
1405 | } | 1398 | } |
@@ -1457,7 +1450,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1457 | 1450 | ||
1458 | case SCTP_CMD_HB_TIMER_UPDATE: | 1451 | case SCTP_CMD_HB_TIMER_UPDATE: |
1459 | t = cmd->obj.transport; | 1452 | t = cmd->obj.transport; |
1460 | sctp_cmd_hb_timer_update(commands, asoc, t); | 1453 | sctp_cmd_hb_timer_update(commands, t); |
1461 | break; | 1454 | break; |
1462 | 1455 | ||
1463 | case SCTP_CMD_HB_TIMERS_STOP: | 1456 | case SCTP_CMD_HB_TIMERS_STOP: |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 07194c2a32df..0c9d5a6950fe 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1124,7 +1124,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, | |||
1124 | printk(KERN_WARNING | 1124 | printk(KERN_WARNING |
1125 | "%s association %p could not find address " | 1125 | "%s association %p could not find address " |
1126 | NIP6_FMT "\n", | 1126 | NIP6_FMT "\n", |
1127 | __FUNCTION__, | 1127 | __func__, |
1128 | asoc, | 1128 | asoc, |
1129 | NIP6(from_addr.v6.sin6_addr)); | 1129 | NIP6(from_addr.v6.sin6_addr)); |
1130 | } else { | 1130 | } else { |
@@ -1132,7 +1132,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, | |||
1132 | printk(KERN_WARNING | 1132 | printk(KERN_WARNING |
1133 | "%s association %p could not find address " | 1133 | "%s association %p could not find address " |
1134 | NIPQUAD_FMT "\n", | 1134 | NIPQUAD_FMT "\n", |
1135 | __FUNCTION__, | 1135 | __func__, |
1136 | asoc, | 1136 | asoc, |
1137 | NIPQUAD(from_addr.v4.sin_addr.s_addr)); | 1137 | NIPQUAD(from_addr.v4.sin_addr.s_addr)); |
1138 | } | 1138 | } |
@@ -1150,7 +1150,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, | |||
1150 | time_after(jiffies, hbinfo->sent_at + max_interval)) { | 1150 | time_after(jiffies, hbinfo->sent_at + max_interval)) { |
1151 | SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp " | 1151 | SCTP_DEBUG_PRINTK("%s: HEARTBEAT ACK with invalid timestamp " |
1152 | "received for transport: %p\n", | 1152 | "received for transport: %p\n", |
1153 | __FUNCTION__, link); | 1153 | __func__, link); |
1154 | return SCTP_DISPOSITION_DISCARD; | 1154 | return SCTP_DISPOSITION_DISCARD; |
1155 | } | 1155 | } |
1156 | 1156 | ||
@@ -1226,7 +1226,6 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, | |||
1226 | sctp_cmd_seq_t *commands) | 1226 | sctp_cmd_seq_t *commands) |
1227 | { | 1227 | { |
1228 | struct sctp_transport *new_addr, *addr; | 1228 | struct sctp_transport *new_addr, *addr; |
1229 | struct list_head *pos, *pos2; | ||
1230 | int found; | 1229 | int found; |
1231 | 1230 | ||
1232 | /* Implementor's Guide - Sectin 5.2.2 | 1231 | /* Implementor's Guide - Sectin 5.2.2 |
@@ -1243,12 +1242,11 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc, | |||
1243 | new_addr = NULL; | 1242 | new_addr = NULL; |
1244 | found = 0; | 1243 | found = 0; |
1245 | 1244 | ||
1246 | list_for_each(pos, &new_asoc->peer.transport_addr_list) { | 1245 | list_for_each_entry(new_addr, &new_asoc->peer.transport_addr_list, |
1247 | new_addr = list_entry(pos, struct sctp_transport, transports); | 1246 | transports) { |
1248 | found = 0; | 1247 | found = 0; |
1249 | list_for_each(pos2, &asoc->peer.transport_addr_list) { | 1248 | list_for_each_entry(addr, &asoc->peer.transport_addr_list, |
1250 | addr = list_entry(pos2, struct sctp_transport, | 1249 | transports) { |
1251 | transports); | ||
1252 | if (sctp_cmp_addr_exact(&new_addr->ipaddr, | 1250 | if (sctp_cmp_addr_exact(&new_addr->ipaddr, |
1253 | &addr->ipaddr)) { | 1251 | &addr->ipaddr)) { |
1254 | found = 1; | 1252 | found = 1; |
@@ -3135,12 +3133,8 @@ sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep, | |||
3135 | if (!ev) | 3133 | if (!ev) |
3136 | goto nomem; | 3134 | goto nomem; |
3137 | 3135 | ||
3138 | if (!sctp_add_cmd(commands, SCTP_CMD_EVENT_ULP, | 3136 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, |
3139 | SCTP_ULPEVENT(ev))) { | 3137 | SCTP_ULPEVENT(ev)); |
3140 | sctp_ulpevent_free(ev); | ||
3141 | goto nomem; | ||
3142 | } | ||
3143 | |||
3144 | sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR, | 3138 | sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR, |
3145 | SCTP_CHUNK(chunk)); | 3139 | SCTP_CHUNK(chunk)); |
3146 | } | 3140 | } |
@@ -3668,7 +3662,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, | |||
3668 | skb_pull(chunk->skb, len); | 3662 | skb_pull(chunk->skb, len); |
3669 | 3663 | ||
3670 | tsn = ntohl(fwdtsn_hdr->new_cum_tsn); | 3664 | tsn = ntohl(fwdtsn_hdr->new_cum_tsn); |
3671 | SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __FUNCTION__, tsn); | 3665 | SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __func__, tsn); |
3672 | 3666 | ||
3673 | /* The TSN is too high--silently discard the chunk and count on it | 3667 | /* The TSN is too high--silently discard the chunk and count on it |
3674 | * getting retransmitted later. | 3668 | * getting retransmitted later. |
@@ -3728,7 +3722,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( | |||
3728 | skb_pull(chunk->skb, len); | 3722 | skb_pull(chunk->skb, len); |
3729 | 3723 | ||
3730 | tsn = ntohl(fwdtsn_hdr->new_cum_tsn); | 3724 | tsn = ntohl(fwdtsn_hdr->new_cum_tsn); |
3731 | SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __FUNCTION__, tsn); | 3725 | SCTP_DEBUG_PRINTK("%s: TSN 0x%x.\n", __func__, tsn); |
3732 | 3726 | ||
3733 | /* The TSN is too high--silently discard the chunk and count on it | 3727 | /* The TSN is too high--silently discard the chunk and count on it |
3734 | * getting retransmitted later. | 3728 | * getting retransmitted later. |
@@ -4237,7 +4231,7 @@ static sctp_disposition_t sctp_sf_violation_chunklen( | |||
4237 | void *arg, | 4231 | void *arg, |
4238 | sctp_cmd_seq_t *commands) | 4232 | sctp_cmd_seq_t *commands) |
4239 | { | 4233 | { |
4240 | char err_str[]="The following chunk had invalid length:"; | 4234 | static const char err_str[]="The following chunk had invalid length:"; |
4241 | 4235 | ||
4242 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, | 4236 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, |
4243 | sizeof(err_str)); | 4237 | sizeof(err_str)); |
@@ -4254,7 +4248,7 @@ static sctp_disposition_t sctp_sf_violation_paramlen( | |||
4254 | const sctp_subtype_t type, | 4248 | const sctp_subtype_t type, |
4255 | void *arg, | 4249 | void *arg, |
4256 | sctp_cmd_seq_t *commands) { | 4250 | sctp_cmd_seq_t *commands) { |
4257 | char err_str[] = "The following parameter had invalid length:"; | 4251 | static const char err_str[] = "The following parameter had invalid length:"; |
4258 | 4252 | ||
4259 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, | 4253 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, |
4260 | sizeof(err_str)); | 4254 | sizeof(err_str)); |
@@ -4273,7 +4267,7 @@ static sctp_disposition_t sctp_sf_violation_ctsn( | |||
4273 | void *arg, | 4267 | void *arg, |
4274 | sctp_cmd_seq_t *commands) | 4268 | sctp_cmd_seq_t *commands) |
4275 | { | 4269 | { |
4276 | char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:"; | 4270 | static const char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:"; |
4277 | 4271 | ||
4278 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, | 4272 | return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, |
4279 | sizeof(err_str)); | 4273 | sizeof(err_str)); |
@@ -4292,7 +4286,7 @@ static sctp_disposition_t sctp_sf_violation_chunk( | |||
4292 | void *arg, | 4286 | void *arg, |
4293 | sctp_cmd_seq_t *commands) | 4287 | sctp_cmd_seq_t *commands) |
4294 | { | 4288 | { |
4295 | char err_str[]="The following chunk violates protocol:"; | 4289 | static const char err_str[]="The following chunk violates protocol:"; |
4296 | 4290 | ||
4297 | if (!asoc) | 4291 | if (!asoc) |
4298 | return sctp_sf_violation(ep, asoc, type, arg, commands); | 4292 | return sctp_sf_violation(ep, asoc, type, arg, commands); |
@@ -5331,6 +5325,8 @@ sctp_disposition_t sctp_sf_t2_timer_expire(const struct sctp_endpoint *ep, | |||
5331 | SCTP_DEBUG_PRINTK("Timer T2 expired.\n"); | 5325 | SCTP_DEBUG_PRINTK("Timer T2 expired.\n"); |
5332 | SCTP_INC_STATS(SCTP_MIB_T2_SHUTDOWN_EXPIREDS); | 5326 | SCTP_INC_STATS(SCTP_MIB_T2_SHUTDOWN_EXPIREDS); |
5333 | 5327 | ||
5328 | ((struct sctp_association *)asoc)->shutdown_retries++; | ||
5329 | |||
5334 | if (asoc->overall_error_count >= asoc->max_retrans) { | 5330 | if (asoc->overall_error_count >= asoc->max_retrans) { |
5335 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, | 5331 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, |
5336 | SCTP_ERROR(ETIMEDOUT)); | 5332 | SCTP_ERROR(ETIMEDOUT)); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 998e63a31311..e7e3baf7009e 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -513,7 +513,6 @@ static int sctp_send_asconf_add_ip(struct sock *sk, | |||
513 | union sctp_addr saveaddr; | 513 | union sctp_addr saveaddr; |
514 | void *addr_buf; | 514 | void *addr_buf; |
515 | struct sctp_af *af; | 515 | struct sctp_af *af; |
516 | struct list_head *pos; | ||
517 | struct list_head *p; | 516 | struct list_head *p; |
518 | int i; | 517 | int i; |
519 | int retval = 0; | 518 | int retval = 0; |
@@ -525,10 +524,9 @@ static int sctp_send_asconf_add_ip(struct sock *sk, | |||
525 | ep = sp->ep; | 524 | ep = sp->ep; |
526 | 525 | ||
527 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", | 526 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", |
528 | __FUNCTION__, sk, addrs, addrcnt); | 527 | __func__, sk, addrs, addrcnt); |
529 | 528 | ||
530 | list_for_each(pos, &ep->asocs) { | 529 | list_for_each_entry(asoc, &ep->asocs, asocs) { |
531 | asoc = list_entry(pos, struct sctp_association, asocs); | ||
532 | 530 | ||
533 | if (!asoc->peer.asconf_capable) | 531 | if (!asoc->peer.asconf_capable) |
534 | continue; | 532 | continue; |
@@ -699,7 +697,6 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
699 | union sctp_addr *laddr; | 697 | union sctp_addr *laddr; |
700 | void *addr_buf; | 698 | void *addr_buf; |
701 | struct sctp_af *af; | 699 | struct sctp_af *af; |
702 | struct list_head *pos, *pos1; | ||
703 | struct sctp_sockaddr_entry *saddr; | 700 | struct sctp_sockaddr_entry *saddr; |
704 | int i; | 701 | int i; |
705 | int retval = 0; | 702 | int retval = 0; |
@@ -711,10 +708,9 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
711 | ep = sp->ep; | 708 | ep = sp->ep; |
712 | 709 | ||
713 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", | 710 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", |
714 | __FUNCTION__, sk, addrs, addrcnt); | 711 | __func__, sk, addrs, addrcnt); |
715 | 712 | ||
716 | list_for_each(pos, &ep->asocs) { | 713 | list_for_each_entry(asoc, &ep->asocs, asocs) { |
717 | asoc = list_entry(pos, struct sctp_association, asocs); | ||
718 | 714 | ||
719 | if (!asoc->peer.asconf_capable) | 715 | if (!asoc->peer.asconf_capable) |
720 | continue; | 716 | continue; |
@@ -787,9 +783,8 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
787 | * as some of the addresses in the bind address list are | 783 | * as some of the addresses in the bind address list are |
788 | * about to be deleted and cannot be used as source addresses. | 784 | * about to be deleted and cannot be used as source addresses. |
789 | */ | 785 | */ |
790 | list_for_each(pos1, &asoc->peer.transport_addr_list) { | 786 | list_for_each_entry(transport, &asoc->peer.transport_addr_list, |
791 | transport = list_entry(pos1, struct sctp_transport, | 787 | transports) { |
792 | transports); | ||
793 | dst_release(transport->dst); | 788 | dst_release(transport->dst); |
794 | sctp_transport_route(transport, NULL, | 789 | sctp_transport_route(transport, NULL, |
795 | sctp_sk(asoc->base.sk)); | 790 | sctp_sk(asoc->base.sk)); |
@@ -1197,7 +1192,7 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk, | |||
1197 | struct sockaddr *kaddrs; | 1192 | struct sockaddr *kaddrs; |
1198 | 1193 | ||
1199 | SCTP_DEBUG_PRINTK("%s - sk %p addrs %p addrs_size %d\n", | 1194 | SCTP_DEBUG_PRINTK("%s - sk %p addrs %p addrs_size %d\n", |
1200 | __FUNCTION__, sk, addrs, addrs_size); | 1195 | __func__, sk, addrs, addrs_size); |
1201 | 1196 | ||
1202 | if (unlikely(addrs_size <= 0)) | 1197 | if (unlikely(addrs_size <= 0)) |
1203 | return -EINVAL; | 1198 | return -EINVAL; |
@@ -1397,7 +1392,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1397 | long timeo; | 1392 | long timeo; |
1398 | __u16 sinfo_flags = 0; | 1393 | __u16 sinfo_flags = 0; |
1399 | struct sctp_datamsg *datamsg; | 1394 | struct sctp_datamsg *datamsg; |
1400 | struct list_head *pos; | ||
1401 | int msg_flags = msg->msg_flags; | 1395 | int msg_flags = msg->msg_flags; |
1402 | 1396 | ||
1403 | SCTP_DEBUG_PRINTK("sctp_sendmsg(sk: %p, msg: %p, msg_len: %zu)\n", | 1397 | SCTP_DEBUG_PRINTK("sctp_sendmsg(sk: %p, msg: %p, msg_len: %zu)\n", |
@@ -1727,9 +1721,8 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1727 | } | 1721 | } |
1728 | 1722 | ||
1729 | /* Now send the (possibly) fragmented message. */ | 1723 | /* Now send the (possibly) fragmented message. */ |
1730 | list_for_each(pos, &datamsg->chunks) { | 1724 | list_for_each_entry(chunk, &datamsg->chunks, frag_list) { |
1731 | chunk = list_entry(pos, struct sctp_chunk, frag_list); | 1725 | sctp_chunk_hold(chunk); |
1732 | sctp_datamsg_track(chunk); | ||
1733 | 1726 | ||
1734 | /* Do accounting for the write space. */ | 1727 | /* Do accounting for the write space. */ |
1735 | sctp_set_owner_w(chunk); | 1728 | sctp_set_owner_w(chunk); |
@@ -1748,7 +1741,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1748 | SCTP_DEBUG_PRINTK("We sent primitively.\n"); | 1741 | SCTP_DEBUG_PRINTK("We sent primitively.\n"); |
1749 | } | 1742 | } |
1750 | 1743 | ||
1751 | sctp_datamsg_free(datamsg); | 1744 | sctp_datamsg_put(datamsg); |
1752 | if (err) | 1745 | if (err) |
1753 | goto out_free; | 1746 | goto out_free; |
1754 | else | 1747 | else |
@@ -2301,11 +2294,8 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, | |||
2301 | * transport. | 2294 | * transport. |
2302 | */ | 2295 | */ |
2303 | if (!trans && asoc) { | 2296 | if (!trans && asoc) { |
2304 | struct list_head *pos; | 2297 | list_for_each_entry(trans, &asoc->peer.transport_addr_list, |
2305 | 2298 | transports) { | |
2306 | list_for_each(pos, &asoc->peer.transport_addr_list) { | ||
2307 | trans = list_entry(pos, struct sctp_transport, | ||
2308 | transports); | ||
2309 | sctp_apply_peer_addr_params(¶ms, trans, asoc, sp, | 2299 | sctp_apply_peer_addr_params(¶ms, trans, asoc, sp, |
2310 | hb_change, pmtud_change, | 2300 | hb_change, pmtud_change, |
2311 | sackdelay_change); | 2301 | sackdelay_change); |
@@ -2396,11 +2386,8 @@ static int sctp_setsockopt_delayed_ack_time(struct sock *sk, | |||
2396 | 2386 | ||
2397 | /* If change is for association, also apply to each transport. */ | 2387 | /* If change is for association, also apply to each transport. */ |
2398 | if (asoc) { | 2388 | if (asoc) { |
2399 | struct list_head *pos; | 2389 | list_for_each_entry(trans, &asoc->peer.transport_addr_list, |
2400 | 2390 | transports) { | |
2401 | list_for_each(pos, &asoc->peer.transport_addr_list) { | ||
2402 | trans = list_entry(pos, struct sctp_transport, | ||
2403 | transports); | ||
2404 | if (params.assoc_value) { | 2391 | if (params.assoc_value) { |
2405 | trans->sackdelay = | 2392 | trans->sackdelay = |
2406 | msecs_to_jiffies(params.assoc_value); | 2393 | msecs_to_jiffies(params.assoc_value); |
@@ -2632,13 +2619,10 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int o | |||
2632 | if (assocparams.sasoc_asocmaxrxt != 0) { | 2619 | if (assocparams.sasoc_asocmaxrxt != 0) { |
2633 | __u32 path_sum = 0; | 2620 | __u32 path_sum = 0; |
2634 | int paths = 0; | 2621 | int paths = 0; |
2635 | struct list_head *pos; | ||
2636 | struct sctp_transport *peer_addr; | 2622 | struct sctp_transport *peer_addr; |
2637 | 2623 | ||
2638 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 2624 | list_for_each_entry(peer_addr, &asoc->peer.transport_addr_list, |
2639 | peer_addr = list_entry(pos, | 2625 | transports) { |
2640 | struct sctp_transport, | ||
2641 | transports); | ||
2642 | path_sum += peer_addr->pathmaxrxt; | 2626 | path_sum += peer_addr->pathmaxrxt; |
2643 | paths++; | 2627 | paths++; |
2644 | } | 2628 | } |
@@ -2716,7 +2700,6 @@ static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, int op | |||
2716 | static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optlen) | 2700 | static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optlen) |
2717 | { | 2701 | { |
2718 | struct sctp_association *asoc; | 2702 | struct sctp_association *asoc; |
2719 | struct list_head *pos; | ||
2720 | struct sctp_sock *sp = sctp_sk(sk); | 2703 | struct sctp_sock *sp = sctp_sk(sk); |
2721 | int val; | 2704 | int val; |
2722 | 2705 | ||
@@ -2729,8 +2712,7 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optl | |||
2729 | sp->user_frag = val; | 2712 | sp->user_frag = val; |
2730 | 2713 | ||
2731 | /* Update the frag_point of the existing associations. */ | 2714 | /* Update the frag_point of the existing associations. */ |
2732 | list_for_each(pos, &(sp->ep->asocs)) { | 2715 | list_for_each_entry(asoc, &(sp->ep->asocs), asocs) { |
2733 | asoc = list_entry(pos, struct sctp_association, asocs); | ||
2734 | asoc->frag_point = sctp_frag_point(sp, asoc->pathmtu); | 2716 | asoc->frag_point = sctp_frag_point(sp, asoc->pathmtu); |
2735 | } | 2717 | } |
2736 | 2718 | ||
@@ -3302,7 +3284,7 @@ SCTP_STATIC int sctp_connect(struct sock *sk, struct sockaddr *addr, | |||
3302 | sctp_lock_sock(sk); | 3284 | sctp_lock_sock(sk); |
3303 | 3285 | ||
3304 | SCTP_DEBUG_PRINTK("%s - sk: %p, sockaddr: %p, addr_len: %d\n", | 3286 | SCTP_DEBUG_PRINTK("%s - sk: %p, sockaddr: %p, addr_len: %d\n", |
3305 | __FUNCTION__, sk, addr, addr_len); | 3287 | __func__, sk, addr, addr_len); |
3306 | 3288 | ||
3307 | /* Validate addr_len before calling common connect/connectx routine. */ | 3289 | /* Validate addr_len before calling common connect/connectx routine. */ |
3308 | af = sctp_get_af_specific(addr->sa_family); | 3290 | af = sctp_get_af_specific(addr->sa_family); |
@@ -3823,7 +3805,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval | |||
3823 | goto out; | 3805 | goto out; |
3824 | } | 3806 | } |
3825 | 3807 | ||
3826 | SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p\n", __FUNCTION__, sk, asoc); | 3808 | SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p\n", __func__, sk, asoc); |
3827 | 3809 | ||
3828 | retval = sctp_do_peeloff(asoc, &newsock); | 3810 | retval = sctp_do_peeloff(asoc, &newsock); |
3829 | if (retval < 0) | 3811 | if (retval < 0) |
@@ -3837,7 +3819,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval | |||
3837 | } | 3819 | } |
3838 | 3820 | ||
3839 | SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p newsk: %p sd: %d\n", | 3821 | SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p newsk: %p sd: %d\n", |
3840 | __FUNCTION__, sk, asoc, newsock->sk, retval); | 3822 | __func__, sk, asoc, newsock->sk, retval); |
3841 | 3823 | ||
3842 | /* Return the fd mapped to the new socket. */ | 3824 | /* Return the fd mapped to the new socket. */ |
3843 | peeloff.sd = retval; | 3825 | peeloff.sd = retval; |
@@ -4151,7 +4133,6 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, | |||
4151 | int __user *optlen) | 4133 | int __user *optlen) |
4152 | { | 4134 | { |
4153 | struct sctp_association *asoc; | 4135 | struct sctp_association *asoc; |
4154 | struct list_head *pos; | ||
4155 | int cnt = 0; | 4136 | int cnt = 0; |
4156 | struct sctp_getaddrs_old getaddrs; | 4137 | struct sctp_getaddrs_old getaddrs; |
4157 | struct sctp_transport *from; | 4138 | struct sctp_transport *from; |
@@ -4176,8 +4157,8 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len, | |||
4176 | return -EINVAL; | 4157 | return -EINVAL; |
4177 | 4158 | ||
4178 | to = (void __user *)getaddrs.addrs; | 4159 | to = (void __user *)getaddrs.addrs; |
4179 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 4160 | list_for_each_entry(from, &asoc->peer.transport_addr_list, |
4180 | from = list_entry(pos, struct sctp_transport, transports); | 4161 | transports) { |
4181 | memcpy(&temp, &from->ipaddr, sizeof(temp)); | 4162 | memcpy(&temp, &from->ipaddr, sizeof(temp)); |
4182 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | 4163 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); |
4183 | addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; | 4164 | addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; |
@@ -4200,7 +4181,6 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, | |||
4200 | char __user *optval, int __user *optlen) | 4181 | char __user *optval, int __user *optlen) |
4201 | { | 4182 | { |
4202 | struct sctp_association *asoc; | 4183 | struct sctp_association *asoc; |
4203 | struct list_head *pos; | ||
4204 | int cnt = 0; | 4184 | int cnt = 0; |
4205 | struct sctp_getaddrs getaddrs; | 4185 | struct sctp_getaddrs getaddrs; |
4206 | struct sctp_transport *from; | 4186 | struct sctp_transport *from; |
@@ -4225,8 +4205,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, | |||
4225 | to = optval + offsetof(struct sctp_getaddrs,addrs); | 4205 | to = optval + offsetof(struct sctp_getaddrs,addrs); |
4226 | space_left = len - offsetof(struct sctp_getaddrs,addrs); | 4206 | space_left = len - offsetof(struct sctp_getaddrs,addrs); |
4227 | 4207 | ||
4228 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 4208 | list_for_each_entry(from, &asoc->peer.transport_addr_list, |
4229 | from = list_entry(pos, struct sctp_transport, transports); | 4209 | transports) { |
4230 | memcpy(&temp, &from->ipaddr, sizeof(temp)); | 4210 | memcpy(&temp, &from->ipaddr, sizeof(temp)); |
4231 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); | 4211 | sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); |
4232 | addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; | 4212 | addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; |
@@ -5761,8 +5741,8 @@ static struct sctp_bind_bucket *sctp_bucket_create( | |||
5761 | struct sctp_bind_bucket *pp; | 5741 | struct sctp_bind_bucket *pp; |
5762 | 5742 | ||
5763 | pp = kmem_cache_alloc(sctp_bucket_cachep, GFP_ATOMIC); | 5743 | pp = kmem_cache_alloc(sctp_bucket_cachep, GFP_ATOMIC); |
5764 | SCTP_DBG_OBJCNT_INC(bind_bucket); | ||
5765 | if (pp) { | 5744 | if (pp) { |
5745 | SCTP_DBG_OBJCNT_INC(bind_bucket); | ||
5766 | pp->port = snum; | 5746 | pp->port = snum; |
5767 | pp->fastreuse = 0; | 5747 | pp->fastreuse = 0; |
5768 | INIT_HLIST_HEAD(&pp->owner); | 5748 | INIT_HLIST_HEAD(&pp->owner); |
@@ -6194,11 +6174,9 @@ do_nonblock: | |||
6194 | void sctp_write_space(struct sock *sk) | 6174 | void sctp_write_space(struct sock *sk) |
6195 | { | 6175 | { |
6196 | struct sctp_association *asoc; | 6176 | struct sctp_association *asoc; |
6197 | struct list_head *pos; | ||
6198 | 6177 | ||
6199 | /* Wake up the tasks in each wait queue. */ | 6178 | /* Wake up the tasks in each wait queue. */ |
6200 | list_for_each(pos, &((sctp_sk(sk))->ep->asocs)) { | 6179 | list_for_each_entry(asoc, &((sctp_sk(sk))->ep->asocs), asocs) { |
6201 | asoc = list_entry(pos, struct sctp_association, asocs); | ||
6202 | __sctp_write_space(asoc); | 6180 | __sctp_write_space(asoc); |
6203 | } | 6181 | } |
6204 | } | 6182 | } |
@@ -6234,7 +6212,7 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) | |||
6234 | long current_timeo = *timeo_p; | 6212 | long current_timeo = *timeo_p; |
6235 | DEFINE_WAIT(wait); | 6213 | DEFINE_WAIT(wait); |
6236 | 6214 | ||
6237 | SCTP_DEBUG_PRINTK("%s: asoc=%p, timeo=%ld\n", __FUNCTION__, asoc, | 6215 | SCTP_DEBUG_PRINTK("%s: asoc=%p, timeo=%ld\n", __func__, asoc, |
6238 | (long)(*timeo_p)); | 6216 | (long)(*timeo_p)); |
6239 | 6217 | ||
6240 | /* Increment the association's refcnt. */ | 6218 | /* Increment the association's refcnt. */ |
@@ -6514,8 +6492,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
6514 | } | 6492 | } |
6515 | 6493 | ||
6516 | 6494 | ||
6517 | DEFINE_PROTO_INUSE(sctp) | ||
6518 | |||
6519 | /* This proto struct describes the ULP interface for SCTP. */ | 6495 | /* This proto struct describes the ULP interface for SCTP. */ |
6520 | struct proto sctp_prot = { | 6496 | struct proto sctp_prot = { |
6521 | .name = "SCTP", | 6497 | .name = "SCTP", |
@@ -6545,11 +6521,9 @@ struct proto sctp_prot = { | |||
6545 | .enter_memory_pressure = sctp_enter_memory_pressure, | 6521 | .enter_memory_pressure = sctp_enter_memory_pressure, |
6546 | .memory_allocated = &sctp_memory_allocated, | 6522 | .memory_allocated = &sctp_memory_allocated, |
6547 | .sockets_allocated = &sctp_sockets_allocated, | 6523 | .sockets_allocated = &sctp_sockets_allocated, |
6548 | REF_PROTO_INUSE(sctp) | ||
6549 | }; | 6524 | }; |
6550 | 6525 | ||
6551 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 6526 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
6552 | DEFINE_PROTO_INUSE(sctpv6) | ||
6553 | 6527 | ||
6554 | struct proto sctpv6_prot = { | 6528 | struct proto sctpv6_prot = { |
6555 | .name = "SCTPv6", | 6529 | .name = "SCTPv6", |
@@ -6579,6 +6553,5 @@ struct proto sctpv6_prot = { | |||
6579 | .enter_memory_pressure = sctp_enter_memory_pressure, | 6553 | .enter_memory_pressure = sctp_enter_memory_pressure, |
6580 | .memory_allocated = &sctp_memory_allocated, | 6554 | .memory_allocated = &sctp_memory_allocated, |
6581 | .sockets_allocated = &sctp_sockets_allocated, | 6555 | .sockets_allocated = &sctp_sockets_allocated, |
6582 | REF_PROTO_INUSE(sctpv6) | ||
6583 | }; | 6556 | }; |
6584 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 6557 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index d9f8af852b56..f4938f6c5abe 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -260,7 +260,7 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) | |||
260 | if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { | 260 | if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { |
261 | printk(KERN_WARNING "%s: Reported pmtu %d too low, " | 261 | printk(KERN_WARNING "%s: Reported pmtu %d too low, " |
262 | "using default minimum of %d\n", | 262 | "using default minimum of %d\n", |
263 | __FUNCTION__, pmtu, | 263 | __func__, pmtu, |
264 | SCTP_DEFAULT_MINSEGMENT); | 264 | SCTP_DEFAULT_MINSEGMENT); |
265 | /* Use default minimum segment size and disable | 265 | /* Use default minimum segment size and disable |
266 | * pmtu discovery on this transport. | 266 | * pmtu discovery on this transport. |
@@ -388,7 +388,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt) | |||
388 | tp->rto_pending = 0; | 388 | tp->rto_pending = 0; |
389 | 389 | ||
390 | SCTP_DEBUG_PRINTK("%s: transport: %p, rtt: %d, srtt: %d " | 390 | SCTP_DEBUG_PRINTK("%s: transport: %p, rtt: %d, srtt: %d " |
391 | "rttvar: %d, rto: %ld\n", __FUNCTION__, | 391 | "rttvar: %d, rto: %ld\n", __func__, |
392 | tp, rtt, tp->srtt, tp->rttvar, tp->rto); | 392 | tp, rtt, tp->srtt, tp->rttvar, tp->rto); |
393 | } | 393 | } |
394 | 394 | ||
@@ -434,7 +434,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport, | |||
434 | SCTP_DEBUG_PRINTK("%s: SLOW START: transport: %p, " | 434 | SCTP_DEBUG_PRINTK("%s: SLOW START: transport: %p, " |
435 | "bytes_acked: %d, cwnd: %d, ssthresh: %d, " | 435 | "bytes_acked: %d, cwnd: %d, ssthresh: %d, " |
436 | "flight_size: %d, pba: %d\n", | 436 | "flight_size: %d, pba: %d\n", |
437 | __FUNCTION__, | 437 | __func__, |
438 | transport, bytes_acked, cwnd, | 438 | transport, bytes_acked, cwnd, |
439 | ssthresh, flight_size, pba); | 439 | ssthresh, flight_size, pba); |
440 | } else { | 440 | } else { |
@@ -460,7 +460,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *transport, | |||
460 | SCTP_DEBUG_PRINTK("%s: CONGESTION AVOIDANCE: " | 460 | SCTP_DEBUG_PRINTK("%s: CONGESTION AVOIDANCE: " |
461 | "transport: %p, bytes_acked: %d, cwnd: %d, " | 461 | "transport: %p, bytes_acked: %d, cwnd: %d, " |
462 | "ssthresh: %d, flight_size: %d, pba: %d\n", | 462 | "ssthresh: %d, flight_size: %d, pba: %d\n", |
463 | __FUNCTION__, | 463 | __func__, |
464 | transport, bytes_acked, cwnd, | 464 | transport, bytes_acked, cwnd, |
465 | ssthresh, flight_size, pba); | 465 | ssthresh, flight_size, pba); |
466 | } | 466 | } |
@@ -546,7 +546,7 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport, | |||
546 | 546 | ||
547 | transport->partial_bytes_acked = 0; | 547 | transport->partial_bytes_acked = 0; |
548 | SCTP_DEBUG_PRINTK("%s: transport: %p reason: %d cwnd: " | 548 | SCTP_DEBUG_PRINTK("%s: transport: %p reason: %d cwnd: " |
549 | "%d ssthresh: %d\n", __FUNCTION__, | 549 | "%d ssthresh: %d\n", __func__, |
550 | transport, reason, | 550 | transport, reason, |
551 | transport->cwnd, transport->ssthresh); | 551 | transport->cwnd, transport->ssthresh); |
552 | } | 552 | } |