pull request (net-next): ipsec-next 2013-08-22
Subsystems (3)
Steffen Klassert
maintainerPATCH 2/6 af_key: constify lookup tables
In reply to Steffen KlassertFrom: Mathias Krause <[email protected]>
The lookup tables for minimum sizes of extensions and for the pfkey handler functions are read only, therefore can be const.
--- net/key/af_key.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/key/af_key.c +2 -2
@@ -338,7 +338,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk)return 0 ; } -static u8 sadb_ext_min_len[] = { +static const u8 sadb_ext_min_len[] = { [SADB_EXT_RESERVED ] = (u8 )0 , [SADB_EXT_SA ] = (u8 )sizeof (struct sadb_sa ), [SADB_EXT_LIFETIME_CURRENT ] = (u8 )sizeof (struct sadb_lifetime ),
@@ -2737,7 +2737,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, const struct sadtypedef int (*pfkey_handler )(struct sock *sk,struct sk_buff *skb,const struct sadb_msg *hdr,void *const *ext_hdrs); -static pfkey_handler pfkey_funcs[SADB_MAX +1 ] = { +static const pfkey_handler pfkey_funcs[SADB_MAX +1 ] = { [SADB_RESERVED ] = pfkey_reserved, [SADB_GETSPI ] = pfkey_getspi, [SADB_UPDATE ] = pfkey_add,
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainerPATCH 3/6 xfrm: Delete hold_timer when destroy policy
In reply to Steffen KlassertFrom: Fan Du <[email protected]>
Both policy timer and hold_timer need to be deleted when destroy policy
--- net/xfrm/xfrm_policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +1 -1
@@ -308,7 +308,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy) {BUG_ON (!policy->walk.dead); -if (del_timer (&policy->timer)) +if (del_timer (&policy->timer) ||del_timer (&policy->polq.hold_timer))BUG ();security_xfrm_policy_free (policy->security);
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainerPATCH 1/6 xfrm: constify mark argument of xfrm_find_acq()
In reply to Steffen KlassertFrom: Mathias Krause <[email protected]>
The mark argument is read only, so constify it. Also make dummy_mark in af_key const -- only used as dummy argument for this very function.
--- include/net/xfrm.h | 2 +- net/key/af_key.c | 2 +- net/xfrm/xfrm_state.c | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-)
include/net/xfrm.h +1 -1
@@ -1548,7 +1548,7 @@ struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32int xfrm_policy_flush (struct net *net,u8 type,struct xfrm_audit *audit_info);u32 xfrm_get_acqseq (void );extern int xfrm_alloc_spi (struct xfrm_state *x,u32 minspi,u32 maxspi); -struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, +struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark, u8 mode, u32 reqid, u8 proto, const xfrm_address_t *daddr, const xfrm_address_t *saddr, int create,
net/key/af_key.c +1 -1
@@ -45,7 +45,7 @@ struct netns_pfkey {static DEFINE_MUTEX (pfkey_mutex);#define DUMMY_MARK 0 -static struct xfrm_mark dummy_mark = {0 ,0 }; +static const struct xfrm_mark dummy_mark = {0 ,0 };struct pfkey_sock {/* struct sock must be the first member of struct pfkey_sock */ struct sock sk;
net/xfrm/xfrm_state.c +7 -5
@@ -990,11 +990,13 @@ void xfrm_state_insert(struct xfrm_state *x)EXPORT_SYMBOL (xfrm_state_insert);/* xfrm_state_lock is held */ -static struct xfrm_state *__find_acq_core (struct net *net,struct xfrm_mark *m, +static struct xfrm_state *__find_acq_core (struct net *net, +const struct xfrm_mark *m,unsigned short family,u8 mode,u32 reqid,u8 proto,const xfrm_address_t *daddr, -const xfrm_address_t *saddr,int create) +const xfrm_address_t *saddr, +int create) {unsigned int h =xfrm_dst_hash (net, daddr, saddr, reqid, family);struct xfrm_state *x;
@@ -1399,9 +1401,9 @@ xfrm_state_lookup_byaddr(struct net *net, u32 mark,EXPORT_SYMBOL (xfrm_state_lookup_byaddr);struct xfrm_state * -xfrm_find_acq (struct net *net,struct xfrm_mark *mark,u8 mode,u32 reqid,u8 proto, -const xfrm_address_t *daddr,const xfrm_address_t *saddr, -int create,unsigned short family) +xfrm_find_acq (struct net *net,const struct xfrm_mark *mark,u8 mode,u32 reqid, +u8 proto,const xfrm_address_t *daddr, +const xfrm_address_t *saddr,int create,unsigned short family) {struct xfrm_state *x;
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainerPATCH 4/6 xfrm: Remove rebundant address family checking
In reply to Steffen KlassertFrom: Fan Du <[email protected]>
present_and_same_family has checked addresses family validness for both SADB_EXT_ADDRESS_SRC and SADB_EXT_ADDRESS_DST in the beginning. Thereafter pfkey_sadb_addr2xfrm_addr doesn't need to do the checking again.
--- net/key/af_key.c | 8 -------- 1 file changed, 8 deletions(-)
net/key/af_key.c +0 -8
@@ -1196,10 +1196,6 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, x->props.family =pfkey_sadb_addr2xfrm_addr ((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC -1 ], &x->props.saddr); -if (!x->props.family) { - err = -EAFNOSUPPORT ; - goto out; - }pfkey_sadb_addr2xfrm_addr ((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST -1 ], &x->id.daddr);
@@ -2205,10 +2201,6 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ sa = ext_hdrs[SADB_EXT_ADDRESS_SRC -1 ]; xp->family =pfkey_sadb_addr2xfrm_addr (sa, &xp->selector.saddr); -if (!xp->family) { - err = -EINVAL ; - goto out; - } xp->selector.family = xp->family; xp->selector.prefixlen_s = sa->sadb_address_prefixlen; xp->selector.proto =pfkey_proto_to_xfrm (sa->sadb_address_proto);
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainerPATCH 5/6 xfrm: Make xfrm_state timer monotonic
In reply to Steffen KlassertFrom: Fan Du <[email protected]>
xfrm_state timer should be independent of system clock change, so switch to CLOCK_BOOTTIME base which is not only monotonic but also counting suspend time.
Thus issue reported in commit: 9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 ("xfrm: SAD entries do not expire correctly after suspend-resume") could ALSO be avoided.
v2: Use CLOCK_BOOTTIME to count suspend time, but still monotonic.
--- net/xfrm/xfrm_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/xfrm/xfrm_state.c +2 -1
@@ -499,7 +499,8 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)INIT_HLIST_NODE (&x->bydst);INIT_HLIST_NODE (&x->bysrc);INIT_HLIST_NODE (&x->byspi); -tasklet_hrtimer_init (&x->mtimer, xfrm_timer_handler,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +tasklet_hrtimer_init (&x->mtimer, xfrm_timer_handler, +CLOCK_BOOTTIME ,HRTIMER_MODE_ABS );setup_timer (&x->rtimer, xfrm_replay_timer_handler, (unsigned long )x); x->curlft.add_time =get_seconds ();
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainerPATCH 6/6 xfrm: remove irrelevant comment in xfrm_input().
In reply to Steffen KlassertFrom: Rami Rosen <[email protected]>
This patch removes a comment in xfrm_input() which became irrelevant due to commit 2774c13, "xfrm: Handle blackhole route creation via afinfo". That commit removed returning -EREMOTE in the xfrm_lookup() method when the packet should be discarded and also removed the correspoinding -EREMOTE handlers. This was replaced by calling the make_blackhole() method. Therefore the comment about -EREMOTE is not relevant anymore.
--- net/xfrm/xfrm_policy.c | 2 -- 1 file changed, 2 deletions(-)
net/xfrm/xfrm_policy.c +0 -2
@@ -2132,8 +2132,6 @@ restart:* have the xfrm_state's. We need to wait for KM to * negotiate new SA's or bail out with error.*/ if (net->xfrm.sysctl_larval_drop) { -/* EREMOTE tells the caller to generate -* a one-shot blackhole route. */ dst_release (dst);xfrm_pols_put (pols, drop_pols);XFRM_INC_STATS (net,LINUX_MIB_XFRMOUTNOSTATES );
Signature · 1 line
1.7.9.5
Steffen Klassert
maintainer1) Some constifications, from Mathias Krause.
2) Catch bugs if a hold timer is still active when xfrm_policy_destroy() is called, from Fan Du.
3) Remove a redundant address family checking, from Fan Du.
4) Make xfrm_state timer monotonic to be independent of system clock changes, from Fan Du.
5) Remove an outdated comment on returning -EREMOTE in the xfrm_lookup(), from Rami Rosen.
Please pull or let me know if there are problems.
Thanks!
The following changes since commit 5ca5461c3ee8b306c04ac833e5eacb5755b85d88:
vxlan: fix rcu related warning (2013-08-04 18:47:14 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master
for you to fetch changes up to e3fec5a1c5a1ab4a85ca3f4e41c626fb953ce162:
xfrm: remove irrelevant comment in xfrm_input(). (2013-08-19 12:45:16 +0200)
----------------------------------------------------------------
Fan Du (3):
xfrm: Delete hold_timer when destroy policy
xfrm: Remove rebundant address family checking
xfrm: Make xfrm_state timer monotonic
Mathias Krause (2):
xfrm: constify mark argument of xfrm_find_acq()
af_key: constify lookup tables
Rami Rosen (1):
xfrm: remove irrelevant comment in xfrm_input().
include/net/xfrm.h | 2 +- net/key/af_key.c | 14 +++----------- net/xfrm/xfrm_policy.c | 4 +--- net/xfrm/xfrm_state.c | 15 +++++++++------ 4 files changed, 14 insertions(+), 21 deletions(-)
David Miller
maintainerFrom: Steffen Klassert <[email protected]>
Date: Thu, 22 Aug 2013 13:12:04 +0200
Quoted 7 lines
1) Some constifications, from Mathias Krause.
2) Catch bugs if a hold timer is still active when
xfrm_policy_destroy()is called, from Fan Du.3) Remove a redundant address family checking, from Fan Du.
Quoted 7 lines
4) Make
xfrm_statetimer monotonic to be independent of system clock changes, from Fan Du.5) Remove an outdated comment on returning
-EREMOTEin thexfrm_lookup(), from Rami Rosen.Please pull or let me know if there are problems.
Pulled, thanks Steffen.