From patchwork Thu Oct 1 15:14:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atis Elsts X-Patchwork-Id: 34730 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id C74FFB7BC8 for ; Fri, 2 Oct 2009 01:16:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754146AbZJAPQa (ORCPT ); Thu, 1 Oct 2009 11:16:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753949AbZJAPQ3 (ORCPT ); Thu, 1 Oct 2009 11:16:29 -0400 Received: from bute.mt.lv ([159.148.172.196]:45846 "EHLO bute.mt.lv" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753792AbZJAPQ3 (ORCPT ); Thu, 1 Oct 2009 11:16:29 -0400 Received: from atis-desktop.local (unknown [10.0.0.128]) by bute.mt.lv (Postfix) with ESMTP id F346277B2; Thu, 1 Oct 2009 18:16:25 +0300 (EEST) From: Atis Elsts To: Laszlo Attila Toth Subject: [PATCH] Use sk_mark for routing lookup in more places Date: Thu, 1 Oct 2009 18:14:47 +0300 User-Agent: KMail/1.9.10 Cc: "David S. Miller" , netdev@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200910011814.47689.atis@mikrotik.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Acked-by: Eric Dumazet --- net/ipv4/af_inet.c | 1 + net/ipv4/ip_output.c | 1 + net/ipv4/udp.c | 1 + 3 files changed, 3 insertions(+) .saddr = saddr, -- 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 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,