From 492e0d46037630e0654210d8adea6b83d61dab58 Mon Sep 17 00:00:00 2001 From: Mihail Vasilev Date: Mon, 30 May 2016 10:00:48 +0000 Subject: Fixup - don't divide on unchecked values. Multiply instead. --- accel-pppd/radius/serv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 9b59d04..d40bff1 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -69,7 +69,7 @@ static struct rad_server_t *__rad_server_get(int type, struct rad_server_t *excl if ((s->backup < s0->backup) || ((s->backup == s0->backup) && - ((s->client_cnt[0] + s->client_cnt[1])/s->weight < (s0->client_cnt[0] + s0->client_cnt[1])/s0->weight))) + ((s->client_cnt[0] + s->client_cnt[1])*s0->weight < (s0->client_cnt[0] + s0->client_cnt[1])*s->weight))) s0 = s; } -- cgit v1.2.3 From 74d9a93067733e61d27038b905bf0f8325a102b5 Mon Sep 17 00:00:00 2001 From: Marek Michalkiewicz Date: Sat, 28 May 2016 23:23:16 +0200 Subject: accel-ppp Debian x32 fix minor -Wformat warnings Hello, small patch to avoid gcc -Wformat warnings on Debian x32 where time_t is "long long" (64-bit signed, to be 2038 safe), not "unsigned long" (32-bit unsigned) corresponding to "%lu" format strings. Regards, Marek --- accel-pppd/cli/std_cmd.c | 2 +- accel-pppd/extra/pppd_compat.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'accel-pppd') diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c index 62327f9..500102b 100644 --- a/accel-pppd/cli/std_cmd.c +++ b/accel-pppd/cli/std_cmd.c @@ -20,7 +20,7 @@ void core_restart(int); static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, void *client) { struct timespec ts; - time_t dt; + unsigned long dt; int day,hour; char statm_fname[128]; FILE *f; diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index 2956624..2c8460f 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -468,7 +468,7 @@ static void write_radattr(struct pppd_compat_pd *pd, struct rad_packet_t *pack) fprintf(f, "%i.%i.%i.%i\n", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); break; case ATTR_TYPE_DATE: - fprintf(f, "%lu\n", attr->val.date); + fprintf(f, "%lu\n", (unsigned long) attr->val.date); break; } } @@ -560,7 +560,7 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd) if (pd->ses->stop_time) { env[n++] = mem; - mem += sprintf(mem, "CONNECT_TIME=%lu", pd->ses->stop_time - pd->ses->start_time) + 1; + mem += sprintf(mem, "CONNECT_TIME=%lu", (unsigned long)(pd->ses->stop_time - pd->ses->start_time)) + 1; env[n++] = mem; mem += sprintf(mem, "BYTES_SENT=%" PRIu64, tx_bytes) + 1; env[n++] = mem; -- cgit v1.2.3 From 1073d1679887b4afd39347386016ded54065a642 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Thu, 2 Jun 2016 11:01:59 +0300 Subject: set INSTALL_RPATH for ipoe and pppoe --- accel-pppd/ctrl/ipoe/CMakeLists.txt | 2 ++ accel-pppd/ctrl/pppoe/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/ctrl/ipoe/CMakeLists.txt b/accel-pppd/ctrl/ipoe/CMakeLists.txt index f15365a..73dbb38 100644 --- a/accel-pppd/ctrl/ipoe/CMakeLists.txt +++ b/accel-pppd/ctrl/ipoe/CMakeLists.txt @@ -24,5 +24,7 @@ IF (LUA) TARGET_LINK_LIBRARIES(ipoe ${LUA_LIBRARIES}) ENDIF(LUA) TARGET_LINK_LIBRARIES(ipoe vlan-mon) +set_property(TARGET ipoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set_property(TARGET ipoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) INSTALL(TARGETS ipoe LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) diff --git a/accel-pppd/ctrl/pppoe/CMakeLists.txt b/accel-pppd/ctrl/pppoe/CMakeLists.txt index 5e1cbdc..808cd51 100644 --- a/accel-pppd/ctrl/pppoe/CMakeLists.txt +++ b/accel-pppd/ctrl/pppoe/CMakeLists.txt @@ -14,5 +14,7 @@ ENDIF(RADIUS) ADD_LIBRARY(pppoe SHARED ${sources}) TARGET_LINK_LIBRARIES(pppoe vlan-mon) +set_property(TARGET pppoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set_property(TARGET pppoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) INSTALL(TARGETS pppoe LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) -- cgit v1.2.3 From da08ff99edc943d123b9c6e7ff8ead499cd6dce8 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 20 May 2016 17:56:37 +0200 Subject: ppp: make include/ppp_auth.h a symlink include/ppp_auth.h used to be a symlink to ppp/ppp_auth.h, until it was made a copy by ebbd6f580322 ("fix typo (successed -> succeeded)"). Therefore, changes to ppp/ppp_auth.h aren't visible to files including ppp_auth.h anymore. These files have already diverged (just a whitespace fix for now), so let's restore the original symlink before more changes occur. Signed-off-by: Guillaume Nault --- accel-pppd/include/ppp_auth.h | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) mode change 100644 => 120000 accel-pppd/include/ppp_auth.h (limited to 'accel-pppd') diff --git a/accel-pppd/include/ppp_auth.h b/accel-pppd/include/ppp_auth.h deleted file mode 100644 index 839a881..0000000 --- a/accel-pppd/include/ppp_auth.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef PPP_AUTH_H -#define PPP_AUTH_H - -#include "list.h" - -struct ppp_auth_handler_t; - -struct auth_data_t -{ - struct list_head entry; - int proto; - int state; - struct ppp_auth_handler_t *h; -}; - -struct ppp_auth_handler_t -{ - struct list_head entry; - const char *name; - struct auth_data_t* (*init)(struct ppp_t*); - int (*send_conf_req)(struct ppp_t*, struct auth_data_t*, uint8_t*); - int (*recv_conf_req)(struct ppp_t*, struct auth_data_t*, uint8_t*); - int (*start)(struct ppp_t*, struct auth_data_t*); - int (*finish)(struct ppp_t*, struct auth_data_t*); - void (*free)(struct ppp_t*,struct auth_data_t*); - int (*check)(uint8_t *); - int (*restart)(struct ppp_t*,struct auth_data_t*); -}; - -int ppp_auth_register_handler(struct ppp_auth_handler_t*); - -int ppp_auth_succeeded(struct ppp_t *ppp, char *username); -void ppp_auth_failed(struct ppp_t *ppp, char *username); -int ppp_auth_restart(struct ppp_t *ppp); - -#endif - diff --git a/accel-pppd/include/ppp_auth.h b/accel-pppd/include/ppp_auth.h new file mode 120000 index 0000000..527c853 --- /dev/null +++ b/accel-pppd/include/ppp_auth.h @@ -0,0 +1 @@ +../ppp/ppp_auth.h \ No newline at end of file -- cgit v1.2.3 From 2f8859f524a0f684d1cb02d45e00b4e66b399820 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Tue, 31 May 2016 21:06:24 +0200 Subject: ppp: remove obsolete files This files aren't used (and aren't even compiled) anymore. Signed-off-by: Guillaume Nault --- accel-pppd/ppp/ppp_ifcfg.c | 182 -------------------------------------------- accel-pppd/ppp/ppp_notify.c | 54 ------------- accel-pppd/ppp/ppp_pd.c | 14 ---- 3 files changed, 250 deletions(-) delete mode 100644 accel-pppd/ppp/ppp_ifcfg.c delete mode 100644 accel-pppd/ppp/ppp_notify.c delete mode 100644 accel-pppd/ppp/ppp_pd.c (limited to 'accel-pppd') diff --git a/accel-pppd/ppp/ppp_ifcfg.c b/accel-pppd/ppp/ppp_ifcfg.c deleted file mode 100644 index 5f76721..0000000 --- a/accel-pppd/ppp/ppp_ifcfg.c +++ /dev/null @@ -1,182 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "linux_ppp.h" - -#include "triton.h" -#include "events.h" -#include "ppp.h" -#include "ipdb.h" -#include "log.h" - -// from /usr/include/linux/ipv6.h -struct in6_ifreq { - struct in6_addr ifr6_addr; - __u32 ifr6_prefixlen; - int ifr6_ifindex; -}; - -static void devconf(struct ppp_t *ppp, const char *attr, const char *val) -{ - int fd; - char fname[PATH_MAX]; - - sprintf(fname, "/proc/sys/net/ipv6/conf/%s/%s", ppp->ifname, attr); - fd = open(fname, O_WRONLY); - if (!fd) { - log_ppp_error("ppp: failed to open '%s': %s\n", fname, strerror(errno)); - return; - } - - write(fd, val, strlen(val)); - - close(fd); -} - -static void build_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_addr *addr) -{ - memcpy(addr, &a->addr, sizeof(*addr)); - - if (a->prefix_len <= 64) - *(uint64_t *)(addr->s6_addr + 8) = intf_id; - else - *(uint64_t *)(addr->s6_addr + 8) |= intf_id & ((1 << (128 - a->prefix_len)) - 1); -} - -void ppp_ifup(struct ppp_t *ppp) -{ - struct ipv6db_addr_t *a; - struct ifreq ifr; - struct in6_ifreq ifr6; - struct npioctl np; - struct sockaddr_in addr; - - triton_event_fire(EV_SES_ACCT_START, ppp); - if (ppp->stop_time) - return; - - triton_event_fire(EV_SES_PRE_UP, ppp); - if (ppp->stop_time) - return; - - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, ppp->ifname); - - if (ppp->ses.ipv4) { - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = ppp->ses.ipv4->addr; - memcpy(&ifr.ifr_addr,&addr,sizeof(addr)); - - if (net->sock_ioctl(SIOCSIFADDR, &ifr)) - log_ppp_error("ppp: failed to set IPv4 address: %s\n", strerror(errno)); - - addr.sin_addr.s_addr = ppp->ses.ipv4->peer_addr; - memcpy(&ifr.ifr_dstaddr,&addr,sizeof(addr)); - - if (net->sock_ioctl(SIOCSIFDSTADDR, &ifr)) - log_ppp_error("ppp: failed to set peer IPv4 address: %s\n", strerror(errno)); - } - - if (ppp->ses.ipv6) { - devconf(ppp, "accept_ra", "0"); - devconf(ppp, "autoconf", "0"); - devconf(ppp, "forwarding", "1"); - - memset(&ifr6, 0, sizeof(ifr6)); - ifr6.ifr6_addr.s6_addr32[0] = htonl(0xfe800000); - *(uint64_t *)(ifr6.ifr6_addr.s6_addr + 8) = ppp->ses.ipv6->intf_id; - ifr6.ifr6_prefixlen = 64; - ifr6.ifr6_ifindex = ppp->ifindex; - - if (ioctl(sock6_fd, SIOCSIFADDR, &ifr6)) - log_ppp_error("ppp: failed to set LL IPv6 address: %s\n", strerror(errno)); - - list_for_each_entry(a, &ppp->ses.ipv6->addr_list, entry) { - if (a->prefix_len == 128) - continue; - - build_addr(a, ppp->ses.ipv6->intf_id, &ifr6.ifr6_addr); - ifr6.ifr6_prefixlen = a->prefix_len; - - if (ioctl(sock6_fd, SIOCSIFADDR, &ifr6)) - log_ppp_error("ppp: failed to add IPv6 address: %s\n", strerror(errno)); - } - } - - if (net->sock_ioctl(SIOCGIFFLAGS, &ifr)) - log_ppp_error("ppp: failed to get interface flags: %s\n", strerror(errno)); - - ifr.ifr_flags |= IFF_UP | IFF_POINTOPOINT; - - if (net->sock_ioctl(SIOCSIFFLAGS, &ifr)) - log_ppp_error("ppp: failed to set interface flags: %s\n", strerror(errno)); - - if (ppp->ses.ipv4) { - np.protocol = PPP_IP; - np.mode = NPMODE_PASS; - - if (net->ppp_ioctl(ppp->unit_fd, PPPIOCSNPMODE, &np)) - log_ppp_error("ppp: failed to set NP (IPv4) mode: %s\n", strerror(errno)); - } - - if (ppp->ses.ipv6) { - np.protocol = PPP_IPV6; - np.mode = NPMODE_PASS; - - if (net->ppp_ioctl(ppp->unit_fd, PPPIOCSNPMODE, &np)) - log_ppp_error("ppp: failed to set NP (IPv6) mode: %s\n", strerror(errno)); - } - - ppp->ses.ctrl->started(ppp); - - triton_event_fire(EV_SES_STARTED, ppp); -} - -void __export ppp_ifdown(struct ppp_t *ppp) -{ - struct ifreq ifr; - struct sockaddr_in addr; - struct in6_ifreq ifr6; - struct ipv6db_addr_t *a; - - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, ppp->ifname); - net->sock_ioctl(SIOCSIFFLAGS, &ifr); - - if (ppp->ses.ipv4) { - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - memcpy(&ifr.ifr_addr,&addr,sizeof(addr)); - net->sock_ioctl(SIOCSIFADDR, &ifr); - } - - if (ppp->ses.ipv6) { - memset(&ifr6, 0, sizeof(ifr6)); - ifr6.ifr6_addr.s6_addr32[0] = htonl(0xfe800000); - *(uint64_t *)(ifr6.ifr6_addr.s6_addr + 8) = ppp->ses.ipv6->intf_id; - ifr6.ifr6_prefixlen = 64; - ifr6.ifr6_ifindex = ppp->ifindex; - - ioctl(sock6_fd, SIOCDIFADDR, &ifr6); - - list_for_each_entry(a, &ppp->ses.ipv6->addr_list, entry) { - if (a->prefix_len == 128) - continue; - - build_addr(a, ppp->ses.ipv6->intf_id, &ifr6.ifr6_addr); - ifr6.ifr6_prefixlen = a->prefix_len; - - ioctl(sock6_fd, SIOCDIFADDR, &ifr6); - } - } -} - diff --git a/accel-pppd/ppp/ppp_notify.c b/accel-pppd/ppp/ppp_notify.c deleted file mode 100644 index ad9fd1f..0000000 --- a/accel-pppd/ppp/ppp_notify.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "ppp.h" - -static LIST_HEAD(notified_list); - -void __export ppp_register_notified(struct ppp_notified_t *n) -{ - list_add_tail(&n->entry, ¬ified_list); -} - -void __export ppp_unregister_notified(struct ppp_notified_t *n) -{ - list_del(&n->entry); -} - -void ppp_notify_starting(struct ppp_t *ppp) -{ - struct ppp_notified_t *n; - - list_for_each_entry(n, ¬ified_list, entry) { - if (n->starting) - n->starting(n, ppp); - } -} - -void ppp_notify_started(struct ppp_t *ppp) -{ - struct ppp_notified_t *n; - - list_for_each_entry(n, ¬ified_list, entry) { - if (n->started) - n->started(n, ppp); - } -} - -void ppp_notify_finished(struct ppp_t *ppp) -{ - struct ppp_notified_t *n; - - list_for_each_entry(n, ¬ified_list, entry) { - if (n->finished) - n->finished(n, ppp); - } -} - -void ppp_notify_finishing(struct ppp_t *ppp) -{ - struct ppp_notified_t *n; - - list_for_each_entry(n, ¬ified_list, entry) { - if (n->finishing) - n->finishing(n, ppp); - } -} - diff --git a/accel-pppd/ppp/ppp_pd.c b/accel-pppd/ppp/ppp_pd.c deleted file mode 100644 index c33ae96..0000000 --- a/accel-pppd/ppp/ppp_pd.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "ppp.h" - -#include "memdebug.h" - -int ppp_store_pd(struct ppp_t *ppp, pd_key_t key, void *data) -{ - struct ppp_pd_t *pd; - - list_for_each_entry(pd, &ppp->pd_list, entry) - if (pd->key == key) - return -1; - - -} -- cgit v1.2.3 From e3e804a0266840ef0a9cc13c4f6d1ac8fc68c676 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Tue, 31 May 2016 21:43:48 +0200 Subject: radius: initialise ipv6db addresses completely The 'installed' bit of the allocated ipv6db_addr_t structure needs to be initialised. This is because ap_session_ifdown() reads this bit to know if the address or route needs to be removed from the kernel. The 'installed' bit is set by ap_session_accounting_started() and the ND and DHCPV6 protocol handlers, but disconnection could happen before these steps. Signed-off-by: Guillaume Nault --- accel-pppd/radius/radius.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c index c8eaf95..4c32375 100644 --- a/accel-pppd/radius/radius.c +++ b/accel-pppd/radius/radius.c @@ -216,12 +216,14 @@ int rad_proc_attrs(struct rad_req_t *req) break; case Framed_IPv6_Prefix: a = _malloc(sizeof(*a)); + memset(a, 0, sizeof(*a)); a->prefix_len = attr->val.ipv6prefix.len; a->addr = attr->val.ipv6prefix.prefix; list_add_tail(&a->entry, &rpd->ipv6_addr.addr_list); break; case Delegated_IPv6_Prefix: a = _malloc(sizeof(*a)); + memset(a, 0, sizeof(*a)); a->prefix_len = attr->val.ipv6prefix.len; a->addr = attr->val.ipv6prefix.prefix; list_add_tail(&a->entry, &rpd->ipv6_dp.prefix_list); -- cgit v1.2.3