From: Tom Herbert <tom@herbertland.com>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Shrijeet Mukherjee <shm@cumulusnetworks.com>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
gospo@cumulusnetworks.com, jtoppins@cumulusnetworks.com,
nikolay@cumulusnetworks.com, ddutt@cumulusnetworks.com,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Stephen Hemminger <stephen@networkplumber.org>,
hadi@mojatatu.com, "Eric W. Biederman" <ebiederm@xmission.com>,
"David S. Miller" <davem@davemloft.net>,
svaidya@brocade.com
Subject: Re: [PATCH net-next 04/11] udp: Handle VRF device in sendmsg
Date: Fri, 14 Aug 2015 09:27:32 -0700 [thread overview]
Message-ID: <CALx6S34ymDARX9EjCUZtHzd=+iUpry5WbCR4axXSDFBhVSTDUw@mail.gmail.com> (raw)
In-Reply-To: <1439499551-90231-5-git-send-email-dsa@cumulusnetworks.com>
On Thu, Aug 13, 2015 at 1:59 PM, David Ahern <dsa@cumulusnetworks.com> wrote:
> For unconnected UDP sockets using a VRF device lookup source address
> based on VRF table. This allows the UDP header to be properly setup
> before showing up at the VRF device via the dst.
>
> Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
> ---
> net/ipv4/udp.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 83aa604f9273..7af5052e3b1f 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1013,11 +1013,31 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
>
> if (!rt) {
> struct net *net = sock_net(sk);
> + __u8 flow_flags = inet_sk_flowi_flags(sk);
>
> fl4 = &fl4_stack;
> +
> + /* unconnected socket. If output device is enslaved to a VRF
> + * device lookup source address from VRF table. This mimics
> + * behavior of ip_route_connect{_init}.
> + */
> + if (netif_index_is_vrf(net, ipc.oif)) {
> + flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
> + RT_SCOPE_UNIVERSE, sk->sk_protocol,
> + (flow_flags | FLOWI_FLAG_VRFSRC),
> + faddr, saddr, dport,
> + inet->inet_sport);
> +
> + rt = ip_route_output_flow(net, fl4, sk);
> + if (!IS_ERR(rt)) {
> + saddr = fl4->saddr;
> + ip_rt_put(rt);
> + }
> + }
> +
I really don't like this. It seems like you're putting device specific
code in a critical L4 data path function. Also, does ipv6/udp.c need
be updated similarly? Why can't VRF be abstracted out in routing
lookups?
Tom
> flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
> RT_SCOPE_UNIVERSE, sk->sk_protocol,
> - inet_sk_flowi_flags(sk),
> + flow_flags,
> faddr, saddr, dport, inet->inet_sport);
>
> security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
> --
> 2.3.2 (Apple Git-55)
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-08-14 16:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 20:58 [PATCH net-next 00/10] VRF-lite - v6 David Ahern
2015-08-13 20:59 ` [PATCH net-next 01/11] net: Introduce VRF related flags and helpers David Ahern
2015-08-13 20:59 ` [PATCH net-next 02/11] net: Use VRF device index for lookups on RX David Ahern
2015-08-13 20:59 ` [PATCH net-next 03/11] net: Use VRF device index for lookups on TX David Ahern
2015-08-13 20:59 ` [PATCH net-next 04/11] udp: Handle VRF device in sendmsg David Ahern
2015-08-14 16:27 ` Tom Herbert [this message]
[not found] ` <CAJmoNQGorXyd_vjigkJGntdNMmwMhL8AUfxA+s98uaY9ia73Gw@mail.gmail.com>
2015-08-15 3:16 ` Tom Herbert
2015-08-15 5:29 ` David Ahern
2015-08-13 20:59 ` [PATCH net-next 05/11] net: Add inet_addr lookup by table David Ahern
2015-08-13 20:59 ` [PATCH net-next 06/11] net: Fix up inet_addr_type checks David Ahern
2015-08-13 20:59 ` [PATCH net-next 07/11] net: Add routes to the table associated with the device David Ahern
2015-08-13 20:59 ` [PATCH net-next 08/11] net: Use passed in table for nexthop lookups David Ahern
2015-08-13 20:59 ` [PATCH net-next 09/11] net: Use VRF index for oif in ip_send_unicast_reply David Ahern
2015-08-13 20:59 ` [PATCH net-next 10/11] net: frags: Add VRF device index to cache and lookup David Ahern
2015-08-13 20:59 ` [PATCH net-next 11/11] net: Introduce VRF device driver David Ahern
2015-08-13 20:59 ` [PATCH net-next] iproute2: Add support for VRF device David Ahern
2015-08-14 5:45 ` [PATCH net-next 00/10] VRF-lite - v6 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='CALx6S34ymDARX9EjCUZtHzd=+iUpry5WbCR4axXSDFBhVSTDUw@mail.gmail.com' \
--to=tom@herbertland.com \
--cc=davem@davemloft.net \
--cc=ddutt@cumulusnetworks.com \
--cc=dsa@cumulusnetworks.com \
--cc=ebiederm@xmission.com \
--cc=gospo@cumulusnetworks.com \
--cc=hadi@mojatatu.com \
--cc=hannes@stressinduktion.org \
--cc=jtoppins@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
--cc=shm@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=svaidya@brocade.com \
/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;
as well as URLs for NNTP newsgroup(s).