diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 168 |
1 files changed, 80 insertions, 88 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 66fcdcfe1b74..d5c6a2870473 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -281,8 +281,8 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len) | |||
281 | 281 | ||
282 | sctp_lock_sock(sk); | 282 | sctp_lock_sock(sk); |
283 | 283 | ||
284 | SCTP_DEBUG_PRINTK("sctp_bind(sk: %p, addr: %p, addr_len: %d)\n", | 284 | pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk, |
285 | sk, addr, addr_len); | 285 | addr, addr_len); |
286 | 286 | ||
287 | /* Disallow binding twice. */ | 287 | /* Disallow binding twice. */ |
288 | if (!sctp_sk(sk)->ep->base.bind_addr.port) | 288 | if (!sctp_sk(sk)->ep->base.bind_addr.port) |
@@ -342,19 +342,15 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
342 | /* Common sockaddr verification. */ | 342 | /* Common sockaddr verification. */ |
343 | af = sctp_sockaddr_af(sp, addr, len); | 343 | af = sctp_sockaddr_af(sp, addr, len); |
344 | if (!af) { | 344 | if (!af) { |
345 | SCTP_DEBUG_PRINTK("sctp_do_bind(sk: %p, newaddr: %p, len: %d) EINVAL\n", | 345 | pr_debug("%s: sk:%p, newaddr:%p, len:%d EINVAL\n", |
346 | sk, addr, len); | 346 | __func__, sk, addr, len); |
347 | return -EINVAL; | 347 | return -EINVAL; |
348 | } | 348 | } |
349 | 349 | ||
350 | snum = ntohs(addr->v4.sin_port); | 350 | snum = ntohs(addr->v4.sin_port); |
351 | 351 | ||
352 | SCTP_DEBUG_PRINTK_IPADDR("sctp_do_bind(sk: %p, new addr: ", | 352 | pr_debug("%s: sk:%p, new addr:%pISc, port:%d, new port:%d, len:%d\n", |
353 | ", port: %d, new port: %d, len: %d)\n", | 353 | __func__, sk, &addr->sa, bp->port, snum, len); |
354 | sk, | ||
355 | addr, | ||
356 | bp->port, snum, | ||
357 | len); | ||
358 | 354 | ||
359 | /* PF specific bind() address verification. */ | 355 | /* PF specific bind() address verification. */ |
360 | if (!sp->pf->bind_verify(sp, addr)) | 356 | if (!sp->pf->bind_verify(sp, addr)) |
@@ -368,9 +364,8 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) | |||
368 | if (!snum) | 364 | if (!snum) |
369 | snum = bp->port; | 365 | snum = bp->port; |
370 | else if (snum != bp->port) { | 366 | else if (snum != bp->port) { |
371 | SCTP_DEBUG_PRINTK("sctp_do_bind:" | 367 | pr_debug("%s: new port %d doesn't match existing port " |
372 | " New port %d does not match existing port " | 368 | "%d\n", __func__, snum, bp->port); |
373 | "%d.\n", snum, bp->port); | ||
374 | return -EINVAL; | 369 | return -EINVAL; |
375 | } | 370 | } |
376 | } | 371 | } |
@@ -468,8 +463,8 @@ static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
468 | struct sockaddr *sa_addr; | 463 | struct sockaddr *sa_addr; |
469 | struct sctp_af *af; | 464 | struct sctp_af *af; |
470 | 465 | ||
471 | SCTP_DEBUG_PRINTK("sctp_bindx_add (sk: %p, addrs: %p, addrcnt: %d)\n", | 466 | pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n", __func__, sk, |
472 | sk, addrs, addrcnt); | 467 | addrs, addrcnt); |
473 | 468 | ||
474 | addr_buf = addrs; | 469 | addr_buf = addrs; |
475 | for (cnt = 0; cnt < addrcnt; cnt++) { | 470 | for (cnt = 0; cnt < addrcnt; cnt++) { |
@@ -535,11 +530,10 @@ static int sctp_send_asconf_add_ip(struct sock *sk, | |||
535 | sp = sctp_sk(sk); | 530 | sp = sctp_sk(sk); |
536 | ep = sp->ep; | 531 | ep = sp->ep; |
537 | 532 | ||
538 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", | 533 | pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n", |
539 | __func__, sk, addrs, addrcnt); | 534 | __func__, sk, addrs, addrcnt); |
540 | 535 | ||
541 | list_for_each_entry(asoc, &ep->asocs, asocs) { | 536 | list_for_each_entry(asoc, &ep->asocs, asocs) { |
542 | |||
543 | if (!asoc->peer.asconf_capable) | 537 | if (!asoc->peer.asconf_capable) |
544 | continue; | 538 | continue; |
545 | 539 | ||
@@ -646,8 +640,8 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
646 | union sctp_addr *sa_addr; | 640 | union sctp_addr *sa_addr; |
647 | struct sctp_af *af; | 641 | struct sctp_af *af; |
648 | 642 | ||
649 | SCTP_DEBUG_PRINTK("sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n", | 643 | pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n", |
650 | sk, addrs, addrcnt); | 644 | __func__, sk, addrs, addrcnt); |
651 | 645 | ||
652 | addr_buf = addrs; | 646 | addr_buf = addrs; |
653 | for (cnt = 0; cnt < addrcnt; cnt++) { | 647 | for (cnt = 0; cnt < addrcnt; cnt++) { |
@@ -740,8 +734,8 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
740 | sp = sctp_sk(sk); | 734 | sp = sctp_sk(sk); |
741 | ep = sp->ep; | 735 | ep = sp->ep; |
742 | 736 | ||
743 | SCTP_DEBUG_PRINTK("%s: (sk: %p, addrs: %p, addrcnt: %d)\n", | 737 | pr_debug("%s: sk:%p, addrs:%p, addrcnt:%d\n", |
744 | __func__, sk, addrs, addrcnt); | 738 | __func__, sk, addrs, addrcnt); |
745 | 739 | ||
746 | list_for_each_entry(asoc, &ep->asocs, asocs) { | 740 | list_for_each_entry(asoc, &ep->asocs, asocs) { |
747 | 741 | ||
@@ -808,9 +802,11 @@ static int sctp_send_asconf_del_ip(struct sock *sk, | |||
808 | sin6 = (struct sockaddr_in6 *)addrs; | 802 | sin6 = (struct sockaddr_in6 *)addrs; |
809 | asoc->asconf_addr_del_pending->v6.sin6_addr = sin6->sin6_addr; | 803 | asoc->asconf_addr_del_pending->v6.sin6_addr = sin6->sin6_addr; |
810 | } | 804 | } |
811 | SCTP_DEBUG_PRINTK_IPADDR("send_asconf_del_ip: keep the last address asoc: %p ", | 805 | |
812 | " at %p\n", asoc, asoc->asconf_addr_del_pending, | 806 | pr_debug("%s: keep the last address asoc:%p %pISc at %p\n", |
813 | asoc->asconf_addr_del_pending); | 807 | __func__, asoc, &asoc->asconf_addr_del_pending->sa, |
808 | asoc->asconf_addr_del_pending); | ||
809 | |||
814 | asoc->src_out_of_asoc_ok = 1; | 810 | asoc->src_out_of_asoc_ok = 1; |
815 | stored = 1; | 811 | stored = 1; |
816 | goto skip_mkasconf; | 812 | goto skip_mkasconf; |
@@ -972,8 +968,8 @@ static int sctp_setsockopt_bindx(struct sock* sk, | |||
972 | void *addr_buf; | 968 | void *addr_buf; |
973 | struct sctp_af *af; | 969 | struct sctp_af *af; |
974 | 970 | ||
975 | SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p" | 971 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d opt:%d\n", |
976 | " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); | 972 | __func__, sk, addrs, addrs_size, op); |
977 | 973 | ||
978 | if (unlikely(addrs_size <= 0)) | 974 | if (unlikely(addrs_size <= 0)) |
979 | return -EINVAL; | 975 | return -EINVAL; |
@@ -1231,10 +1227,9 @@ static int __sctp_connect(struct sock* sk, | |||
1231 | asoc = NULL; | 1227 | asoc = NULL; |
1232 | 1228 | ||
1233 | out_free: | 1229 | out_free: |
1230 | pr_debug("%s: took out_free path with asoc:%p kaddrs:%p err:%d\n", | ||
1231 | __func__, asoc, kaddrs, err); | ||
1234 | 1232 | ||
1235 | SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p" | ||
1236 | " kaddrs: %p err: %d\n", | ||
1237 | asoc, kaddrs, err); | ||
1238 | if (asoc) { | 1233 | if (asoc) { |
1239 | /* sctp_primitive_ASSOCIATE may have added this association | 1234 | /* sctp_primitive_ASSOCIATE may have added this association |
1240 | * To the hash table, try to unhash it, just in case, its a noop | 1235 | * To the hash table, try to unhash it, just in case, its a noop |
@@ -1316,8 +1311,8 @@ static int __sctp_setsockopt_connectx(struct sock* sk, | |||
1316 | int err = 0; | 1311 | int err = 0; |
1317 | struct sockaddr *kaddrs; | 1312 | struct sockaddr *kaddrs; |
1318 | 1313 | ||
1319 | SCTP_DEBUG_PRINTK("%s - sk %p addrs %p addrs_size %d\n", | 1314 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", |
1320 | __func__, sk, addrs, addrs_size); | 1315 | __func__, sk, addrs, addrs_size); |
1321 | 1316 | ||
1322 | if (unlikely(addrs_size <= 0)) | 1317 | if (unlikely(addrs_size <= 0)) |
1323 | return -EINVAL; | 1318 | return -EINVAL; |
@@ -1468,7 +1463,7 @@ static void sctp_close(struct sock *sk, long timeout) | |||
1468 | struct list_head *pos, *temp; | 1463 | struct list_head *pos, *temp; |
1469 | unsigned int data_was_unread; | 1464 | unsigned int data_was_unread; |
1470 | 1465 | ||
1471 | SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout); | 1466 | pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout); |
1472 | 1467 | ||
1473 | sctp_lock_sock(sk); | 1468 | sctp_lock_sock(sk); |
1474 | sk->sk_shutdown = SHUTDOWN_MASK; | 1469 | sk->sk_shutdown = SHUTDOWN_MASK; |
@@ -1594,14 +1589,12 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1594 | struct sctp_datamsg *datamsg; | 1589 | struct sctp_datamsg *datamsg; |
1595 | int msg_flags = msg->msg_flags; | 1590 | int msg_flags = msg->msg_flags; |
1596 | 1591 | ||
1597 | SCTP_DEBUG_PRINTK("sctp_sendmsg(sk: %p, msg: %p, msg_len: %zu)\n", | ||
1598 | sk, msg, msg_len); | ||
1599 | |||
1600 | err = 0; | 1592 | err = 0; |
1601 | sp = sctp_sk(sk); | 1593 | sp = sctp_sk(sk); |
1602 | ep = sp->ep; | 1594 | ep = sp->ep; |
1603 | 1595 | ||
1604 | SCTP_DEBUG_PRINTK("Using endpoint: %p.\n", ep); | 1596 | pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk, |
1597 | msg, msg_len, ep); | ||
1605 | 1598 | ||
1606 | /* We cannot send a message over a TCP-style listening socket. */ | 1599 | /* We cannot send a message over a TCP-style listening socket. */ |
1607 | if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) { | 1600 | if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) { |
@@ -1611,9 +1604,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1611 | 1604 | ||
1612 | /* Parse out the SCTP CMSGs. */ | 1605 | /* Parse out the SCTP CMSGs. */ |
1613 | err = sctp_msghdr_parse(msg, &cmsgs); | 1606 | err = sctp_msghdr_parse(msg, &cmsgs); |
1614 | |||
1615 | if (err) { | 1607 | if (err) { |
1616 | SCTP_DEBUG_PRINTK("msghdr parse err = %x\n", err); | 1608 | pr_debug("%s: msghdr parse err:%x\n", __func__, err); |
1617 | goto out_nounlock; | 1609 | goto out_nounlock; |
1618 | } | 1610 | } |
1619 | 1611 | ||
@@ -1645,8 +1637,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1645 | associd = sinfo->sinfo_assoc_id; | 1637 | associd = sinfo->sinfo_assoc_id; |
1646 | } | 1638 | } |
1647 | 1639 | ||
1648 | SCTP_DEBUG_PRINTK("msg_len: %zu, sinfo_flags: 0x%x\n", | 1640 | pr_debug("%s: msg_len:%zu, sinfo_flags:0x%x\n", __func__, |
1649 | msg_len, sinfo_flags); | 1641 | msg_len, sinfo_flags); |
1650 | 1642 | ||
1651 | /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */ | 1643 | /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */ |
1652 | if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) { | 1644 | if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) { |
@@ -1675,7 +1667,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1675 | 1667 | ||
1676 | transport = NULL; | 1668 | transport = NULL; |
1677 | 1669 | ||
1678 | SCTP_DEBUG_PRINTK("About to look up association.\n"); | 1670 | pr_debug("%s: about to look up association\n", __func__); |
1679 | 1671 | ||
1680 | sctp_lock_sock(sk); | 1672 | sctp_lock_sock(sk); |
1681 | 1673 | ||
@@ -1705,7 +1697,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1705 | } | 1697 | } |
1706 | 1698 | ||
1707 | if (asoc) { | 1699 | if (asoc) { |
1708 | SCTP_DEBUG_PRINTK("Just looked up association: %p.\n", asoc); | 1700 | pr_debug("%s: just looked up association:%p\n", __func__, asoc); |
1709 | 1701 | ||
1710 | /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED | 1702 | /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED |
1711 | * socket that has an association in CLOSED state. This can | 1703 | * socket that has an association in CLOSED state. This can |
@@ -1718,8 +1710,9 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1718 | } | 1710 | } |
1719 | 1711 | ||
1720 | if (sinfo_flags & SCTP_EOF) { | 1712 | if (sinfo_flags & SCTP_EOF) { |
1721 | SCTP_DEBUG_PRINTK("Shutting down association: %p\n", | 1713 | pr_debug("%s: shutting down association:%p\n", |
1722 | asoc); | 1714 | __func__, asoc); |
1715 | |||
1723 | sctp_primitive_SHUTDOWN(net, asoc, NULL); | 1716 | sctp_primitive_SHUTDOWN(net, asoc, NULL); |
1724 | err = 0; | 1717 | err = 0; |
1725 | goto out_unlock; | 1718 | goto out_unlock; |
@@ -1732,7 +1725,9 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1732 | goto out_unlock; | 1725 | goto out_unlock; |
1733 | } | 1726 | } |
1734 | 1727 | ||
1735 | SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc); | 1728 | pr_debug("%s: aborting association:%p\n", |
1729 | __func__, asoc); | ||
1730 | |||
1736 | sctp_primitive_ABORT(net, asoc, chunk); | 1731 | sctp_primitive_ABORT(net, asoc, chunk); |
1737 | err = 0; | 1732 | err = 0; |
1738 | goto out_unlock; | 1733 | goto out_unlock; |
@@ -1741,7 +1736,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1741 | 1736 | ||
1742 | /* Do we need to create the association? */ | 1737 | /* Do we need to create the association? */ |
1743 | if (!asoc) { | 1738 | if (!asoc) { |
1744 | SCTP_DEBUG_PRINTK("There is no association yet.\n"); | 1739 | pr_debug("%s: there is no association yet\n", __func__); |
1745 | 1740 | ||
1746 | if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) { | 1741 | if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) { |
1747 | err = -EINVAL; | 1742 | err = -EINVAL; |
@@ -1840,7 +1835,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1840 | } | 1835 | } |
1841 | 1836 | ||
1842 | /* ASSERT: we have a valid association at this point. */ | 1837 | /* ASSERT: we have a valid association at this point. */ |
1843 | SCTP_DEBUG_PRINTK("We have a valid association.\n"); | 1838 | pr_debug("%s: we have a valid association\n", __func__); |
1844 | 1839 | ||
1845 | if (!sinfo) { | 1840 | if (!sinfo) { |
1846 | /* If the user didn't specify SNDRCVINFO, make up one with | 1841 | /* If the user didn't specify SNDRCVINFO, make up one with |
@@ -1909,7 +1904,8 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1909 | err = sctp_primitive_ASSOCIATE(net, asoc, NULL); | 1904 | err = sctp_primitive_ASSOCIATE(net, asoc, NULL); |
1910 | if (err < 0) | 1905 | if (err < 0) |
1911 | goto out_free; | 1906 | goto out_free; |
1912 | SCTP_DEBUG_PRINTK("We associated primitively.\n"); | 1907 | |
1908 | pr_debug("%s: we associated primitively\n", __func__); | ||
1913 | } | 1909 | } |
1914 | 1910 | ||
1915 | /* Break the message into multiple chunks of maximum size. */ | 1911 | /* Break the message into multiple chunks of maximum size. */ |
@@ -1936,17 +1932,15 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1936 | */ | 1932 | */ |
1937 | err = sctp_primitive_SEND(net, asoc, datamsg); | 1933 | err = sctp_primitive_SEND(net, asoc, datamsg); |
1938 | /* Did the lower layer accept the chunk? */ | 1934 | /* Did the lower layer accept the chunk? */ |
1939 | if (err) | 1935 | if (err) { |
1940 | sctp_datamsg_free(datamsg); | 1936 | sctp_datamsg_free(datamsg); |
1941 | else | 1937 | goto out_free; |
1942 | sctp_datamsg_put(datamsg); | 1938 | } |
1943 | 1939 | ||
1944 | SCTP_DEBUG_PRINTK("We sent primitively.\n"); | 1940 | pr_debug("%s: we sent primitively\n", __func__); |
1945 | 1941 | ||
1946 | if (err) | 1942 | sctp_datamsg_put(datamsg); |
1947 | goto out_free; | 1943 | err = msg_len; |
1948 | else | ||
1949 | err = msg_len; | ||
1950 | 1944 | ||
1951 | /* If we are already past ASSOCIATE, the lower | 1945 | /* If we are already past ASSOCIATE, the lower |
1952 | * layers are responsible for association cleanup. | 1946 | * layers are responsible for association cleanup. |
@@ -2041,10 +2035,9 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
2041 | int err = 0; | 2035 | int err = 0; |
2042 | int skb_len; | 2036 | int skb_len; |
2043 | 2037 | ||
2044 | SCTP_DEBUG_PRINTK("sctp_recvmsg(%s: %p, %s: %p, %s: %zd, %s: %d, %s: " | 2038 | pr_debug("%s: sk:%p, msghdr:%p, len:%zd, noblock:%d, flags:0x%x, " |
2045 | "0x%x, %s: %p)\n", "sk", sk, "msghdr", msg, | 2039 | "addr_len:%p)\n", __func__, sk, msg, len, noblock, flags, |
2046 | "len", len, "knoblauch", noblock, | 2040 | addr_len); |
2047 | "flags", flags, "addr_len", addr_len); | ||
2048 | 2041 | ||
2049 | sctp_lock_sock(sk); | 2042 | sctp_lock_sock(sk); |
2050 | 2043 | ||
@@ -3086,7 +3079,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva | |||
3086 | 3079 | ||
3087 | err = sctp_send_asconf(asoc, chunk); | 3080 | err = sctp_send_asconf(asoc, chunk); |
3088 | 3081 | ||
3089 | SCTP_DEBUG_PRINTK("We set peer primary addr primitively.\n"); | 3082 | pr_debug("%s: we set peer primary addr primitively\n", __func__); |
3090 | 3083 | ||
3091 | return err; | 3084 | return err; |
3092 | } | 3085 | } |
@@ -3561,8 +3554,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, | |||
3561 | { | 3554 | { |
3562 | int retval = 0; | 3555 | int retval = 0; |
3563 | 3556 | ||
3564 | SCTP_DEBUG_PRINTK("sctp_setsockopt(sk: %p... optname: %d)\n", | 3557 | pr_debug("%s: sk:%p, optname:%d\n", __func__, sk, optname); |
3565 | sk, optname); | ||
3566 | 3558 | ||
3567 | /* I can hardly begin to describe how wrong this is. This is | 3559 | /* I can hardly begin to describe how wrong this is. This is |
3568 | * so broken as to be worse than useless. The API draft | 3560 | * so broken as to be worse than useless. The API draft |
@@ -3724,8 +3716,8 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, | |||
3724 | 3716 | ||
3725 | sctp_lock_sock(sk); | 3717 | sctp_lock_sock(sk); |
3726 | 3718 | ||
3727 | SCTP_DEBUG_PRINTK("%s - sk: %p, sockaddr: %p, addr_len: %d\n", | 3719 | pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, |
3728 | __func__, sk, addr, addr_len); | 3720 | addr, addr_len); |
3729 | 3721 | ||
3730 | /* Validate addr_len before calling common connect/connectx routine. */ | 3722 | /* Validate addr_len before calling common connect/connectx routine. */ |
3731 | af = sctp_get_af_specific(addr->sa_family); | 3723 | af = sctp_get_af_specific(addr->sa_family); |
@@ -3855,7 +3847,7 @@ static int sctp_init_sock(struct sock *sk) | |||
3855 | struct net *net = sock_net(sk); | 3847 | struct net *net = sock_net(sk); |
3856 | struct sctp_sock *sp; | 3848 | struct sctp_sock *sp; |
3857 | 3849 | ||
3858 | SCTP_DEBUG_PRINTK("sctp_init_sock(sk: %p)\n", sk); | 3850 | pr_debug("%s: sk:%p\n", __func__, sk); |
3859 | 3851 | ||
3860 | sp = sctp_sk(sk); | 3852 | sp = sctp_sk(sk); |
3861 | 3853 | ||
@@ -3990,7 +3982,7 @@ static void sctp_destroy_sock(struct sock *sk) | |||
3990 | { | 3982 | { |
3991 | struct sctp_sock *sp; | 3983 | struct sctp_sock *sp; |
3992 | 3984 | ||
3993 | SCTP_DEBUG_PRINTK("sctp_destroy_sock(sk: %p)\n", sk); | 3985 | pr_debug("%s: sk:%p\n", __func__, sk); |
3994 | 3986 | ||
3995 | /* Release our hold on the endpoint. */ | 3987 | /* Release our hold on the endpoint. */ |
3996 | sp = sctp_sk(sk); | 3988 | sp = sctp_sk(sk); |
@@ -4123,9 +4115,9 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len, | |||
4123 | goto out; | 4115 | goto out; |
4124 | } | 4116 | } |
4125 | 4117 | ||
4126 | SCTP_DEBUG_PRINTK("sctp_getsockopt_sctp_status(%d): %d %d %d\n", | 4118 | pr_debug("%s: len:%d, state:%d, rwnd:%d, assoc_id:%d\n", |
4127 | len, status.sstat_state, status.sstat_rwnd, | 4119 | __func__, len, status.sstat_state, status.sstat_rwnd, |
4128 | status.sstat_assoc_id); | 4120 | status.sstat_assoc_id); |
4129 | 4121 | ||
4130 | if (copy_to_user(optval, &status, len)) { | 4122 | if (copy_to_user(optval, &status, len)) { |
4131 | retval = -EFAULT; | 4123 | retval = -EFAULT; |
@@ -4333,8 +4325,8 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval | |||
4333 | return PTR_ERR(newfile); | 4325 | return PTR_ERR(newfile); |
4334 | } | 4326 | } |
4335 | 4327 | ||
4336 | SCTP_DEBUG_PRINTK("%s: sk: %p newsk: %p sd: %d\n", | 4328 | pr_debug("%s: sk:%p, newsk:%p, sd:%d\n", __func__, sk, newsock->sk, |
4337 | __func__, sk, newsock->sk, retval); | 4329 | retval); |
4338 | 4330 | ||
4339 | /* Return the fd mapped to the new socket. */ | 4331 | /* Return the fd mapped to the new socket. */ |
4340 | if (put_user(len, optlen)) { | 4332 | if (put_user(len, optlen)) { |
@@ -4467,7 +4459,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len, | |||
4467 | trans = sctp_addr_id2transport(sk, ¶ms.spp_address, | 4459 | trans = sctp_addr_id2transport(sk, ¶ms.spp_address, |
4468 | params.spp_assoc_id); | 4460 | params.spp_assoc_id); |
4469 | if (!trans) { | 4461 | if (!trans) { |
4470 | SCTP_DEBUG_PRINTK("Failed no transport\n"); | 4462 | pr_debug("%s: failed no transport\n", __func__); |
4471 | return -EINVAL; | 4463 | return -EINVAL; |
4472 | } | 4464 | } |
4473 | } | 4465 | } |
@@ -4478,7 +4470,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len, | |||
4478 | */ | 4470 | */ |
4479 | asoc = sctp_id2assoc(sk, params.spp_assoc_id); | 4471 | asoc = sctp_id2assoc(sk, params.spp_assoc_id); |
4480 | if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) { | 4472 | if (!asoc && params.spp_assoc_id && sctp_style(sk, UDP)) { |
4481 | SCTP_DEBUG_PRINTK("Failed no association\n"); | 4473 | pr_debug("%s: failed no association\n", __func__); |
4482 | return -EINVAL; | 4474 | return -EINVAL; |
4483 | } | 4475 | } |
4484 | 4476 | ||
@@ -5698,8 +5690,7 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len, | |||
5698 | if (put_user(len, optlen)) | 5690 | if (put_user(len, optlen)) |
5699 | return -EFAULT; | 5691 | return -EFAULT; |
5700 | 5692 | ||
5701 | SCTP_DEBUG_PRINTK("sctp_getsockopt_assoc_stat(%d): %d\n", | 5693 | pr_debug("%s: len:%d, assoc_id:%d\n", __func__, len, sas.sas_assoc_id); |
5702 | len, sas.sas_assoc_id); | ||
5703 | 5694 | ||
5704 | if (copy_to_user(optval, &sas, len)) | 5695 | if (copy_to_user(optval, &sas, len)) |
5705 | return -EFAULT; | 5696 | return -EFAULT; |
@@ -5713,8 +5704,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, | |||
5713 | int retval = 0; | 5704 | int retval = 0; |
5714 | int len; | 5705 | int len; |
5715 | 5706 | ||
5716 | SCTP_DEBUG_PRINTK("sctp_getsockopt(sk: %p... optname: %d)\n", | 5707 | pr_debug("%s: sk:%p, optname:%d\n", __func__, sk, optname); |
5717 | sk, optname); | ||
5718 | 5708 | ||
5719 | /* I can hardly begin to describe how wrong this is. This is | 5709 | /* I can hardly begin to describe how wrong this is. This is |
5720 | * so broken as to be worse than useless. The API draft | 5710 | * so broken as to be worse than useless. The API draft |
@@ -5894,7 +5884,8 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) | |||
5894 | 5884 | ||
5895 | snum = ntohs(addr->v4.sin_port); | 5885 | snum = ntohs(addr->v4.sin_port); |
5896 | 5886 | ||
5897 | SCTP_DEBUG_PRINTK("sctp_get_port() begins, snum=%d\n", snum); | 5887 | pr_debug("%s: begins, snum:%d\n", __func__, snum); |
5888 | |||
5898 | sctp_local_bh_disable(); | 5889 | sctp_local_bh_disable(); |
5899 | 5890 | ||
5900 | if (snum == 0) { | 5891 | if (snum == 0) { |
@@ -5960,7 +5951,8 @@ pp_found: | |||
5960 | int reuse = sk->sk_reuse; | 5951 | int reuse = sk->sk_reuse; |
5961 | struct sock *sk2; | 5952 | struct sock *sk2; |
5962 | 5953 | ||
5963 | SCTP_DEBUG_PRINTK("sctp_get_port() found a possible match\n"); | 5954 | pr_debug("%s: found a possible match\n", __func__); |
5955 | |||
5964 | if (pp->fastreuse && sk->sk_reuse && | 5956 | if (pp->fastreuse && sk->sk_reuse && |
5965 | sk->sk_state != SCTP_SS_LISTENING) | 5957 | sk->sk_state != SCTP_SS_LISTENING) |
5966 | goto success; | 5958 | goto success; |
@@ -5990,7 +5982,8 @@ pp_found: | |||
5990 | goto fail_unlock; | 5982 | goto fail_unlock; |
5991 | } | 5983 | } |
5992 | } | 5984 | } |
5993 | SCTP_DEBUG_PRINTK("sctp_get_port(): Found a match\n"); | 5985 | |
5986 | pr_debug("%s: found a match\n", __func__); | ||
5994 | } | 5987 | } |
5995 | pp_not_found: | 5988 | pp_not_found: |
5996 | /* If there was a hash table miss, create a new port. */ | 5989 | /* If there was a hash table miss, create a new port. */ |
@@ -6479,8 +6472,8 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, | |||
6479 | 6472 | ||
6480 | timeo = sock_rcvtimeo(sk, noblock); | 6473 | timeo = sock_rcvtimeo(sk, noblock); |
6481 | 6474 | ||
6482 | SCTP_DEBUG_PRINTK("Timeout: timeo: %ld, MAX: %ld.\n", | 6475 | pr_debug("%s: timeo:%ld, max:%ld\n", __func__, timeo, |
6483 | timeo, MAX_SCHEDULE_TIMEOUT); | 6476 | MAX_SCHEDULE_TIMEOUT); |
6484 | 6477 | ||
6485 | do { | 6478 | do { |
6486 | /* Again only user level code calls this function, | 6479 | /* Again only user level code calls this function, |
@@ -6611,8 +6604,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | |||
6611 | long current_timeo = *timeo_p; | 6604 | long current_timeo = *timeo_p; |
6612 | DEFINE_WAIT(wait); | 6605 | DEFINE_WAIT(wait); |
6613 | 6606 | ||
6614 | SCTP_DEBUG_PRINTK("wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%zu\n", | 6607 | pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc, |
6615 | asoc, (long)(*timeo_p), msg_len); | 6608 | *timeo_p, msg_len); |
6616 | 6609 | ||
6617 | /* Increment the association's refcnt. */ | 6610 | /* Increment the association's refcnt. */ |
6618 | sctp_association_hold(asoc); | 6611 | sctp_association_hold(asoc); |
@@ -6718,8 +6711,7 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) | |||
6718 | long current_timeo = *timeo_p; | 6711 | long current_timeo = *timeo_p; |
6719 | DEFINE_WAIT(wait); | 6712 | DEFINE_WAIT(wait); |
6720 | 6713 | ||
6721 | SCTP_DEBUG_PRINTK("%s: asoc=%p, timeo=%ld\n", __func__, asoc, | 6714 | pr_debug("%s: asoc:%p, timeo:%ld\n", __func__, asoc, *timeo_p); |
6722 | (long)(*timeo_p)); | ||
6723 | 6715 | ||
6724 | /* Increment the association's refcnt. */ | 6716 | /* Increment the association's refcnt. */ |
6725 | sctp_association_hold(asoc); | 6717 | sctp_association_hold(asoc); |