diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2016-05-31 21:06:24 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-06-02 11:03:17 +0300 |
commit | 2f8859f524a0f684d1cb02d45e00b4e66b399820 (patch) | |
tree | 007ce8d1e6a774e1df483544a83f6100279be893 /accel-pppd/ppp | |
parent | da08ff99edc943d123b9c6e7ff8ead499cd6dce8 (diff) | |
download | accel-ppp-2f8859f524a0f684d1cb02d45e00b4e66b399820.tar.gz accel-ppp-2f8859f524a0f684d1cb02d45e00b4e66b399820.zip |
ppp: remove obsolete files
This files aren't used (and aren't even compiled) anymore.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r-- | accel-pppd/ppp/ppp_ifcfg.c | 182 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp_notify.c | 54 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp_pd.c | 14 |
3 files changed, 0 insertions, 250 deletions
diff --git a/accel-pppd/ppp/ppp_ifcfg.c b/accel-pppd/ppp/ppp_ifcfg.c deleted file mode 100644 index 5f767219..00000000 --- a/accel-pppd/ppp/ppp_ifcfg.c +++ /dev/null @@ -1,182 +0,0 @@ -#include <unistd.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include <string.h> -#include <errno.h> -#include <limits.h> -#include <arpa/inet.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#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 ad9fd1fc..00000000 --- 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 c33ae968..00000000 --- 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; - - -} |