]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
kernel-utun: use always the same process ID, regardless of calling thread
authorMartin Willi <martin@revosec.ch>
Wed, 17 Apr 2013 12:47:58 +0000 (14:47 +0200)
committerMartin Willi <martin@revosec.ch>
Thu, 18 Apr 2013 12:43:56 +0000 (14:43 +0200)
src/libhydra/plugins/kernel_utun/kernel_utun_net.c

index 7d31b2a127dbad318ef78642bbd8a2dd21cfb463..2518656cba90757ba4b697dee8cb92420516542a 100644 (file)
@@ -49,6 +49,11 @@ struct private_kernel_utun_net_t {
         * sequence numbers for PF_ROUTE messages
         */
        int seq;
+
+       /**
+        * process id we use for all messages
+        */
+       pid_t pid;
 };
 
 typedef struct {
@@ -286,7 +291,7 @@ static status_t manage_route(private_kernel_utun_net_t *this, int op,
                        .rtm_version = RTM_VERSION,
                        .rtm_type = op,
                        .rtm_flags = RTF_UP | RTF_STATIC,
-                       .rtm_pid = getpid(),
+                       .rtm_pid = this->pid,
                        .rtm_seq = ++this->seq,
                },
        };
@@ -382,6 +387,7 @@ kernel_utun_net_t *kernel_utun_net_create()
                                .destroy = _destroy,
                        },
                },
+               .pid = getpid(),
        );
 
        this->pfr = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC);