aboutsummaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorGravatar Steffen Klassert <steffen.klassert@secunet.com> 2017-02-15 09:39:24 +0100
committerGravatar Steffen Klassert <steffen.klassert@secunet.com> 2017-02-15 09:39:24 +0100
commitb0fcee825c0ad05057a97d1f4685e1b9e9d00c53 (patch)
treecb431638b0972b632f8419c05afa682cd552c4ca /net/ipv6
parentxfrm: policy: make policy backend const (diff)
downloadlinux-b0fcee825c0ad05057a97d1f4685e1b9e9d00c53.tar.gz
linux-b0fcee825c0ad05057a97d1f4685e1b9e9d00c53.tar.bz2
linux-b0fcee825c0ad05057a97d1f4685e1b9e9d00c53.zip
xfrm: Add a secpath_set helper.
Add a new helper to set the secpath to the skb. This avoids code duplication, as this is used in multiple places. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/xfrm6_input.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index b5789562aded..662fb2c3e765 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -69,18 +69,9 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
struct xfrm_state *x = NULL;
int i = 0;
- /* Allocate new secpath or COW existing one. */
- if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) {
- struct sec_path *sp;
-
- sp = secpath_dup(skb->sp);
- if (!sp) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMINERROR);
- goto drop;
- }
- if (skb->sp)
- secpath_put(skb->sp);
- skb->sp = sp;
+ if (secpath_set(skb)) {
+ XFRM_INC_STATS(net, LINUX_MIB_XFRMINERROR);
+ goto drop;
}
if (1 + skb->sp->len == XFRM_MAX_DEPTH) {