summaryrefslogtreecommitdiff
path: root/accel-pptpd/extra
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-10-14 14:30:53 +0400
committerKozlov Dmitry <dima@server>2010-10-14 14:30:53 +0400
commit84ff56a83a9f6b29d3300aff13ede9afc73b5a68 (patch)
tree9284cb5b797dd7d68350cd937da11cc2f579114f /accel-pptpd/extra
parent763fe9e3ba0faeea25cc423152a065900f901a53 (diff)
downloadaccel-ppp-xebd-84ff56a83a9f6b29d3300aff13ede9afc73b5a68.tar.gz
accel-ppp-xebd-84ff56a83a9f6b29d3300aff13ede9afc73b5a68.zip
due to libnl-1 is not thread safe, l2tp and shaper updated to use libnl-2
Diffstat (limited to 'accel-pptpd/extra')
-rw-r--r--accel-pptpd/extra/CMakeLists.txt8
-rw-r--r--accel-pptpd/extra/shaper_tbf.c26
2 files changed, 19 insertions, 15 deletions
diff --git a/accel-pptpd/extra/CMakeLists.txt b/accel-pptpd/extra/CMakeLists.txt
index 600c861..9d58b8e 100644
--- a/accel-pptpd/extra/CMakeLists.txt
+++ b/accel-pptpd/extra/CMakeLists.txt
@@ -1,10 +1,14 @@
ADD_LIBRARY(pppd_compat SHARED pppd_compat.c)
ADD_LIBRARY(ippool SHARED ippool.c)
ADD_LIBRARY(sigchld SHARED sigchld.c)
-ADD_LIBRARY(shaper_tbf SHARED shaper_tbf.c)
-TARGET_LINK_LIBRARIES(shaper_tbf nl)
INSTALL(TARGETS pppd_compat ippool sigchld
LIBRARY DESTINATION usr/lib/accel-pptp
)
+IF (SHAPER)
+ ADD_LIBRARY(shaper_tbf SHARED shaper_tbf.c)
+ TARGET_LINK_LIBRARIES(shaper_tbf nl-route)
+ INSTALL(TARGETS shaper_tbf LIBRARY DESTINATION usr/lib/accel-pptp)
+ENDIF (SHAPER)
+
diff --git a/accel-pptpd/extra/shaper_tbf.c b/accel-pptpd/extra/shaper_tbf.c
index 7ed68f5..cd1a88a 100644
--- a/accel-pptpd/extra/shaper_tbf.c
+++ b/accel-pptpd/extra/shaper_tbf.c
@@ -92,7 +92,7 @@ static void tc_calc_rtable(struct tc_ratespec *r, uint32_t *rtab, int cell_log,
r->cell_log=cell_log;
}
-static int install_tbf(struct nl_handle *h, int ifindex, int speed)
+static int install_tbf(struct nl_sock *h, int ifindex, int speed)
{
struct tc_tbf_qopt opt;
struct nl_msg *msg;
@@ -159,7 +159,7 @@ nla_put_failure:
return -1;
}
-static int install_ingress(struct nl_handle *h, int ifindex)
+static int install_ingress(struct nl_sock *h, int ifindex)
{
struct nl_msg *pmsg;
@@ -200,7 +200,7 @@ nla_put_failure:
return -1;
}
-static int install_filter(struct nl_handle *h, int ifindex, int speed)
+static int install_filter(struct nl_sock *h, int ifindex, int speed)
{
double rate = speed*1000/8;
double bucket = rate*conf_burst_factor;
@@ -323,7 +323,7 @@ nla_put_failure:
static int install_shaper(const char *ifname, int down_speed, int up_speed)
{
- struct nl_handle *h;
+ struct nl_sock *h;
struct ifreq ifr;
int err;
@@ -335,9 +335,9 @@ static int install_shaper(const char *ifname, int down_speed, int up_speed)
return -1;
}
- h = nl_handle_alloc();
+ h = nl_socket_alloc();
if (!h) {
- log_ppp_error("tbf: nl_handle_alloc failed\n");
+ log_ppp_error("tbf: nl_socket_alloc failed\n");
return -1;
}
@@ -360,7 +360,7 @@ static int install_shaper(const char *ifname, int down_speed, int up_speed)
nl_close(h);
out:
- nl_handle_destroy(h);
+ nl_socket_free(h);
return 0;
}
@@ -395,7 +395,7 @@ static struct shaper_pd_t *find_pd(struct ppp_t *ppp, int create)
static int remove_shaper(const char *ifname)
{
- struct nl_handle *h;
+ struct nl_sock *h;
struct ifreq ifr;
struct nl_msg *pmsg;
int err;
@@ -422,16 +422,16 @@ static int remove_shaper(const char *ifname)
.tcm_parent = TC_H_INGRESS,
};
- h = nl_handle_alloc();
+ h = nl_socket_alloc();
if (!h) {
- log_ppp_error("tbf: nl_handle_alloc failed\n");
+ log_ppp_error("tbf: nl_socket_alloc failed\n");
return -1;
}
err = nl_connect(h, NETLINK_ROUTE);
if (err < 0) {
log_ppp_error("tbf: nl_connect: %s", strerror(errno));
- nl_handle_destroy(h);
+ nl_socket_free(h);
return -1;
}
@@ -466,7 +466,7 @@ static int remove_shaper(const char *ifname)
nlmsg_free(pmsg);
nl_close(h);
- nl_handle_destroy(h);
+ nl_socket_free(h);
return 0;
out_err:
@@ -476,7 +476,7 @@ out_err:
nlmsg_free(pmsg);
nl_close(h);
- nl_handle_destroy(h);
+ nl_socket_free(h);
return -1;
}