summaryrefslogtreecommitdiff
path: root/accel-pppd/include
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-07-11 09:47:04 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-07-11 09:47:04 +0300
commite0cca4344f70b9c9e23e3c6a7e17c8e93c765184 (patch)
tree1068654b025b2e24c983d99776696ad889a0c138 /accel-pppd/include
parent6fb04941ca41312909208938bfac4f753d3c277c (diff)
downloadaccel-ppp-e0cca4344f70b9c9e23e3c6a7e17c8e93c765184.tar.gz
accel-ppp-e0cca4344f70b9c9e23e3c6a7e17c8e93c765184.zip
implemented support for network namespace
This is done using radius attribute NAS-Port-Id. The new format of this attribute is NAS-Port-Id=[ns/][name]. Namespaces must be created malually by "ip netns add ..." command
Diffstat (limited to 'accel-pppd/include')
-rw-r--r--accel-pppd/include/ap_net.h22
-rw-r--r--accel-pppd/include/ap_session.h8
2 files changed, 22 insertions, 8 deletions
diff --git a/accel-pppd/include/ap_net.h b/accel-pppd/include/ap_net.h
index 40544d5..25121d9 100644
--- a/accel-pppd/include/ap_net.h
+++ b/accel-pppd/include/ap_net.h
@@ -1,8 +1,12 @@
#ifndef __AP_NET_H
#define __AP_NET_H
+struct rtnl_handle;
+
struct ap_net {
- const char *name;
+ struct list_head entry;
+ int refs;
+ char *name;
int (*socket)(int domain, int type, int proto);
int (*connect)(int sock, const struct sockaddr *, socklen_t len);
int (*bind)(int sock, const struct sockaddr *, socklen_t len);
@@ -14,11 +18,23 @@ struct ap_net {
int (*set_nonblocking)(int sock, int f);
int (*setsockopt)(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
int (*sock_ioctl)(unsigned long request, void *arg);
+ int (*sock6_ioctl)(unsigned long request, void *arg);
int (*ppp_open)();
int (*ppp_ioctl)(int fd, unsigned long request, void *arg);
+ void (*enter_ns)();
+ void (*exit_ns)();
+ struct rtnl_handle *(*rtnl_get)();
+ void (*rtnl_put)(struct rtnl_handle *);
+ int (*rtnl_open)(struct rtnl_handle *h, int proto);
+ int (*move_link)(struct ap_net *net, int ifindex);
+ void (*release)(struct ap_net *net);
};
-int ap_net_register(const struct ap_net *net);
-const struct ap_net *ap_net_find(const char *name);
+extern __thread struct ap_net *net;
+extern struct ap_net *def_net;
+
+int ap_net_register(struct ap_net *net);
+struct ap_net *ap_net_find(const char *name);
+struct ap_net *ap_net_open_ns(const char *name);
#endif
diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h
index 0baaab2..82e7e8c 100644
--- a/accel-pppd/include/ap_session.h
+++ b/accel-pppd/include/ap_session.h
@@ -81,6 +81,7 @@ struct ap_session
struct ipv6db_prefix_t *ipv6_dp;
char *ipv4_pool_name;
char *ipv6_pool_name;
+ struct ap_net *net;
const struct ap_ctrl *ctrl;
@@ -125,14 +126,11 @@ struct ap_session_stat
extern pthread_rwlock_t ses_lock;
extern struct list_head ses_list;
extern int ap_shutdown;
-extern int sock_fd; // internet socket for ioctls
-extern int sock6_fd; // internet socket for ioctls
+extern int sock_fd;
+extern int sock6_fd;
extern int urandom_fd;
extern struct ap_session_stat ap_session_stat;
-extern __thread const struct ap_net *net;
-extern const struct ap_net def_net;
-
void ap_session_init(struct ap_session *ses);
void ap_session_set_ifindex(struct ap_session *ses);
int ap_session_starting(struct ap_session *ses);