diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/keys/request_key_auth-type.h | 36 | ||||
-rw-r--r-- | include/linux/key-type.h | 22 | ||||
-rw-r--r-- | include/linux/netdev_features.h | 24 | ||||
-rw-r--r-- | include/linux/skbuff.h | 8 | ||||
-rw-r--r-- | include/linux/virtio_net.h | 9 |
5 files changed, 80 insertions, 19 deletions
diff --git a/include/keys/request_key_auth-type.h b/include/keys/request_key_auth-type.h new file mode 100644 index 000000000000..a726dd3f1dc6 --- /dev/null +++ b/include/keys/request_key_auth-type.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* request_key authorisation token key type | ||
2 | * | ||
3 | * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _KEYS_REQUEST_KEY_AUTH_TYPE_H | ||
13 | #define _KEYS_REQUEST_KEY_AUTH_TYPE_H | ||
14 | |||
15 | #include <linux/key.h> | ||
16 | |||
17 | /* | ||
18 | * Authorisation record for request_key(). | ||
19 | */ | ||
20 | struct request_key_auth { | ||
21 | struct key *target_key; | ||
22 | struct key *dest_keyring; | ||
23 | const struct cred *cred; | ||
24 | void *callout_info; | ||
25 | size_t callout_len; | ||
26 | pid_t pid; | ||
27 | char op[8]; | ||
28 | } __randomize_layout; | ||
29 | |||
30 | static inline struct request_key_auth *get_request_key_auth(const struct key *key) | ||
31 | { | ||
32 | return key->payload.data[0]; | ||
33 | } | ||
34 | |||
35 | |||
36 | #endif /* _KEYS_REQUEST_KEY_AUTH_TYPE_H */ | ||
diff --git a/include/linux/key-type.h b/include/linux/key-type.h index bc9af551fc83..e49d1de0614e 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h | |||
@@ -21,15 +21,6 @@ struct kernel_pkey_query; | |||
21 | struct kernel_pkey_params; | 21 | struct kernel_pkey_params; |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * key under-construction record | ||
25 | * - passed to the request_key actor if supplied | ||
26 | */ | ||
27 | struct key_construction { | ||
28 | struct key *key; /* key being constructed */ | ||
29 | struct key *authkey;/* authorisation for key being constructed */ | ||
30 | }; | ||
31 | |||
32 | /* | ||
33 | * Pre-parsed payload, used by key add, update and instantiate. | 24 | * Pre-parsed payload, used by key add, update and instantiate. |
34 | * | 25 | * |
35 | * This struct will be cleared and data and datalen will be set with the data | 26 | * This struct will be cleared and data and datalen will be set with the data |
@@ -50,8 +41,7 @@ struct key_preparsed_payload { | |||
50 | time64_t expiry; /* Expiry time of key */ | 41 | time64_t expiry; /* Expiry time of key */ |
51 | } __randomize_layout; | 42 | } __randomize_layout; |
52 | 43 | ||
53 | typedef int (*request_key_actor_t)(struct key_construction *key, | 44 | typedef int (*request_key_actor_t)(struct key *auth_key, void *aux); |
54 | const char *op, void *aux); | ||
55 | 45 | ||
56 | /* | 46 | /* |
57 | * Preparsed matching criterion. | 47 | * Preparsed matching criterion. |
@@ -181,20 +171,20 @@ extern int key_instantiate_and_link(struct key *key, | |||
181 | const void *data, | 171 | const void *data, |
182 | size_t datalen, | 172 | size_t datalen, |
183 | struct key *keyring, | 173 | struct key *keyring, |
184 | struct key *instkey); | 174 | struct key *authkey); |
185 | extern int key_reject_and_link(struct key *key, | 175 | extern int key_reject_and_link(struct key *key, |
186 | unsigned timeout, | 176 | unsigned timeout, |
187 | unsigned error, | 177 | unsigned error, |
188 | struct key *keyring, | 178 | struct key *keyring, |
189 | struct key *instkey); | 179 | struct key *authkey); |
190 | extern void complete_request_key(struct key_construction *cons, int error); | 180 | extern void complete_request_key(struct key *authkey, int error); |
191 | 181 | ||
192 | static inline int key_negate_and_link(struct key *key, | 182 | static inline int key_negate_and_link(struct key *key, |
193 | unsigned timeout, | 183 | unsigned timeout, |
194 | struct key *keyring, | 184 | struct key *keyring, |
195 | struct key *instkey) | 185 | struct key *authkey) |
196 | { | 186 | { |
197 | return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); | 187 | return key_reject_and_link(key, timeout, ENOKEY, keyring, authkey); |
198 | } | 188 | } |
199 | 189 | ||
200 | extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); | 190 | extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 2b2a6dce1630..4c76fe2c8488 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #define _LINUX_NETDEV_FEATURES_H | 11 | #define _LINUX_NETDEV_FEATURES_H |
12 | 12 | ||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/bitops.h> | ||
15 | #include <asm/byteorder.h> | ||
14 | 16 | ||
15 | typedef u64 netdev_features_t; | 17 | typedef u64 netdev_features_t; |
16 | 18 | ||
@@ -154,8 +156,26 @@ enum { | |||
154 | #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) | 156 | #define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) |
155 | #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) | 157 | #define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) |
156 | 158 | ||
157 | #define for_each_netdev_feature(mask_addr, bit) \ | 159 | /* Finds the next feature with the highest number of the range of start till 0. |
158 | for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) | 160 | */ |
161 | static inline int find_next_netdev_feature(u64 feature, unsigned long start) | ||
162 | { | ||
163 | /* like BITMAP_LAST_WORD_MASK() for u64 | ||
164 | * this sets the most significant 64 - start to 0. | ||
165 | */ | ||
166 | feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1)); | ||
167 | |||
168 | return fls64(feature) - 1; | ||
169 | } | ||
170 | |||
171 | /* This goes for the MSB to the LSB through the set feature bits, | ||
172 | * mask_addr should be a u64 and bit an int | ||
173 | */ | ||
174 | #define for_each_netdev_feature(mask_addr, bit) \ | ||
175 | for ((bit) = find_next_netdev_feature((mask_addr), \ | ||
176 | NETDEV_FEATURE_COUNT); \ | ||
177 | (bit) >= 0; \ | ||
178 | (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) | ||
159 | 179 | ||
160 | /* Features valid for ethtool to change */ | 180 | /* Features valid for ethtool to change */ |
161 | /* = all defined minus driver/device-class-related */ | 181 | /* = all defined minus driver/device-class-related */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 95d25b010a25..bdb9563c64a0 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2434,7 +2434,7 @@ static inline void skb_probe_transport_header(struct sk_buff *skb, | |||
2434 | 2434 | ||
2435 | if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) | 2435 | if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) |
2436 | skb_set_transport_header(skb, keys.control.thoff); | 2436 | skb_set_transport_header(skb, keys.control.thoff); |
2437 | else | 2437 | else if (offset_hint >= 0) |
2438 | skb_set_transport_header(skb, offset_hint); | 2438 | skb_set_transport_header(skb, offset_hint); |
2439 | } | 2439 | } |
2440 | 2440 | ||
@@ -4212,6 +4212,12 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb) | |||
4212 | return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; | 4212 | return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; |
4213 | } | 4213 | } |
4214 | 4214 | ||
4215 | static inline bool skb_is_gso_tcp(const struct sk_buff *skb) | ||
4216 | { | ||
4217 | return skb_is_gso(skb) && | ||
4218 | skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); | ||
4219 | } | ||
4220 | |||
4215 | static inline void skb_gso_reset(struct sk_buff *skb) | 4221 | static inline void skb_gso_reset(struct sk_buff *skb) |
4216 | { | 4222 | { |
4217 | skb_shinfo(skb)->gso_size = 0; | 4223 | skb_shinfo(skb)->gso_size = 0; |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index cb462f9ab7dd..71f2394abbf7 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -57,6 +57,15 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, | |||
57 | 57 | ||
58 | if (!skb_partial_csum_set(skb, start, off)) | 58 | if (!skb_partial_csum_set(skb, start, off)) |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } else { | ||
61 | /* gso packets without NEEDS_CSUM do not set transport_offset. | ||
62 | * probe and drop if does not match one of the above types. | ||
63 | */ | ||
64 | if (gso_type) { | ||
65 | skb_probe_transport_header(skb, -1); | ||
66 | if (!skb_transport_header_was_set(skb)) | ||
67 | return -EINVAL; | ||
68 | } | ||
60 | } | 69 | } |
61 | 70 | ||
62 | if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 71 | if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { |