aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sctp/structs.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ca77bc5b7ff5..2aa61ac9a9f3 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -74,6 +74,28 @@ union sctp_addr {
74 struct sockaddr sa; 74 struct sockaddr sa;
75}; 75};
76 76
77static inline void flip_to_n(union sctp_addr *to, const union sctp_addr *from)
78{
79 size_t len;
80 if (from->sa.sa_family == AF_INET6)
81 len = sizeof(struct sockaddr_in6);
82 else
83 len = sizeof(struct sockaddr);
84 memcpy(to, from, len);
85 to->v4.sin_port = htons(from->v4.sin_port);
86}
87
88static inline void flip_to_h(union sctp_addr *to, const union sctp_addr *from)
89{
90 size_t len;
91 if (from->sa.sa_family == AF_INET6)
92 len = sizeof(struct sockaddr_in6);
93 else
94 len = sizeof(struct sockaddr);
95 memcpy(to, from, len);
96 to->v4.sin_port = ntohs(from->v4.sin_port);
97}
98
77/* Forward declarations for data structures. */ 99/* Forward declarations for data structures. */
78struct sctp_globals; 100struct sctp_globals;
79struct sctp_endpoint; 101struct sctp_endpoint;