Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c145dce authored by Florian Westphal's avatar Florian Westphal Committed by Steffen Klassert
Browse files

xfrm: make xfrm modes builtin



after previous changes, xfrm_mode contains no function pointers anymore
and all modules defining such struct contain no code except an init/exit
functions to register the xfrm_mode struct with the xfrm core.

Just place the xfrm modes core and remove the modules,
the run-time xfrm_mode register/unregister functionality is removed.

Before:

    text    data     bss      dec filename
    7523     200    2364    10087 net/xfrm/xfrm_input.o
   40003     628     440    41071 net/xfrm/xfrm_state.o
15730338 6937080 4046908 26714326 vmlinux

    7389     200    2364    9953  net/xfrm/xfrm_input.o
   40574     656     440   41670  net/xfrm/xfrm_state.o
15730084 6937068 4046908 26714060 vmlinux

The xfrm*_mode_{transport,tunnel,beet} modules are gone.

v2: replace CONFIG_INET6_XFRM_MODE_* IS_ENABLED guards with CONFIG_IPV6
    ones rather than removing them.

Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Reviewed-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 733a5fac
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -234,9 +234,9 @@ struct xfrm_state {
	/* Reference to data common to all the instances of this
	 * transformer. */
	const struct xfrm_type	*type;
	struct xfrm_mode	*inner_mode;
	struct xfrm_mode	*inner_mode_iaf;
	struct xfrm_mode	*outer_mode;
	const struct xfrm_mode	*inner_mode;
	const struct xfrm_mode	*inner_mode_iaf;
	const struct xfrm_mode	*outer_mode;

	const struct xfrm_type_offload	*type_offload;

@@ -347,7 +347,6 @@ struct xfrm_state_afinfo {
	struct module			*owner;
	const struct xfrm_type		*type_map[IPPROTO_MAX];
	const struct xfrm_type_offload	*type_offload_map[IPPROTO_MAX];
	struct xfrm_mode		*mode_map[XFRM_MODE_MAX];

	int			(*init_flags)(struct xfrm_state *x);
	void			(*init_tempsel)(struct xfrm_selector *sel,
@@ -423,7 +422,6 @@ int xfrm_register_type_offload(const struct xfrm_type_offload *type, unsigned sh
int xfrm_unregister_type_offload(const struct xfrm_type_offload *type, unsigned short family);

struct xfrm_mode {
	struct module *owner;
	u8 encap;
	u8 family;
	u8 flags;
@@ -434,9 +432,6 @@ enum {
	XFRM_MODE_FLAG_TUNNEL = 1,
};

int xfrm_register_mode(struct xfrm_mode *mode);
void xfrm_unregister_mode(struct xfrm_mode *mode);

static inline int xfrm_af2proto(unsigned int family)
{
	switch(family) {
@@ -449,7 +444,7 @@ static inline int xfrm_af2proto(unsigned int family)
	}
}

static inline struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto)
static inline const struct xfrm_mode *xfrm_ip2inner_mode(struct xfrm_state *x, int ipproto)
{
	if ((ipproto == IPPROTO_IPIP && x->props.family == AF_INET) ||
	    (ipproto == IPPROTO_IPV6 && x->props.family == AF_INET6))
+1 −28
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ config NET_IPVTI
	tristate "Virtual (secure) IP: tunneling"
	select INET_TUNNEL
	select NET_IP_TUNNEL
	depends on INET_XFRM_MODE_TUNNEL
	select XFRM
	---help---
	  Tunneling means encapsulating data of one protocol type within
	  another protocol and sending it over a channel that understands the
@@ -396,33 +396,6 @@ config INET_TUNNEL
	tristate
	default n

config INET_XFRM_MODE_TRANSPORT
	tristate "IP: IPsec transport mode"
	default y
	select XFRM
	---help---
	  Support for IPsec transport mode.

	  If unsure, say Y.

config INET_XFRM_MODE_TUNNEL
	tristate "IP: IPsec tunnel mode"
	default y
	select XFRM
	---help---
	  Support for IPsec tunnel mode.

	  If unsure, say Y.

config INET_XFRM_MODE_BEET
	tristate "IP: IPsec BEET mode"
	default y
	select XFRM
	---help---
	  Support for IPsec BEET mode.

	  If unsure, say Y.

config INET_DIAG
	tristate "INET: socket monitoring interface"
	default y
+0 −3
Original line number Diff line number Diff line
@@ -37,10 +37,7 @@ obj-$(CONFIG_INET_ESP) += esp4.o
obj-$(CONFIG_INET_ESP_OFFLOAD) += esp4_offload.o
obj-$(CONFIG_INET_IPCOMP) += ipcomp.o
obj-$(CONFIG_INET_XFRM_TUNNEL) += xfrm4_tunnel.o
obj-$(CONFIG_INET_XFRM_MODE_BEET) += xfrm4_mode_beet.o
obj-$(CONFIG_INET_TUNNEL) += tunnel4.o
obj-$(CONFIG_INET_XFRM_MODE_TRANSPORT) += xfrm4_mode_transport.o
obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o
obj-$(CONFIG_IP_PNP) += ipconfig.o
obj-$(CONFIG_NETFILTER)	+= netfilter.o netfilter/
obj-$(CONFIG_INET_DIAG) += inet_diag.o
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err)
	struct net_device *dev;
	struct pcpu_sw_netstats *tstats;
	struct xfrm_state *x;
	struct xfrm_mode *inner_mode;
	const struct xfrm_mode *inner_mode;
	struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4;
	u32 orig_mark = skb->mark;
	int ret;

net/ipv4/xfrm4_mode_beet.c

deleted100644 → 0
+0 −41
Original line number Diff line number Diff line
/*
 * xfrm4_mode_beet.c - BEET mode encapsulation for IPv4.
 *
 * Copyright (c) 2006 Diego Beltrami <diego.beltrami@gmail.com>
 *                    Miika Komu     <miika@iki.fi>
 *                    Herbert Xu     <herbert@gondor.apana.org.au>
 *                    Abhinav Pathak <abhinav.pathak@hiit.fi>
 *                    Jeff Ahrenholz <ahrenholz@gmail.com>
 */

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/stringify.h>
#include <net/dst.h>
#include <net/ip.h>
#include <net/xfrm.h>


static struct xfrm_mode xfrm4_beet_mode = {
	.owner = THIS_MODULE,
	.encap = XFRM_MODE_BEET,
	.flags = XFRM_MODE_FLAG_TUNNEL,
	.family = AF_INET,
};

static int __init xfrm4_beet_init(void)
{
	return xfrm_register_mode(&xfrm4_beet_mode);
}

static void __exit xfrm4_beet_exit(void)
{
	xfrm_unregister_mode(&xfrm4_beet_mode);
}

module_init(xfrm4_beet_init);
module_exit(xfrm4_beet_exit);
MODULE_LICENSE("GPL");
MODULE_ALIAS_XFRM_MODE(AF_INET, XFRM_MODE_BEET);
Loading