[Openswan dev] [PATCH] remove satot calls when debug disabled
David McCullough
davidm at snapgear.com
Fri Feb 17 21:57:59 CET 2006
Hi dev,
Here's a sample patch for some feedback. Basically, there are a lot of
satot calls that get invoked even when debug is off. This has a
significant impact on VPN thoughput.
If people feel the approach and reasoning is sound I'll produce a full patch
for all the satot calls that need it. This is a cleaned up version of
what is already in the OCF patches.
The patch is against 2.4.5rc5, but I can do a git #public patch if
that is preferrable. That said how do people what to receive GIT
updates, patches or a git repo they can pull changes from ?
Cheers,
Davidm
--
David McCullough, davidm at cyberguard.com.au, Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com
-------------- next part --------------
Index: openswan/linux/include/openswan/ipsec_param.h
===================================================================
RCS file: /cvs/sw/new-wave/openswan/linux/include/openswan/ipsec_param.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 ipsec_param.h
--- openswan/linux/include/openswan/ipsec_param.h 31 Jan 2006 00:53:27 -0000 1.1.1.3
+++ openswan/linux/include/openswan/ipsec_param.h 17 Feb 2006 11:55:59 -0000
@@ -180,10 +180,13 @@
((flag) ? printk(format , ## args) : 0)
#define KLIPS_IP_PRINT(flag, ip) \
((flag) ? ipsec_print_ip(ip) : 0)
+ #define KLIPS_SATOT(flag, sa, format, dst, dstlen) \
+ ((flag) ? satot(sa, format, dst, dstlen) : 0)
#else /* CONFIG_KLIPS_DEBUG */
#define KLIPS_PRINT(flag, format, args...) do ; while(0)
#define KLIPS_PRINTMORE(flag, format, args...) do ; while(0)
#define KLIPS_IP_PRINT(flag, ip) do ; while(0)
+ #define KLIPS_SATOT(flag, sa, format, dst, dstlen) (0)
#endif /* CONFIG_KLIPS_DEBUG */
Index: openswan/linux/net/ipsec/pfkey_v2_parser.c
===================================================================
RCS file: /cvs/sw/new-wave/openswan/linux/net/ipsec/pfkey_v2_parser.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 pfkey_v2_parser.c
--- openswan/linux/net/ipsec/pfkey_v2_parser.c 26 Sep 2005 01:46:23 -0000 1.1.1.2
+++ openswan/linux/net/ipsec/pfkey_v2_parser.c 17 Feb 2006 11:55:59 -0000
@@ -243,7 +247,7 @@
extr->ips->ips_said.spi = maxspi;
ipsq = ipsec_sa_getbyid(&(extr->ips->ips_said));
if(ipsq != NULL) {
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
ipsec_sa_put(ipsq);
KLIPS_PRINT(debug_pfkey,
"klips_debug:pfkey_getspi_parse: "
@@ -276,7 +280,7 @@
}
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
if (!found_avail) {
KLIPS_PRINT(debug_pfkey,
@@ -421,7 +425,7 @@
SENDERR(EINVAL);
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
spin_lock_bh(&tdb_lock);
@@ -700,7 +704,7 @@
SENDERR(EINVAL);
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
ipsq = ipsec_sa_getbyid(&(extr->ips->ips_said));
if(ipsq != NULL) {
@@ -892,7 +896,7 @@
SENDERR(EINVAL);
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
spin_lock_bh(&tdb_lock);
@@ -1007,7 +1011,7 @@
SENDERR(EINVAL);
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
spin_lock_bh(&tdb_lock);
@@ -1607,9 +1611,9 @@
SENDERR(EINVAL);
}
- sa_len1 = satot(&extr->ips->ips_said, 0, sa1, sizeof(sa1));
+ sa_len1 = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa1, sizeof(sa1));
if(extr->ips2 != NULL) {
- sa_len2 = satot(&extr->ips2->ips_said, 0, sa2, sizeof(sa2));
+ sa_len2 = KLIPS_SATOT(debug_pfkey, &extr->ips2->ips_said, 0, sa2, sizeof(sa2));
}
spin_lock_bh(&tdb_lock);
@@ -1867,7 +1871,7 @@
SENDERR(ENOENT);
}
- sa_len = satot(&extr->ips->ips_said, 0, sa, sizeof(sa));
+ sa_len = KLIPS_SATOT(debug_pfkey, &extr->ips->ips_said, 0, sa, sizeof(sa));
ipsp->ips_flags |= SADB_X_SAFLAGS_INFLOW;
ipsp->ips_flow_s = srcflow;
More information about the Dev
mailing list