IPVS
Subsystems (4)
Simon Horman
maintainercover IPVS
Hi Dave,
as mentioned earlier today I have a handful of IPVS patches queued up. Please consider them for net-next.
Simon Horman
maintainerPATCH v2 1/4 IPVS: ICMPv6 checksum calculation
net/netfilter/ipvs/ip_vs_core.c +5 -3
@@ -637,9 +637,11 @@ void ip_vs_nat_icmp_v6(struct sk_buff *s }/* And finally the ICMP checksum */ - icmph->icmp6_cksum =0 ; -/* TODO IPv6: is this correct for ICMPv6? */ -ip_vs_checksum_complete (skb, icmp_offset); + icmph->icmp6_cksum = ~csum_ipv6_magic (&iph->saddr, &iph->daddr, + skb->len - icmp_offset, +IPPROTO_ICMPV6 ,0 ); + skb->csum_start =skb_network_header (skb) - skb->head + icmp_offset; + skb->csum_offset = offsetof(struct icmp6hdr , icmp6_cksum); skb->ip_summed =CHECKSUM_UNNECESSARY ;if (inout)
Julian Anastasov
maintainerRe: [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation
Hello,
Quoted 11 lines · Simon Horman
Cc Xiaoyu Du <[email protected]>Signed-off-by Julian Anastasov <[email protected]>Signed-off-by Simon Horman <[email protected]>Index:
nf-next-2.6/net/netfilter/ipvs/ip_vs_core.c
===================================================================net/netfilter/ipvs/ip_vs_core.c +0
-0@@ -637,9 +637,11 @@ void ip_vs_nat_icmp_v6(struct sk_buff *s }
net/netfilter/ipvs/ip_vs_core.c void ip_vs_nat_icmp_v6(struct sk_buff *s · line 645
Quoted 10 lines
net/netfilter/ipvs/ip_vs_core.c +5
-3/* And finally the ICMP checksum */ - icmph->icmp6_cksum =0 ; -/* TODO IPv6: is this correct for ICMPv6? */ -ip_vs_checksum_complete (skb, icmp_offset); + icmph->icmp6_cksum = ~csum_ipv6_magic (&iph->saddr, &iph->daddr, + skb->len - icmp_offset, +IPPROTO_ICMPV6 ,0 ); + skb->csum_start =skb_network_header (skb) - skb->head + icmp_offset; + skb->csum_offset = offsetof(struct icmp6hdr , icmp6_cksum); skb->ip_summed =CHECKSUM_UNNECESSARY ;
Ops, this should be CHECKSUM_PARTIAL
net/netfilter/ipvs/ip_vs_core.c void ip_vs_nat_icmp_v6(struct sk_buff *s · line 647
Quoted 1 line
net/netfilter/ipvs/ip_vs_core.c +0
-0if (inout)
Regards
--
Julian Anastasov <[email protected]>
David Miller
maintainerRe: [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation
From: Julian Anastasov <[email protected]>
Date: Thu, 26 Aug 2010 22:36:24 +0300 (EEST)
Quoted 4 lines
net/netfilter/ipvs/ip_vs_core.c void ip_vs_nat_icmp_v6(struct sk_buff *s · line 645
Quoted 2 lines
net/netfilter/ipvs/ip_vs_core.c +1
-0+ skb->csum_offset = offsetof(struct icmp6hdr , icmp6_cksum); skb->ip_summed =CHECKSUM_UNNECESSARY ;Ops, this should be
CHECKSUM_PARTIAL
I'll fix this up when I apply the patch.
Simon Horman
maintainerPATCH 2/4 IPVS: convert __ip_vs_sched_lock to a spinlock
In reply to Simon HormanAlso rename __ip_vs_sched_lock to ip_vs_sched_lock.
---
Compile tested only
net/netfilter/ipvs/ip_vs_sched.c +11 -11
@@ -35,7 +35,7 @@static LIST_HEAD (ip_vs_schedulers);/* lock for service table */ -static DEFINE_RWLOCK (__ip_vs_sched_lock); +static DEFINE_SPINLOCK (ip_vs_sched_lock);/*
@@ -108,7 +108,7 @@ static struct ip_vs_scheduler *ip_vs_schIP_VS_DBG (2 ,"%s(): sched_name \"%s\"\n" , __func__, sched_name); -read_lock_bh (&__ip_vs_sched_lock); +spin_lock_bh (&ip_vs_sched_lock);list_for_each_entry (sched, &ip_vs_schedulers, n_list) {/*
@@ -122,14 +122,14 @@ static struct ip_vs_scheduler *ip_vs_sch }if (strcmp (sched_name, sched->name)==0 ) {/* HIT */ -read_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);return sched; }if (sched->module)module_put (sched->module); } -read_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);return NULL ; }
@@ -184,10 +184,10 @@ int register_ip_vs_scheduler(struct ip_v/* increase the module use count */ ip_vs_use_count_inc (); -write_lock_bh (&__ip_vs_sched_lock); +spin_lock_bh (&ip_vs_sched_lock);if (!list_empty (&scheduler->n_list)) { -write_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);ip_vs_use_count_dec ();pr_err ("%s(): [%s] scheduler already linked\n" , __func__, scheduler->name);
@@ -200,7 +200,7 @@ int register_ip_vs_scheduler(struct ip_v*/ list_for_each_entry (sched, &ip_vs_schedulers, n_list) {if (strcmp (scheduler->name, sched->name) ==0 ) { -write_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);ip_vs_use_count_dec ();pr_err ("%s(): [%s] scheduler already existed " "in the system\n" , __func__, scheduler->name);
@@ -211,7 +211,7 @@ int register_ip_vs_scheduler(struct ip_v* Add it into the d-linked scheduler list */ list_add (&scheduler->n_list, &ip_vs_schedulers); -write_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);pr_info ("[%s] scheduler registered.\n" , scheduler->name);
@@ -229,9 +229,9 @@ int unregister_ip_vs_scheduler(struct ipreturn -EINVAL ; } -write_lock_bh (&__ip_vs_sched_lock); +spin_lock_bh (&ip_vs_sched_lock);if (list_empty (&scheduler->n_list)) { -write_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);pr_err ("%s(): [%s] scheduler is not in the list. failed\n" , __func__, scheduler->name);return -EINVAL ;
@@ -241,7 +241,7 @@ int unregister_ip_vs_scheduler(struct ip* Remove it from the d-linked scheduler list */ list_del (&scheduler->n_list); -write_unlock_bh (&__ip_vs_sched_lock); +spin_unlock_bh (&ip_vs_sched_lock);/* decrease the module use count */ ip_vs_use_count_dec ();
Simon Horman
maintainerPATCH 3/4 IPVS: convert __ip_vs_securetcp_lock to a spinlock
In reply to Simon HormanAlso rename __ip_vs_securetcp_lock to ip_vs_securetcp_lock.
Spinlock conversion was suggested by Eric Dumazet.
---
Compile tested only
net/netfilter/ipvs/ip_vs_ctl.c +3 -3
@@ -61,7 +61,7 @@ static DEFINE_RWLOCK(__ip_vs_svc_lock);static DEFINE_RWLOCK (__ip_vs_rs_lock);/* lock for state and timeout tables */ -static DEFINE_RWLOCK (__ip_vs_securetcp_lock); +static DEFINE_SPINLOCK (ip_vs_securetcp_lock);/* lock for drop entry handling */ static DEFINE_SPINLOCK (__ip_vs_dropentry_lock);
@@ -204,7 +204,7 @@ static void update_defense_level(void)spin_unlock (&__ip_vs_droppacket_lock);/* secure_tcp */ -write_lock (&__ip_vs_securetcp_lock); +spin_lock (&ip_vs_securetcp_lock);switch (sysctl_ip_vs_secure_tcp) {case 0 :if (old_secure_tcp >=2 )
@@ -238,7 +238,7 @@ static void update_defense_level(void) old_secure_tcp = sysctl_ip_vs_secure_tcp;if (to_change >=0 )ip_vs_protocol_timeout_change (sysctl_ip_vs_secure_tcp>1 ); -write_unlock (&__ip_vs_securetcp_lock); +spin_unlock (&ip_vs_securetcp_lock);local_bh_enable (); }
Simon Horman
maintainerPATCH 4/4 ipvs: switch to GFP_KERNEL allocations
In reply to Simon HormanSwitch from GFP_ATOMIC allocations to GFP_KERNEL ones in ip_vs_add_service() and ip_vs_new_dest(), as we hold a mutex and are allowed to sleep in this context.
--- net/netfilter/ipvs/ip_vs_ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +2 -2
@@ -843,7 +843,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,return -EINVAL ; } - dest =kzalloc (sizeof (struct ip_vs_dest ),GFP_ATOMIC ); + dest =kzalloc (sizeof (struct ip_vs_dest ),GFP_KERNEL );if (dest ==NULL ) {pr_err ("%s(): no memory.\n" , __func__);return -ENOMEM ;
@@ -1177,7 +1177,7 @@ ip_vs_add_service(struct ip_vs_service_user_kern *u, }#endif - svc =kzalloc (sizeof (struct ip_vs_service ),GFP_ATOMIC ); + svc =kzalloc (sizeof (struct ip_vs_service ),GFP_KERNEL );if (svc ==NULL ) {IP_VS_DBG (1 ,"%s(): no memory\n" , __func__); ret = -ENOMEM ;
David Miller
maintainerFrom: Simon Horman <[email protected]>
Date: Thu, 26 Aug 2010 21:54:27 +0900
Quoted 4 lines
Hi Dave,
as mentioned earlier today I have a handful of IPVS patches queued up. Please consider them for net-next.
All applied with the CHECKSUM_PARTIAL fix as noticed by Julian.
Simon Horman
maintainerQuoted 9 lines · David Miller
From: Simon Horman <[email protected]>
Date: Thu, 26 Aug 2010 21:54:27 +0900Quoted 4 lines
Hi Dave,
as mentioned earlier today I have a handful of IPVS patches queued up. Please consider them for net-next.
All applied with the
CHECKSUM_PARTIALfix as noticed by Julian.
Thanks Dave.