Netdev List
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Simon Horman <horms@verge.net.au>
Cc: lvs-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH] ipvs: remove extra lookups for ICMP packets
Date: Wed, 9 Feb 2011 02:26:38 +0200 (EET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1102090222020.3494@ja.ssi.bg> (raw)


 	Remove code that should not be called anymore.
Now when ip_vs_out handles replies for local clients at
LOCAL_IN hook we do not need to call conn_out_get and
handle_response_icmp from ip_vs_in_icmp* because such
lookups were already performed for the ICMP packet and no
connection was found.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
---

 	Patch is against lvs-test-2.6 from 09-FEB-2011
but should apply cleanly to net-next.

--- lvs-test-2.6-7c9989a/net/netfilter/ipvs/ip_vs_core.c	2011-02-07 13:40:00.000000000 +0200
+++ linux/net/netfilter/ipvs/ip_vs_core.c	2011-02-09 02:02:53.135352388 +0200
@@ -729,7 +729,7 @@ void ip_vs_nat_icmp_v6(struct sk_buff *s
  #endif

  /* Handle relevant response ICMP messages - forward to the right
- * destination host. Used for NAT and local client.
+ * destination host.
   */
  static int handle_response_icmp(int af, struct sk_buff *skb,
  				union nf_inet_addr *snet,
@@ -979,7 +979,6 @@ static inline int is_tcp_reset(const str
  }

  /* Handle response packets: rewrite addresses and send away...
- * Used for NAT and local client.
   */
  static unsigned int
  handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
@@ -1280,7 +1279,6 @@ ip_vs_in_icmp(struct sk_buff *skb, int *
  	struct ip_vs_protocol *pp;
  	struct ip_vs_proto_data *pd;
  	unsigned int offset, ihl, verdict;
-	union nf_inet_addr snet;

  	*related = 1;

@@ -1339,17 +1337,8 @@ ip_vs_in_icmp(struct sk_buff *skb, int *
  	ip_vs_fill_iphdr(AF_INET, cih, &ciph);
  	/* The embedded headers contain source and dest in reverse order */
  	cp = pp->conn_in_get(AF_INET, skb, &ciph, offset, 1);
-	if (!cp) {
-		/* The packet could also belong to a local client */
-		cp = pp->conn_out_get(AF_INET, skb, &ciph, offset, 1);
-		if (cp) {
-			snet.ip = iph->saddr;
-			return handle_response_icmp(AF_INET, skb, &snet,
-						    cih->protocol, cp, pp,
-						    offset, ihl);
-		}
+	if (!cp)
  		return NF_ACCEPT;
-	}

  	verdict = NF_DROP;

@@ -1395,7 +1384,6 @@ ip_vs_in_icmp_v6(struct sk_buff *skb, in
  	struct ip_vs_protocol *pp;
  	struct ip_vs_proto_data *pd;
  	unsigned int offset, verdict;
-	union nf_inet_addr snet;
  	struct rt6_info *rt;

  	*related = 1;
@@ -1455,18 +1443,8 @@ ip_vs_in_icmp_v6(struct sk_buff *skb, in
  	ip_vs_fill_iphdr(AF_INET6, cih, &ciph);
  	/* The embedded headers contain source and dest in reverse order */
  	cp = pp->conn_in_get(AF_INET6, skb, &ciph, offset, 1);
-	if (!cp) {
-		/* The packet could also belong to a local client */
-		cp = pp->conn_out_get(AF_INET6, skb, &ciph, offset, 1);
-		if (cp) {
-			ipv6_addr_copy(&snet.in6, &iph->saddr);
-			return handle_response_icmp(AF_INET6, skb, &snet,
-						    cih->nexthdr,
-						    cp, pp, offset,
-						    sizeof(struct ipv6hdr));
-		}
+	if (!cp)
  		return NF_ACCEPT;
-	}

  	verdict = NF_DROP;


             reply	other threads:[~2011-02-09  0:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  0:26 Julian Anastasov [this message]
2011-02-15 22:32 ` [PATCH] ipvs: remove extra lookups for ICMP packets Simon Horman

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=alpine.LFD.2.00.1102090222020.3494@ja.ssi.bg \
    --to=ja@ssi.bg \
    --cc=horms@verge.net.au \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.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