Skip to content

Commit

Permalink
IPVS: Minimise ip_vs_leave when CONFIG_SYSCTL is undefined
Browse files Browse the repository at this point in the history
Much of ip_vs_leave() is unnecessary if CONFIG_SYSCTL is undefined.

I tried an approach of breaking the now #ifdef'ed portions out
into a separate function. However this appeared to grow the
compiled code on x86_64 by about 200 bytes in the case where
CONFIG_SYSCTL is defined. So I have gone with the simpler though
less elegant #ifdef'ed solution for now.

Signed-off-by: Simon Horman <horms@verge.net.au>
  • Loading branch information
Simon Horman committed Mar 15, 2011
1 parent a4e2f5a commit a7a86b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/netfilter/ipvs/ip_vs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,13 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
struct ip_vs_proto_data *pd)
{
struct net *net;
struct netns_ipvs *ipvs;
__be16 _ports[2], *pptr;
struct ip_vs_iphdr iph;
#ifdef CONFIG_SYSCTL
struct net *net;
struct netns_ipvs *ipvs;
int unicast;
#endif

ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph);

Expand All @@ -512,6 +514,8 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
ip_vs_service_put(svc);
return NF_DROP;
}

#ifdef CONFIG_SYSCTL
net = skb_net(skb);

#ifdef CONFIG_IP_VS_IPV6
Expand Down Expand Up @@ -563,6 +567,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
ip_vs_conn_put(cp);
return ret;
}
#endif

/*
* When the virtual ftp service is presented, packets destined
Expand Down

0 comments on commit a7a86b8

Please sign in to comment.