On 17 Nov 2015, at 12:22, Andreas Schultz
<aschultz(a)tpip.net> wrote:
+ * Copyright (C) 2014, 2015 Travelping GmbH
+ *
+ * The contents of this file may be used under the terms of the GNU
+ * General Public License Version 2, provided that the above copyright
+ * notice and this permission notice is included in all copies or
+ * substantial portions of the software.
Do you think you could license this GPLv2 or later? Even if most of OpenGGSN
is currently stuck at V2 it would be nice if new code doesn't need to be replaced.
+int open_ns(int nsfd, const char *pathname, int flags)
+{
+ sigset_t intmask, oldmask;
+ int fd;
+ int errsv;
+
+ sigfillset(&intmask);
+ sigprocmask(SIG_BLOCK, &intmask, &oldmask);
+
+ setns(nsfd, CLONE_NEWNET);
+ fd = open(pathname, flags);
+ errsv = errno;
+ setns(default_nsfd, CLONE_NEWNET);
+
+ sigprocmask(SIG_SETMASK, &oldmask, NULL);
+
+ errno = errsv;
+ return fd;
Do you want to add error handling here?
+#ifndef __NETNS_H
+#define __NETNS_H
__ is reserved for system headers/system code. We should not use it. #pragma once solves
the
issue in a very nice way for us.