| @@ -1644,6 +1644,12 @@ static int sctp_sendmsg_parse(struct sock *sk, struct sctp_cmsgs *cmsgs, · 1643 unmodified lines |
| 1644 | srinfo->sinfo_assoc_id = cmsgs->sinfo->snd_assoc_id; | 1644 | srinfo->sinfo_assoc_id = cmsgs->sinfo->snd_assoc_id; |
| 1645 | } | 1645 | } |
| 1646 | | 1646 | |
| | 1647 | if (cmsgs->prinfo) { |
| | 1648 | srinfo->sinfo_timetolive = cmsgs->prinfo->pr_value; |
| | 1649 | SCTP_PR_SET_POLICY(srinfo->sinfo_flags, |
| | 1650 | cmsgs->prinfo->pr_policy); |
| | 1651 | } |
| | 1652 | |
| 1647 | sflags = srinfo->sinfo_flags; | 1653 | sflags = srinfo->sinfo_flags; |
| 1648 | if (!sflags && msg_len) | 1654 | if (!sflags && msg_len) |
| 1649 | return 0; | 1655 | return 0; |
| @@ -1901,9 +1907,12 @@ static void sctp_sendmsg_update_sinfo(struct sctp_association *asoc, · 251 unmodified lines |
| 1901 | sinfo->sinfo_ppid = asoc->default_ppid; | 1907 | sinfo->sinfo_ppid = asoc->default_ppid; |
| 1902 | sinfo->sinfo_context = asoc->default_context; | 1908 | sinfo->sinfo_context = asoc->default_context; |
| 1903 | sinfo->sinfo_assoc_id = sctp_assoc2id(asoc); | 1909 | sinfo->sinfo_assoc_id = sctp_assoc2id(asoc); |
| | 1910 | |
| | 1911 | if (!cmsgs->prinfo) |
| | 1912 | sinfo->sinfo_flags = asoc->default_flags; |
| 1904 | } | 1913 | } |
| 1905 | | 1914 | |
| 1906 | if (!cmsgs->srinfo) | 1915 | if (!cmsgs->srinfo && !cmsgs->prinfo) |
| 1907 | sinfo->sinfo_timetolive = asoc->default_timetolive; | 1916 | sinfo->sinfo_timetolive = asoc->default_timetolive; |
| 1908 | } | 1917 | } |
| 1909 | | 1918 | |
| @@ -7749,6 +7758,26 @@ static int sctp_msghdr_parse(const struct msghdr *msg, struct sctp_cmsgs *cmsgs) · 5839 unmodified lines |
| 7749 | SCTP_ABORT | SCTP_EOF)) | 7758 | SCTP_ABORT | SCTP_EOF)) |
| 7750 | return -EINVAL; | 7759 | return -EINVAL; |
| 7751 | break; | 7760 | break; |
| | 7761 | case SCTP_PRINFO: |
| | 7762 | /* SCTP Socket API Extension |
| | 7763 | * 5.3.7 SCTP PR-SCTP Information Structure (SCTP_PRINFO) |
| | 7764 | * |
| | 7765 | * This cmsghdr structure specifies SCTP options for sendmsg(). |
| | 7766 | * |
| | 7767 | * cmsg_level cmsg_type cmsg_data[] |
| | 7768 | * ------------ ------------ --------------------- |
| | 7769 | * IPPROTO_SCTP SCTP_PRINFO struct sctp_prinfo |
| | 7770 | */ |
| | 7771 | if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct sctp_prinfo))) |
| | 7772 | return -EINVAL; |
| | 7773 | |
| | 7774 | cmsgs->prinfo = CMSG_DATA(cmsg); |
| | 7775 | if (cmsgs->prinfo->pr_policy & ~SCTP_PR_SCTP_MASK) |
| | 7776 | return -EINVAL; |
| | 7777 | |
| | 7778 | if (cmsgs->prinfo->pr_policy == SCTP_PR_SCTP_NONE) |
| | 7779 | cmsgs->prinfo->pr_value = 0; |
| | 7780 | break; |
| 7752 | default: | 7781 | default: |
| 7753 | return -EINVAL; | 7782 | return -EINVAL; |
| 7754 | } | 7783 | } |