diff options
author | Willem de Bruijn <willemb@google.com> | 2018-07-06 10:12:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-06 21:58:49 -0400 |
commit | b515430ac9c25d5192cf498af3c6be6c4f51caad (patch) | |
tree | b11ac766cd06f15c8eb9ae83d4cb96fecef97342 /include | |
parent | 351782067b6be81879b0af0daf7bd3acbb32d986 (diff) |
ipv6: ipcm6_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')
-rw-r--r-- | include/net/ipv6.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index b7843e0b16ee..6cb247f54d4c 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -301,6 +301,25 @@ struct ipcm6_cookie { | |||
301 | __u16 gso_size; | 301 | __u16 gso_size; |
302 | }; | 302 | }; |
303 | 303 | ||
304 | static inline void ipcm6_init(struct ipcm6_cookie *ipc6) | ||
305 | { | ||
306 | *ipc6 = (struct ipcm6_cookie) { | ||
307 | .hlimit = -1, | ||
308 | .tclass = -1, | ||
309 | .dontfrag = -1, | ||
310 | }; | ||
311 | } | ||
312 | |||
313 | static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6, | ||
314 | const struct ipv6_pinfo *np) | ||
315 | { | ||
316 | *ipc6 = (struct ipcm6_cookie) { | ||
317 | .hlimit = -1, | ||
318 | .tclass = np->tclass, | ||
319 | .dontfrag = np->dontfrag, | ||
320 | }; | ||
321 | } | ||
322 | |||
304 | static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) | 323 | static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) |
305 | { | 324 | { |
306 | struct ipv6_txoptions *opt; | 325 | struct ipv6_txoptions *opt; |