public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ@public.gmane.org>
To: Julian Anastasov <ja-FgGsKACvmQM@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sctp-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	YueHaibing <yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCHv3 net-next 5/7] net: add confirm_neigh method to dst_ops
Date: Wed, 1 Feb 2017 08:44:02 +0100	[thread overview]
Message-ID: <20170201074402.GX30338@gauss.secunet.com> (raw)
In-Reply-To: <1485899827-5212-6-git-send-email-ja-FgGsKACvmQM@public.gmane.org>

On Tue, Jan 31, 2017 at 11:57:05PM +0200, Julian Anastasov wrote:
>  
>  static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst)
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 177e208..c010ee0 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -2856,6 +2856,20 @@ static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst,
>  	return dst->path->ops->neigh_lookup(dst, skb, daddr);
>  }
>  
> +static void xfrm_confirm_neigh(const struct dst_entry *dst, const void *daddr)
> +{
> +	const struct dst_entry *path = dst->path;
> +
> +	if (path == dst) {

I think path can not be equal to dst here, otherwise we would
have an infinite recursion.

> +		dst->ops->confirm_neigh(dst, daddr);
> +	} else {
> +		/* daddr can be from different family and we need the
> +		 * tunnel address. How to get it?
> +		 */

This is only called on a xfrm_dst, so you should have dst->xfrm set.
You can get the daddr of this transform with:

xfrm_address_t *daddr = &xfrm->id.daddr;


> +		path->ops->confirm_neigh(path, NULL);

I think here it is better to go through the whole chain
of transformations with

child->ops->confirm_neigh(path, daddr);

> +	}
> +}
> +
>  int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
>  {
>  	int err = 0;
> @@ -2882,6 +2896,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
>  			dst_ops->link_failure = xfrm_link_failure;
>  		if (likely(dst_ops->neigh_lookup == NULL))
>  			dst_ops->neigh_lookup = xfrm_neigh_lookup;
> +		if (likely(!dst_ops->confirm_neigh))
> +			dst_ops->confirm_neigh = xfrm_confirm_neigh;

We also have address family depended dst_ops, look for
xfrm4_dst_ops_template/xfrm6_dst_ops_template.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-02-01  7:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 21:57 [PATCHv3 net-next 0/7] net: dst_confirm replacement Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 1/7] sock: add sk_dst_pending_confirm flag Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 2/7] net: add dst_pending_confirm flag to skbuff Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 3/7] sctp: add dst_pending_confirm flag Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 4/7] tcp: replace dst_confirm with sk_dst_confirm Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 5/7] net: add confirm_neigh method to dst_ops Julian Anastasov
     [not found]   ` <1485899827-5212-6-git-send-email-ja-FgGsKACvmQM@public.gmane.org>
2017-02-01  7:44     ` Steffen Klassert [this message]
     [not found]       ` <20170201074402.GX30338-QbcZoYm+z/4HCNZ7eMmnrgC/G2K4zDHf@public.gmane.org>
2017-02-01 23:04         ` Julian Anastasov
     [not found]           ` <alpine.LFD.2.11.1702012326130.2580-c1lBKlETG9EWAawoAK+ZAw@public.gmane.org>
2017-02-03  7:46             ` Steffen Klassert
2017-02-03  9:16               ` Julian Anastasov
     [not found]                 ` <alpine.LFD.2.11.1702031101550.2584-c1lBKlETG9EWAawoAK+ZAw@public.gmane.org>
2017-02-03 10:08                   ` Steffen Klassert
2017-01-31 21:57 ` [PATCHv3 net-next 6/7] net: use dst_confirm_neigh for UDP, RAW, ICMP, L2TP Julian Anastasov
2017-01-31 21:57 ` [PATCHv3 net-next 7/7] net: pending_confirm is not used anymore Julian Anastasov
     [not found] ` <1485899827-5212-1-git-send-email-ja-FgGsKACvmQM@public.gmane.org>
2017-02-03  1:52   ` [PATCHv3 net-next 0/7] net: dst_confirm replacement David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170201074402.GX30338@gauss.secunet.com \
    --to=steffen.klassert-opnxpl+3fjrbdgjk7y7tuq@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=ja-FgGsKACvmQM@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sctp-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox