From: Arun Sharma Date: Tue, 3 Jul 2012 01:30:21 +0000 (-0700) Subject: ipsec gre: Do not reread ovs monitor ipsec pidfile in netdev vport so much X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~293 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2a586a5c1349177dcb9306e4b91ca4063ec79722;p=sliver-openvswitch.git ipsec gre: Do not reread ovs monitor ipsec pidfile in netdev vport so much Instead of rereading ovs-monitor-ipsec pidfile in netdev-vport so much. It's probably only necessary to check once if ovs-monitor-ipsec is running, and then cache the result. If the result is negative, then it may be worthwhile to try again the next time someone tries to configure an ipsec tunnel. Signed-off-by: Arun Sharma Signed-off-by: Ben Pfaff --- diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 7fe169e36..d2c2672b0 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -681,10 +681,14 @@ parse_tunnel_config(const char *name, const char *type, } if (is_ipsec) { - char *file_name = xasprintf("%s/%s", ovs_rundir(), - "ovs-monitor-ipsec.pid"); - pid_t pid = read_pidfile(file_name); - free(file_name); + static pid_t pid = 0; + if (pid == 0) { + char *file_name = xasprintf("%s/%s", ovs_rundir(), + "ovs-monitor-ipsec.pid"); + pid = read_pidfile(file_name); + free(file_name); + } + if (pid < 0) { VLOG_ERR("%s: IPsec requires the ovs-monitor-ipsec daemon", name);