Commit ff269e2c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'net-next-6.7-followup' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next

Pull more networking updates from Jakub Kicinski:

 - Support GRO decapsulation for IPsec ESP in UDP

 - Add a handful of MODULE_DESCRIPTION()s

 - Drop questionable alignment check in TCP AO to avoid
   build issue after changes in the crypto tree

* tag 'net-next-6.7-followup' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next:
  net: tcp: remove call to obsolete crypto_ahash_alignmask()
  net: fill in MODULE_DESCRIPTION()s under drivers/net/
  net: fill in MODULE_DESCRIPTION()s under net/802*
  net: fill in MODULE_DESCRIPTION()s under net/core
  net: fill in MODULE_DESCRIPTION()s in kuba@'s modules
  xfrm: policy: fix layer 4 flowi decoding
  xfrm Fix use after free in __xfrm6_udp_encap_rcv.
  xfrm: policy: replace session decode with flow dissector
  xfrm: move mark and oif flowi decode into common code
  xfrm: pass struct net to xfrm_decode_session wrappers
  xfrm: Support GRO for IPv6 ESP in UDP encapsulation
  xfrm: Support GRO for IPv4 ESP in UDP encapsulation
  xfrm: Use the XFRM_GRO to indicate a GRO call on input
  xfrm: Annotate struct xfrm_sec_ctx with __counted_by
  xfrm: Remove unused function declarations
parents 05bf73aa f2fbb908
...@@ -3449,5 +3449,6 @@ static void __exit amt_fini(void) ...@@ -3449,5 +3449,6 @@ static void __exit amt_fini(void)
module_exit(amt_fini); module_exit(amt_fini);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Driver for Automatic Multicast Tunneling (AMT)");
MODULE_AUTHOR("Taehee Yoo <ap420073@gmail.com>"); MODULE_AUTHOR("Taehee Yoo <ap420073@gmail.com>");
MODULE_ALIAS_RTNL_LINK("amt"); MODULE_ALIAS_RTNL_LINK("amt");
...@@ -202,4 +202,5 @@ static void __exit dummy_cleanup_module(void) ...@@ -202,4 +202,5 @@ static void __exit dummy_cleanup_module(void)
module_init(dummy_init_module); module_init(dummy_init_module);
module_exit(dummy_cleanup_module); module_exit(dummy_cleanup_module);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Dummy netdevice driver which discards all packets sent to it");
MODULE_ALIAS_RTNL_LINK(DRV_NAME); MODULE_ALIAS_RTNL_LINK(DRV_NAME);
...@@ -607,4 +607,5 @@ static void __exit eql_cleanup_module(void) ...@@ -607,4 +607,5 @@ static void __exit eql_cleanup_module(void)
module_init(eql_init_module); module_init(eql_init_module);
module_exit(eql_cleanup_module); module_exit(eql_cleanup_module);
MODULE_DESCRIPTION("Equalizer Load-balancer for serial network interfaces");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -454,5 +454,6 @@ static void __exit ifb_cleanup_module(void) ...@@ -454,5 +454,6 @@ static void __exit ifb_cleanup_module(void)
module_init(ifb_init_module); module_init(ifb_init_module);
module_exit(ifb_cleanup_module); module_exit(ifb_cleanup_module);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Intermediate Functional Block (ifb) netdevice driver for sharing of resources and ingress packet queuing");
MODULE_AUTHOR("Jamal Hadi Salim"); MODULE_AUTHOR("Jamal Hadi Salim");
MODULE_ALIAS_RTNL_LINK("ifb"); MODULE_ALIAS_RTNL_LINK("ifb");
...@@ -250,5 +250,6 @@ static void __exit macvtap_exit(void) ...@@ -250,5 +250,6 @@ static void __exit macvtap_exit(void)
module_exit(macvtap_exit); module_exit(macvtap_exit);
MODULE_ALIAS_RTNL_LINK("macvtap"); MODULE_ALIAS_RTNL_LINK("macvtap");
MODULE_DESCRIPTION("MAC-VLAN based tap driver");
MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>"); MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -470,4 +470,5 @@ static void __exit nsim_module_exit(void) ...@@ -470,4 +470,5 @@ static void __exit nsim_module_exit(void)
module_init(nsim_module_init); module_init(nsim_module_init);
module_exit(nsim_module_exit); module_exit(nsim_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simulated networking device for testing");
MODULE_ALIAS_RTNL_LINK(DRV_NAME); MODULE_ALIAS_RTNL_LINK(DRV_NAME);
...@@ -1194,4 +1194,5 @@ int sungem_phy_probe(struct mii_phy *phy, int mii_id) ...@@ -1194,4 +1194,5 @@ int sungem_phy_probe(struct mii_phy *phy, int mii_id)
} }
EXPORT_SYMBOL(sungem_phy_probe); EXPORT_SYMBOL(sungem_phy_probe);
MODULE_DESCRIPTION("PHY drivers for the sungem Ethernet MAC driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1399,6 +1399,7 @@ void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev) ...@@ -1399,6 +1399,7 @@ void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev)
} }
EXPORT_SYMBOL_GPL(tap_destroy_cdev); EXPORT_SYMBOL_GPL(tap_destroy_cdev);
MODULE_DESCRIPTION("Common library for drivers implementing the TAP interface");
MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>"); MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>");
MODULE_AUTHOR("Sainath Grandhi <sainath.grandhi@intel.com>"); MODULE_AUTHOR("Sainath Grandhi <sainath.grandhi@intel.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -365,6 +365,7 @@ static int mt7601u_resume(struct usb_interface *usb_intf) ...@@ -365,6 +365,7 @@ static int mt7601u_resume(struct usb_interface *usb_intf)
MODULE_DEVICE_TABLE(usb, mt7601u_device_table); MODULE_DEVICE_TABLE(usb, mt7601u_device_table);
MODULE_FIRMWARE(MT7601U_FIRMWARE); MODULE_FIRMWARE(MT7601U_FIRMWARE);
MODULE_DESCRIPTION("MediaTek MT7601U USB Wireless LAN driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static struct usb_driver mt7601u_driver = { static struct usb_driver mt7601u_driver = {
......
...@@ -41,7 +41,7 @@ struct napi_gro_cb { ...@@ -41,7 +41,7 @@ struct napi_gro_cb {
/* Number of segments aggregated. */ /* Number of segments aggregated. */
u16 count; u16 count;
/* Used in ipv6_gro_receive() and foo-over-udp */ /* Used in ipv6_gro_receive() and foo-over-udp and esp-in-udp */
u16 proto; u16 proto;
/* Used in napi_gro_cb::free */ /* Used in napi_gro_cb::free */
......
...@@ -60,6 +60,9 @@ struct ipv6_stub { ...@@ -60,6 +60,9 @@ struct ipv6_stub {
#if IS_ENABLED(CONFIG_XFRM) #if IS_ENABLED(CONFIG_XFRM)
void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu); void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb); int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
struct sk_buff *(*xfrm6_gro_udp_encap_rcv)(struct sock *sk,
struct list_head *head,
struct sk_buff *skb);
int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi, int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
int encap_type); int encap_type);
#endif #endif
......
...@@ -1207,20 +1207,20 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, ...@@ -1207,20 +1207,20 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1); return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1);
} }
int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, int __xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl,
unsigned int family, int reverse); unsigned int family, int reverse);
static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, static inline int xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl,
unsigned int family) unsigned int family)
{ {
return __xfrm_decode_session(skb, fl, family, 0); return __xfrm_decode_session(net, skb, fl, family, 0);
} }
static inline int xfrm_decode_session_reverse(struct sk_buff *skb, static inline int xfrm_decode_session_reverse(struct net *net, struct sk_buff *skb,
struct flowi *fl, struct flowi *fl,
unsigned int family) unsigned int family)
{ {
return __xfrm_decode_session(skb, fl, family, 1); return __xfrm_decode_session(net, skb, fl, family, 1);
} }
int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
...@@ -1296,7 +1296,7 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk ...@@ -1296,7 +1296,7 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk
{ {
return 1; return 1;
} }
static inline int xfrm_decode_session_reverse(struct sk_buff *skb, static inline int xfrm_decode_session_reverse(struct net *net, struct sk_buff *skb,
struct flowi *fl, struct flowi *fl,
unsigned int family) unsigned int family)
{ {
...@@ -1669,7 +1669,6 @@ int pktgen_xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb); ...@@ -1669,7 +1669,6 @@ int pktgen_xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb);
#endif #endif
void xfrm_local_error(struct sk_buff *skb, int mtu); void xfrm_local_error(struct sk_buff *skb, int mtu);
int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
int encap_type); int encap_type);
int xfrm4_transport_finish(struct sk_buff *skb, int async); int xfrm4_transport_finish(struct sk_buff *skb, int async);
...@@ -1689,7 +1688,6 @@ int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char prot ...@@ -1689,7 +1688,6 @@ int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char prot
int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
void xfrm4_local_error(struct sk_buff *skb, u32 mtu); void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi,
struct ip6_tnl *t); struct ip6_tnl *t);
int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
...@@ -1712,6 +1710,10 @@ int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb); ...@@ -1712,6 +1710,10 @@ int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu); void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
struct sk_buff *xfrm4_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
struct sk_buff *skb);
struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
struct sk_buff *skb);
int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval, int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval,
int optlen); int optlen);
#else #else
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/in6.h> #include <linux/in6.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/stddef.h>
/* All of the structures in this file may not change size as they are /* All of the structures in this file may not change size as they are
* passed into the kernel from userspace via netlink sockets. * passed into the kernel from userspace via netlink sockets.
...@@ -33,7 +34,7 @@ struct xfrm_sec_ctx { ...@@ -33,7 +34,7 @@ struct xfrm_sec_ctx {
__u8 ctx_alg; __u8 ctx_alg;
__u16 ctx_len; __u16 ctx_len;
__u32 ctx_sid; __u32 ctx_sid;
char ctx_str[]; char ctx_str[] __counted_by(ctx_len);
}; };
/* Security Context Domains of Interpretation */ /* Security Context Domains of Interpretation */
......
...@@ -175,4 +175,5 @@ struct net_device *alloc_fddidev(int sizeof_priv) ...@@ -175,4 +175,5 @@ struct net_device *alloc_fddidev(int sizeof_priv)
} }
EXPORT_SYMBOL(alloc_fddidev); EXPORT_SYMBOL(alloc_fddidev);
MODULE_DESCRIPTION("Core routines for FDDI network devices");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
static unsigned int garp_join_time __read_mostly = 200; static unsigned int garp_join_time __read_mostly = 200;
module_param(garp_join_time, uint, 0644); module_param(garp_join_time, uint, 0644);
MODULE_PARM_DESC(garp_join_time, "Join time in ms (default 200ms)"); MODULE_PARM_DESC(garp_join_time, "Join time in ms (default 200ms)");
MODULE_DESCRIPTION("IEEE 802.1D Generic Attribute Registration Protocol (GARP)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static const struct garp_state_trans { static const struct garp_state_trans {
......
...@@ -26,6 +26,7 @@ static unsigned int mrp_periodic_time __read_mostly = 1000; ...@@ -26,6 +26,7 @@ static unsigned int mrp_periodic_time __read_mostly = 1000;
module_param(mrp_periodic_time, uint, 0644); module_param(mrp_periodic_time, uint, 0644);
MODULE_PARM_DESC(mrp_periodic_time, "Periodic time in ms (default 1s)"); MODULE_PARM_DESC(mrp_periodic_time, "Periodic time in ms (default 1s)");
MODULE_DESCRIPTION("IEEE 802.1Q Multiple Registration Protocol (MRP)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static const u8 static const u8
......
...@@ -60,4 +60,5 @@ void unregister_8022_client(struct datalink_proto *proto) ...@@ -60,4 +60,5 @@ void unregister_8022_client(struct datalink_proto *proto)
EXPORT_SYMBOL(register_8022_client); EXPORT_SYMBOL(register_8022_client);
EXPORT_SYMBOL(unregister_8022_client); EXPORT_SYMBOL(unregister_8022_client);
MODULE_DESCRIPTION("Support for 802.2 demultiplexing off Ethernet");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -160,4 +160,5 @@ void unregister_snap_client(struct datalink_proto *proto) ...@@ -160,4 +160,5 @@ void unregister_snap_client(struct datalink_proto *proto)
kfree(proto); kfree(proto);
} }
MODULE_DESCRIPTION("SNAP data link layer. Derived from 802.2");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -98,4 +98,5 @@ void stp_proto_unregister(const struct stp_proto *proto) ...@@ -98,4 +98,5 @@ void stp_proto_unregister(const struct stp_proto *proto)
} }
EXPORT_SYMBOL_GPL(stp_proto_unregister); EXPORT_SYMBOL_GPL(stp_proto_unregister);
MODULE_DESCRIPTION("SAP demux for IEEE 802.1D Spanning Tree Protocol (STP)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -738,5 +738,6 @@ static void __exit vlan_cleanup_module(void) ...@@ -738,5 +738,6 @@ static void __exit vlan_cleanup_module(void)
module_init(vlan_proto_init); module_init(vlan_proto_init);
module_exit(vlan_cleanup_module); module_exit(vlan_cleanup_module);
MODULE_DESCRIPTION("802.1Q/802.1ad VLAN Protocol");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
...@@ -233,4 +233,5 @@ static struct kunit_suite dev_addr_test_suite = { ...@@ -233,4 +233,5 @@ static struct kunit_suite dev_addr_test_suite = {
}; };
kunit_test_suite(dev_addr_test_suite); kunit_test_suite(dev_addr_test_suite);
MODULE_DESCRIPTION("KUnit tests for struct netdev_hw_addr_list");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -405,5 +405,6 @@ void net_selftest_get_strings(u8 *data) ...@@ -405,5 +405,6 @@ void net_selftest_get_strings(u8 *data)
} }
EXPORT_SYMBOL_GPL(net_selftest_get_strings); EXPORT_SYMBOL_GPL(net_selftest_get_strings);
MODULE_DESCRIPTION("Common library for generic PHY ethtool selftests");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>"); MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>");
...@@ -33,6 +33,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head, ...@@ -33,6 +33,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
int offset = skb_gro_offset(skb); int offset = skb_gro_offset(skb);
struct xfrm_offload *xo; struct xfrm_offload *xo;
struct xfrm_state *x; struct xfrm_state *x;
int encap_type = 0;
__be32 seq; __be32 seq;
__be32 spi; __be32 spi;
...@@ -70,6 +71,9 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head, ...@@ -70,6 +71,9 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
xo->flags |= XFRM_GRO; xo->flags |= XFRM_GRO;
if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP)
encap_type = UDP_ENCAP_ESPINUDP;
XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL; XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
XFRM_SPI_SKB_CB(skb)->family = AF_INET; XFRM_SPI_SKB_CB(skb)->family = AF_INET;
XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr); XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
...@@ -77,7 +81,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head, ...@@ -77,7 +81,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
/* We don't need to handle errors from xfrm_input, it does all /* We don't need to handle errors from xfrm_input, it does all
* the error handling and frees the resources on error. */ * the error handling and frees the resources on error. */
xfrm_input(skb, IPPROTO_ESP, spi, -2); xfrm_input(skb, IPPROTO_ESP, spi, encap_type);
return ERR_PTR(-EINPROGRESS); return ERR_PTR(-EINPROGRESS);
out_reset: out_reset:
......
...@@ -517,7 +517,7 @@ static struct rtable *icmp_route_lookup(struct net *net, ...@@ -517,7 +517,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
} else } else
return rt; return rt;
err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4_dec), AF_INET); err = xfrm_decode_session_reverse(net, skb_in, flowi4_to_flowi(&fl4_dec), AF_INET);
if (err) if (err)
goto relookup_failed; goto relookup_failed;
......
...@@ -288,11 +288,11 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -288,11 +288,11 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
switch (skb->protocol) { switch (skb->protocol) {
case htons(ETH_P_IP): case htons(ETH_P_IP):
memset(IPCB(skb), 0, sizeof(*IPCB(skb))); memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
xfrm_decode_session(skb, &fl, AF_INET); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET);
break; break;
case htons(ETH_P_IPV6): case htons(ETH_P_IPV6):
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
xfrm_decode_session(skb, &fl, AF_INET6); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET6);
break; break;
default: default:
goto tx_err; goto tx_err;
......
...@@ -62,7 +62,7 @@ int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, un ...@@ -62,7 +62,7 @@ int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, un
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
xfrm_decode_session(skb, flowi4_to_flowi(&fl4), AF_INET) == 0) { xfrm_decode_session(net, skb, flowi4_to_flowi(&fl4), AF_INET) == 0) {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
skb_dst_set(skb, NULL); skb_dst_set(skb, NULL);
dst = xfrm_lookup(net, dst, flowi4_to_flowi(&fl4), sk, 0); dst = xfrm_lookup(net, dst, flowi4_to_flowi(&fl4), sk, 0);
......
...@@ -1533,10 +1533,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk, ...@@ -1533,10 +1533,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk,
goto err_free_pool; goto err_free_pool;
tfm = crypto_ahash_reqtfm(hp.req); tfm = crypto_ahash_reqtfm(hp.req);
if (crypto_ahash_alignmask(tfm) > TCP_AO_KEY_ALIGN) {
err = -EOPNOTSUPP;
goto err_pool_end;
}
digest_size = crypto_ahash_digestsize(tfm); digest_size = crypto_ahash_digestsize(tfm);
tcp_sigpool_end(&hp); tcp_sigpool_end(&hp);
...@@ -1551,8 +1547,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk, ...@@ -1551,8 +1547,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk,
key->digest_size = digest_size; key->digest_size = digest_size;
return key; return key;
err_pool_end:
tcp_sigpool_end(&hp);
err_free_pool: err_free_pool:
tcp_sigpool_release(pool_id); tcp_sigpool_release(pool_id);
return ERR_PTR(err); return ERR_PTR(err);
......
...@@ -2630,6 +2630,19 @@ void udp_destroy_sock(struct sock *sk) ...@@ -2630,6 +2630,19 @@ void udp_destroy_sock(struct sock *sk)
} }
} }
static void set_xfrm_gro_udp_encap_rcv(__u16 encap_type, unsigned short family,
struct sock *sk)
{
#ifdef CONFIG_XFRM
if (udp_test_bit(GRO_ENABLED, sk) && encap_type == UDP_ENCAP_ESPINUDP) {
if (family == AF_INET)
WRITE_ONCE(udp_sk(sk)->gro_receive, xfrm4_gro_udp_encap_rcv);
else if (IS_ENABLED(CONFIG_IPV6) && family == AF_INET6)
WRITE_ONCE(udp_sk(sk)->gro_receive, ipv6_stub->xfrm6_gro_udp_encap_rcv);
}
#endif
}
/* /*
* Socket option code for UDP * Socket option code for UDP
*/ */
...@@ -2679,6 +2692,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -2679,6 +2692,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
case 0: case 0:
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
case UDP_ENCAP_ESPINUDP: case UDP_ENCAP_ESPINUDP:
set_xfrm_gro_udp_encap_rcv(val, sk->sk_family, sk);
fallthrough;
case UDP_ENCAP_ESPINUDP_NON_IKE: case UDP_ENCAP_ESPINUDP_NON_IKE:
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (sk->sk_family == AF_INET6) if (sk->sk_family == AF_INET6)
...@@ -2721,6 +2736,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -2721,6 +2736,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
udp_tunnel_encap_enable(sk); udp_tunnel_encap_enable(sk);
udp_assign_bit(GRO_ENABLED, sk, valbool); udp_assign_bit(GRO_ENABLED, sk, valbool);
udp_assign_bit(ACCEPT_L4, sk, valbool); udp_assign_bit(ACCEPT_L4, sk, valbool);
set_xfrm_gro_udp_encap_rcv(up->encap_type, sk->sk_family, sk);
break; break;
/* /*
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <linux/netfilter_ipv4.h> #include <linux/netfilter_ipv4.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/protocol.h>
#include <net/gro.h>
static int xfrm4_rcv_encap_finish2(struct net *net, struct sock *sk, static int xfrm4_rcv_encap_finish2(struct net *net, struct sock *sk,
struct sk_buff *skb) struct sk_buff *skb)
...@@ -72,14 +74,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async) ...@@ -72,14 +74,7 @@ int xfrm4_transport_finish(struct sk_buff *skb, int async)
return 0; return 0;
} }
/* If it's a keepalive packet, then just eat it. static int __xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb, bool pull)
* If it's an encapsulated packet, then pass it to the
* IPsec xfrm input.
* Returns 0 if skb passed to xfrm or was dropped.
* Returns >0 if skb should be passed to UDP.
* Returns <0 if skb should be resubmitted (-ret is protocol)
*/
int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
{ {
struct udp_sock *up = udp_sk(sk); struct udp_sock *up = udp_sk(sk);
struct udphdr *uh; struct udphdr *uh;
...@@ -110,7 +105,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -110,7 +105,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
case UDP_ENCAP_ESPINUDP: case UDP_ENCAP_ESPINUDP:
/* Check if this is a keepalive packet. If so, eat it. */ /* Check if this is a keepalive packet. If so, eat it. */
if (len == 1 && udpdata[0] == 0xff) { if (len == 1 && udpdata[0] == 0xff) {
goto drop; return -EINVAL;
} else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) { } else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) {
/* ESP Packet without Non-ESP header */ /* ESP Packet without Non-ESP header */
len = sizeof(struct udphdr); len = sizeof(struct udphdr);
...@@ -121,7 +116,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -121,7 +116,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
case UDP_ENCAP_ESPINUDP_NON_IKE: case UDP_ENCAP_ESPINUDP_NON_IKE:
/* Check if this is a keepalive packet. If so, eat it. */ /* Check if this is a keepalive packet. If so, eat it. */
if (len == 1 && udpdata[0] == 0xff) { if (len == 1 && udpdata[0] == 0xff) {
goto drop; return -EINVAL;
} else if (len > 2 * sizeof(u32) + sizeof(struct ip_esp_hdr) && } else if (len > 2 * sizeof(u32) + sizeof(struct ip_esp_hdr) &&
udpdata32[0] == 0 && udpdata32[1] == 0) { udpdata32[0] == 0 && udpdata32[1] == 0) {
...@@ -139,7 +134,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -139,7 +134,7 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
* protocol to ESP, and then call into the transform receiver. * protocol to ESP, and then call into the transform receiver.
*/ */
if (skb_unclone(skb, GFP_ATOMIC)) if (skb_unclone(skb, GFP_ATOMIC))
goto drop; return -EINVAL;
/* Now we can update and verify the packet length... */ /* Now we can update and verify the packet length... */
iph = ip_hdr(skb); iph = ip_hdr(skb);
...@@ -147,25 +142,89 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -147,25 +142,89 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
iph->tot_len = htons(ntohs(iph->tot_len) - len); iph->tot_len = htons(ntohs(iph->tot_len) - len);
if (skb->len < iphlen + len) { if (skb->len < iphlen + len) {
/* packet is too small!?! */ /* packet is too small!?! */
goto drop; return -EINVAL;
} }
/* pull the data buffer up to the ESP header and set the /* pull the data buffer up to the ESP header and set the
* transport header to point to ESP. Keep UDP on the stack * transport header to point to ESP. Keep UDP on the stack
* for later. * for later.
*/ */
__skb_pull(skb, len); if (pull) {
skb_reset_transport_header(skb); __skb_pull(skb, len);
skb_reset_transport_header(skb);
} else {
skb_set_transport_header(skb, len);
}
/* process ESP */ /* process ESP */
return xfrm4_rcv_encap(skb, IPPROTO_ESP, 0, encap_type);
drop:
kfree_skb(skb);
return 0; return 0;
} }
/* If it's a keepalive packet, then just eat it.
* If it's an encapsulated packet, then pass it to the
* IPsec xfrm input.
* Returns 0 if skb passed to xfrm or was dropped.
* Returns >0 if skb should be passed to UDP.
* Returns <0 if skb should be resubmitted (-ret is protocol)
*/
int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
{
int ret;
ret = __xfrm4_udp_encap_rcv(sk, skb, true);
if (!ret)
return xfrm4_rcv_encap(skb, IPPROTO_ESP, 0,
udp_sk(sk)->encap_type);
if (ret < 0) {
kfree_skb(skb);
return 0;
}
return ret;
}
EXPORT_SYMBOL(xfrm4_udp_encap_rcv); EXPORT_SYMBOL(xfrm4_udp_encap_rcv);
struct sk_buff *xfrm4_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
struct sk_buff *skb)
{
int offset = skb_gro_offset(skb);
const struct net_offload *ops;
struct sk_buff *pp = NULL;
int ret;
offset = offset - sizeof(struct udphdr);
if (!pskb_pull(skb, offset))
return NULL;
rcu_read_lock();
ops = rcu_dereference(inet_offloads[IPPROTO_ESP]);
if (!ops || !ops->callbacks.gro_receive)
goto out;
ret = __xfrm4_udp_encap_rcv(sk, skb, false);
if (ret)
goto out;
skb_push(skb, offset);
NAPI_GRO_CB(skb)->proto = IPPROTO_UDP;
pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
rcu_read_unlock();
return pp;
out:
rcu_read_unlock();
skb_push(skb, offset);
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 1;
return NULL;
}
EXPORT_SYMBOL(xfrm4_gro_udp_encap_rcv);
int xfrm4_rcv(struct sk_buff *skb) int xfrm4_rcv(struct sk_buff *skb)
{ {
return xfrm4_rcv_spi(skb, ip_hdr(skb)->protocol, 0); return xfrm4_rcv_spi(skb, ip_hdr(skb)->protocol, 0);
......
...@@ -1050,6 +1050,7 @@ static const struct ipv6_stub ipv6_stub_impl = { ...@@ -1050,6 +1050,7 @@ static const struct ipv6_stub ipv6_stub_impl = {
#if IS_ENABLED(CONFIG_XFRM) #if IS_ENABLED(CONFIG_XFRM)
.xfrm6_local_rxpmtu = xfrm6_local_rxpmtu, .xfrm6_local_rxpmtu = xfrm6_local_rxpmtu,
.xfrm6_udp_encap_rcv = xfrm6_udp_encap_rcv, .xfrm6_udp_encap_rcv = xfrm6_udp_encap_rcv,
.xfrm6_gro_udp_encap_rcv = xfrm6_gro_udp_encap_rcv,
.xfrm6_rcv_encap = xfrm6_rcv_encap, .xfrm6_rcv_encap = xfrm6_rcv_encap,
#endif #endif
.nd_tbl = &nd_tbl, .nd_tbl = &nd_tbl,
......
...@@ -34,7 +34,9 @@ static __u16 esp6_nexthdr_esp_offset(struct ipv6hdr *ipv6_hdr, int nhlen) ...@@ -34,7 +34,9 @@ static __u16 esp6_nexthdr_esp_offset(struct ipv6hdr *ipv6_hdr, int nhlen)
int off = sizeof(struct ipv6hdr); int off = sizeof(struct ipv6hdr);
struct ipv6_opt_hdr *exthdr; struct ipv6_opt_hdr *exthdr;
if (likely(ipv6_hdr->nexthdr == NEXTHDR_ESP)) /* ESP or ESPINUDP */
if (likely(ipv6_hdr->nexthdr == NEXTHDR_ESP ||
ipv6_hdr->nexthdr == NEXTHDR_UDP))
return offsetof(struct ipv6hdr, nexthdr); return offsetof(struct ipv6hdr, nexthdr);
while (off < nhlen) { while (off < nhlen) {
...@@ -54,10 +56,14 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head, ...@@ -54,10 +56,14 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head,
int offset = skb_gro_offset(skb); int offset = skb_gro_offset(skb);
struct xfrm_offload *xo; struct xfrm_offload *xo;
struct xfrm_state *x; struct xfrm_state *x;
int encap_type = 0;
__be32 seq; __be32 seq;
__be32 spi; __be32 spi;
int nhoff; int nhoff;
if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP)
encap_type = UDP_ENCAP_ESPINUDP;
if (!pskb_pull(skb, offset)) if (!pskb_pull(skb, offset))
return NULL; return NULL;
...@@ -104,7 +110,7 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head, ...@@ -104,7 +110,7 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head,
/* We don't need to handle errors from xfrm_input, it does all /* We don't need to handle errors from xfrm_input, it does all
* the error handling and frees the resources on error. */ * the error handling and frees the resources on error. */
xfrm_input(skb, IPPROTO_ESP, spi, -2); xfrm_input(skb, IPPROTO_ESP, spi, encap_type);
return ERR_PTR(-EINPROGRESS); return ERR_PTR(-EINPROGRESS);
out_reset: out_reset:
......
...@@ -385,7 +385,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net, ...@@ -385,7 +385,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net,
return dst; return dst;
} }
err = xfrm_decode_session_reverse(skb, flowi6_to_flowi(&fl2), AF_INET6); err = xfrm_decode_session_reverse(net, skb, flowi6_to_flowi(&fl2), AF_INET6);
if (err) if (err)
goto relookup_failed; goto relookup_failed;
......
...@@ -569,11 +569,11 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -569,11 +569,11 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
goto tx_err; goto tx_err;
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
xfrm_decode_session(skb, &fl, AF_INET6); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET6);
break; break;
case htons(ETH_P_IP): case htons(ETH_P_IP):
memset(IPCB(skb), 0, sizeof(*IPCB(skb))); memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
xfrm_decode_session(skb, &fl, AF_INET); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET);
break; break;
default: default:
goto tx_err; goto tx_err;
......
...@@ -61,7 +61,7 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff ...@@ -61,7 +61,7 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) { xfrm_decode_session(net, skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) {
skb_dst_set(skb, NULL); skb_dst_set(skb, NULL);
dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0); dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
if (IS_ERR(dst)) if (IS_ERR(dst))
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/netfilter_ipv6.h> #include <linux/netfilter_ipv6.h>
#include <net/ipv6.h> #include <net/ipv6.h>
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/protocol.h>
#include <net/gro.h>
int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi,
struct ip6_tnl *t) struct ip6_tnl *t)
...@@ -67,14 +69,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async) ...@@ -67,14 +69,7 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async)
return 0; return 0;
} }
/* If it's a keepalive packet, then just eat it. static int __xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb, bool pull)
* If it's an encapsulated packet, then pass it to the
* IPsec xfrm input.
* Returns 0 if skb passed to xfrm or was dropped.
* Returns >0 if skb should be passed to UDP.
* Returns <0 if skb should be resubmitted (-ret is protocol)
*/
int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
{ {
struct udp_sock *up = udp_sk(sk); struct udp_sock *up = udp_sk(sk);
struct udphdr *uh; struct udphdr *uh;
...@@ -85,9 +80,6 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -85,9 +80,6 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
__be32 *udpdata32; __be32 *udpdata32;
u16 encap_type; u16 encap_type;
if (skb->protocol == htons(ETH_P_IP))
return xfrm4_udp_encap_rcv(sk, skb);
encap_type = READ_ONCE(up->encap_type); encap_type = READ_ONCE(up->encap_type);
/* if this is not encapsulated socket, then just return now */ /* if this is not encapsulated socket, then just return now */
if (!encap_type) if (!encap_type)
...@@ -109,7 +101,7 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -109,7 +101,7 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
case UDP_ENCAP_ESPINUDP: case UDP_ENCAP_ESPINUDP:
/* Check if this is a keepalive packet. If so, eat it. */ /* Check if this is a keepalive packet. If so, eat it. */
if (len == 1 && udpdata[0] == 0xff) { if (len == 1 && udpdata[0] == 0xff) {
goto drop; return -EINVAL;
} else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) { } else if (len > sizeof(struct ip_esp_hdr) && udpdata32[0] != 0) {
/* ESP Packet without Non-ESP header */ /* ESP Packet without Non-ESP header */
len = sizeof(struct udphdr); len = sizeof(struct udphdr);
...@@ -120,7 +112,7 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -120,7 +112,7 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
case UDP_ENCAP_ESPINUDP_NON_IKE: case UDP_ENCAP_ESPINUDP_NON_IKE:
/* Check if this is a keepalive packet. If so, eat it. */ /* Check if this is a keepalive packet. If so, eat it. */
if (len == 1 && udpdata[0] == 0xff) { if (len == 1 && udpdata[0] == 0xff) {
goto drop; return -EINVAL;
} else if (len > 2 * sizeof(u32) + sizeof(struct ip_esp_hdr) && } else if (len > 2 * sizeof(u32) + sizeof(struct ip_esp_hdr) &&
udpdata32[0] == 0 && udpdata32[1] == 0) { udpdata32[0] == 0 && udpdata32[1] == 0) {
...@@ -138,31 +130,100 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -138,31 +130,100 @@ int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
* protocol to ESP, and then call into the transform receiver. * protocol to ESP, and then call into the transform receiver.
*/ */
if (skb_unclone(skb, GFP_ATOMIC)) if (skb_unclone(skb, GFP_ATOMIC))
goto drop; return -EINVAL;
/* Now we can update and verify the packet length... */ /* Now we can update and verify the packet length... */
ip6h = ipv6_hdr(skb); ip6h = ipv6_hdr(skb);
ip6h->payload_len = htons(ntohs(ip6h->payload_len) - len); ip6h->payload_len = htons(ntohs(ip6h->payload_len) - len);
if (skb->len < ip6hlen + len) { if (skb->len < ip6hlen + len) {
/* packet is too small!?! */ /* packet is too small!?! */
goto drop; return -EINVAL;
} }
/* pull the data buffer up to the ESP header and set the /* pull the data buffer up to the ESP header and set the
* transport header to point to ESP. Keep UDP on the stack * transport header to point to ESP. Keep UDP on the stack
* for later. * for later.
*/ */
__skb_pull(skb, len); if (pull) {
skb_reset_transport_header(skb); __skb_pull(skb, len);
skb_reset_transport_header(skb);
} else {
skb_set_transport_header(skb, len);
}
/* process ESP */ /* process ESP */
return xfrm6_rcv_encap(skb, IPPROTO_ESP, 0, encap_type);
drop:
kfree_skb(skb);
return 0; return 0;
} }
/* If it's a keepalive packet, then just eat it.
* If it's an encapsulated packet, then pass it to the
* IPsec xfrm input.
* Returns 0 if skb passed to xfrm or was dropped.
* Returns >0 if skb should be passed to UDP.
* Returns <0 if skb should be resubmitted (-ret is protocol)
*/
int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
{
int ret;
if (skb->protocol == htons(ETH_P_IP))
return xfrm4_udp_encap_rcv(sk, skb);
ret = __xfrm6_udp_encap_rcv(sk, skb, true);
if (!ret)
return xfrm6_rcv_encap(skb, IPPROTO_ESP, 0,
udp_sk(sk)->encap_type);
if (ret < 0) {
kfree_skb(skb);
return 0;
}
return ret;
}
struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
struct sk_buff *skb)
{
int offset = skb_gro_offset(skb);
const struct net_offload *ops;
struct sk_buff *pp = NULL;
int ret;
if (skb->protocol == htons(ETH_P_IP))
return xfrm4_gro_udp_encap_rcv(sk, head, skb);
offset = offset - sizeof(struct udphdr);
if (!pskb_pull(skb, offset))
return NULL;
rcu_read_lock();
ops = rcu_dereference(inet6_offloads[IPPROTO_ESP]);
if (!ops || !ops->callbacks.gro_receive)
goto out;
ret = __xfrm6_udp_encap_rcv(sk, skb, false);
if (ret)
goto out;
skb_push(skb, offset);
NAPI_GRO_CB(skb)->proto = IPPROTO_UDP;
pp = call_gro_receive(ops->callbacks.gro_receive, head, skb);
rcu_read_unlock();
return pp;
out:
rcu_read_unlock();
skb_push(skb, offset);
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 1;
return NULL;
}
int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t) int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t)
{ {
return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff],
......
...@@ -668,7 +668,7 @@ static int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int ...@@ -668,7 +668,7 @@ static int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int
struct flowi fl; struct flowi fl;
int err; int err;
err = xfrm_decode_session(skb, &fl, family); err = xfrm_decode_session(net, skb, &fl, family);
if (err < 0) if (err < 0)
return err; return err;
......
...@@ -462,7 +462,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) ...@@ -462,7 +462,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
struct xfrm_offload *xo = xfrm_offload(skb); struct xfrm_offload *xo = xfrm_offload(skb);
struct sec_path *sp; struct sec_path *sp;
if (encap_type < 0) { if (encap_type < 0 || (xo && xo->flags & XFRM_GRO)) {
x = xfrm_input_state(skb); x = xfrm_input_state(skb);
if (unlikely(x->km.state != XFRM_STATE_VALID)) { if (unlikely(x->km.state != XFRM_STATE_VALID)) {
...@@ -485,9 +485,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) ...@@ -485,9 +485,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
seq = XFRM_SKB_CB(skb)->seq.input.low; seq = XFRM_SKB_CB(skb)->seq.input.low;
goto resume; goto resume;
} }
/* GRO call */
/* encap_type < -1 indicates a GRO call. */
encap_type = 0;
seq = XFRM_SPI_SKB_CB(skb)->seq; seq = XFRM_SPI_SKB_CB(skb)->seq;
if (xo && (xo->flags & CRYPTO_DONE)) { if (xo && (xo->flags & CRYPTO_DONE)) {
......
...@@ -536,7 +536,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -536,7 +536,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
switch (skb->protocol) { switch (skb->protocol) {
case htons(ETH_P_IPV6): case htons(ETH_P_IPV6):
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
xfrm_decode_session(skb, &fl, AF_INET6); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET6);
if (!dst) { if (!dst) {
fl.u.ip6.flowi6_oif = dev->ifindex; fl.u.ip6.flowi6_oif = dev->ifindex;
fl.u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC; fl.u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
...@@ -551,7 +551,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -551,7 +551,7 @@ static netdev_tx_t xfrmi_xmit(struct sk_buff *skb, struct net_device *dev)
break; break;
case htons(ETH_P_IP): case htons(ETH_P_IP):
memset(IPCB(skb), 0, sizeof(*IPCB(skb))); memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
xfrm_decode_session(skb, &fl, AF_INET); xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET);
if (!dst) { if (!dst) {
struct rtable *rt; struct rtable *rt;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment