aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2018-07-06 10:12:56 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-06 21:58:49 -0400
commit657a0667025e77cc17f8a38b93e60a2bc24d830c (patch)
tree394fbb294b0ff5a62ff14e306ef727b21f4b2352 /include/net/sock.h
parentb515430ac9c25d5192cf498af3c6be6c4f51caad (diff)
sock: sockc cookie initializer
Initialize the cookie in one location to reduce code duplication and avoid bugs from inconsistent initialization, such as that fixed in commit 9887cba19978 ("ip: limit use of gso_size to udp"). Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index e0eac9ef44b5..83b747538bd0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1600,6 +1600,12 @@ struct sockcm_cookie {
1600 u16 tsflags; 1600 u16 tsflags;
1601}; 1601};
1602 1602
1603static inline void sockcm_init(struct sockcm_cookie *sockc,
1604 const struct sock *sk)
1605{
1606 *sockc = (struct sockcm_cookie) { .tsflags = sk->sk_tsflags };
1607}
1608
1603int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg, 1609int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,
1604 struct sockcm_cookie *sockc); 1610 struct sockcm_cookie *sockc);
1605int sock_cmsg_send(struct sock *sk, struct msghdr *msg, 1611int sock_cmsg_send(struct sock *sk, struct msghdr *msg,