diff options
author | James Morris <james.l.morris@oracle.com> | 2014-11-19 05:32:12 -0500 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2014-11-19 05:32:12 -0500 |
commit | b10778a00d40b3d9fdaaf5891e802794781ff71c (patch) | |
tree | 6ba4cbac86eecedc3f30650e7f764ecf00c83898 /net/sctp/ulpevent.c | |
parent | 594081ee7145cc30a3977cb4e218f81213b63dc5 (diff) | |
parent | bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff) |
Merge commit 'v3.17' into next
Diffstat (limited to 'net/sctp/ulpevent.c')
-rw-r--r-- | net/sctp/ulpevent.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index b6842fdb53d4..d1e38308f615 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -341,7 +341,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( | |||
341 | memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage)); | 341 | memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage)); |
342 | 342 | ||
343 | /* Map ipv4 address into v4-mapped-on-v6 address. */ | 343 | /* Map ipv4 address into v4-mapped-on-v6 address. */ |
344 | sctp_get_pf_specific(asoc->base.sk->sk_family)->addr_v4map( | 344 | sctp_get_pf_specific(asoc->base.sk->sk_family)->addr_to_user( |
345 | sctp_sk(asoc->base.sk), | 345 | sctp_sk(asoc->base.sk), |
346 | (union sctp_addr *)&spc->spc_aaddr); | 346 | (union sctp_addr *)&spc->spc_aaddr); |
347 | 347 | ||
@@ -886,6 +886,69 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | |||
886 | sizeof(sinfo), &sinfo); | 886 | sizeof(sinfo), &sinfo); |
887 | } | 887 | } |
888 | 888 | ||
889 | /* RFC6458, Section 5.3.5 SCTP Receive Information Structure | ||
890 | * (SCTP_SNDRCV) | ||
891 | */ | ||
892 | void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event, | ||
893 | struct msghdr *msghdr) | ||
894 | { | ||
895 | struct sctp_rcvinfo rinfo; | ||
896 | |||
897 | if (sctp_ulpevent_is_notification(event)) | ||
898 | return; | ||
899 | |||
900 | memset(&rinfo, 0, sizeof(struct sctp_rcvinfo)); | ||
901 | rinfo.rcv_sid = event->stream; | ||
902 | rinfo.rcv_ssn = event->ssn; | ||
903 | rinfo.rcv_ppid = event->ppid; | ||
904 | rinfo.rcv_flags = event->flags; | ||
905 | rinfo.rcv_tsn = event->tsn; | ||
906 | rinfo.rcv_cumtsn = event->cumtsn; | ||
907 | rinfo.rcv_assoc_id = sctp_assoc2id(event->asoc); | ||
908 | rinfo.rcv_context = event->asoc->default_rcv_context; | ||
909 | |||
910 | put_cmsg(msghdr, IPPROTO_SCTP, SCTP_RCVINFO, | ||
911 | sizeof(rinfo), &rinfo); | ||
912 | } | ||
913 | |||
914 | /* RFC6458, Section 5.3.6. SCTP Next Receive Information Structure | ||
915 | * (SCTP_NXTINFO) | ||
916 | */ | ||
917 | static void __sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event, | ||
918 | struct msghdr *msghdr, | ||
919 | const struct sk_buff *skb) | ||
920 | { | ||
921 | struct sctp_nxtinfo nxtinfo; | ||
922 | |||
923 | memset(&nxtinfo, 0, sizeof(nxtinfo)); | ||
924 | nxtinfo.nxt_sid = event->stream; | ||
925 | nxtinfo.nxt_ppid = event->ppid; | ||
926 | nxtinfo.nxt_flags = event->flags; | ||
927 | if (sctp_ulpevent_is_notification(event)) | ||
928 | nxtinfo.nxt_flags |= SCTP_NOTIFICATION; | ||
929 | nxtinfo.nxt_length = skb->len; | ||
930 | nxtinfo.nxt_assoc_id = sctp_assoc2id(event->asoc); | ||
931 | |||
932 | put_cmsg(msghdr, IPPROTO_SCTP, SCTP_NXTINFO, | ||
933 | sizeof(nxtinfo), &nxtinfo); | ||
934 | } | ||
935 | |||
936 | void sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event, | ||
937 | struct msghdr *msghdr, | ||
938 | struct sock *sk) | ||
939 | { | ||
940 | struct sk_buff *skb; | ||
941 | int err; | ||
942 | |||
943 | skb = sctp_skb_recv_datagram(sk, MSG_PEEK, 1, &err); | ||
944 | if (skb != NULL) { | ||
945 | __sctp_ulpevent_read_nxtinfo(sctp_skb2event(skb), | ||
946 | msghdr, skb); | ||
947 | /* Just release refcount here. */ | ||
948 | kfree_skb(skb); | ||
949 | } | ||
950 | } | ||
951 | |||
889 | /* Do accounting for bytes received and hold a reference to the association | 952 | /* Do accounting for bytes received and hold a reference to the association |
890 | * for each skb. | 953 | * for each skb. |
891 | */ | 954 | */ |