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 9887cba199 ("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>
This commit is contained in:
Willem de Bruijn
2018-07-06 10:12:55 -04:00
committed by David S. Miller
parent 351782067b
commit b515430ac9
6 changed files with 25 additions and 18 deletions

View File

@@ -301,6 +301,25 @@ struct ipcm6_cookie {
__u16 gso_size;
};
static inline void ipcm6_init(struct ipcm6_cookie *ipc6)
{
*ipc6 = (struct ipcm6_cookie) {
.hlimit = -1,
.tclass = -1,
.dontfrag = -1,
};
}
static inline void ipcm6_init_sk(struct ipcm6_cookie *ipc6,
const struct ipv6_pinfo *np)
{
*ipc6 = (struct ipcm6_cookie) {
.hlimit = -1,
.tclass = np->tclass,
.dontfrag = np->dontfrag,
};
}
static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
{
struct ipv6_txoptions *opt;