netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Atis Elsts <atis@mikrotik.com>
Cc: Laszlo Attila Toth <panther@balabit.hu>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] Use sk_mark for routing lookup in more places
Date: Thu, 01 Oct 2009 18:30:06 +0200	[thread overview]
Message-ID: <4AC4D90E.3040008@gmail.com> (raw)
In-Reply-To: <200910011814.47689.atis@mikrotik.com>

Atis Elsts a écrit :
> This patch against v2.6.31 adds support for route lookup using sk_mark in some 
> more places. The benefits from this patch are the following.
> First, SO_MARK option now has effect on UDP sockets too.
> Second, ip_queue_xmit() and inet_sk_rebuild_header() could fail to do routing 
> lookup correctly if TCP sockets with SO_MARK were used.
> 
> Signed-off-by: Atis Elsts <atis@mikrotik.com>

Good catch, thanks !

I used SO_MARK on connected UDP sockets so did not notice the lack
of functionality. (ip_route_connect() does use sk->sk_mark)

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

> ---
>  net/ipv4/af_inet.c   |    1 +
>  net/ipv4/ip_output.c |    1 +
>  net/ipv4/udp.c       |    1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 566ea6c..7917963 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -1103,6 +1103,7 @@ int inet_sk_rebuild_header(struct sock *sk)
>  {
>         struct flowi fl = {
>                 .oif = sk->sk_bound_dev_if,
> +               .mark = sk->sk_mark,
>                 .nl_u = {
>                         .ip4_u = {
>                                 .daddr  = daddr,
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 7ffcd96..e088a97 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -335,6 +335,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
> 
>                 {
>                         struct flowi fl = { .oif = sk->sk_bound_dev_if,
> +                                           .mark = sk->sk_mark,
>                                             .nl_u = { .ip4_u =
>                                                       { .daddr = daddr,
>                                                         .saddr = inet->saddr,
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 80e3812..f90cdcc 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -688,6 +688,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 
> struct msghdr *msg,
> 
>         if (rt == NULL) {
>                 struct flowi fl = { .oif = ipc.oif,
> +                                   .mark = sk->sk_mark,
>                                     .nl_u = { .ip4_u =
>                                               { .daddr = faddr,
>                                                 .saddr = saddr,
> --


  reply	other threads:[~2009-10-01 16:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 15:14 [PATCH] Use sk_mark for routing lookup in more places Atis Elsts
2009-10-01 16:30 ` Eric Dumazet [this message]
2009-10-01 22:18   ` David Miller
2009-10-02  5:14     ` Eric Dumazet
2009-10-02  6:08       ` Eric Dumazet
2009-10-02 17:25         ` Maciej Żenczykowski
2009-10-02 18:00           ` David Miller
2009-10-02 18:19           ` [PATCH] Use sk_mark for IPv6 routing lookups Brian Haley
2009-10-05 12:55             ` Atis Elsts
2009-10-05 18:24               ` Brian Haley
2009-10-07  8:29             ` David Miller
2009-10-07  8:27       ` [PATCH] Use sk_mark for routing lookup in more places 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=4AC4D90E.3040008@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=atis@mikrotik.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=panther@balabit.hu \
    /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).