[PATCH openggsn 4/4] ggsn: add network namespace support

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Mon Dec 21 07:30:08 UTC 2015


> On 17 Nov 2015, at 12:22, Andreas Schultz <aschultz at 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.





More information about the OpenBSC mailing list