summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/backup/backup.h5
-rw-r--r--accel-pppd/cli/cli.h3
-rw-r--r--accel-pppd/cli/show_sessions.c8
-rw-r--r--accel-pppd/extra/chap-secrets.c3
-rw-r--r--accel-pppd/extra/ippool.c3
-rw-r--r--accel-pppd/extra/ipv6pool.c2
-rw-r--r--accel-pppd/extra/pppd_compat.c2
-rw-r--r--accel-pppd/include/ap_net.h6
-rw-r--r--accel-pppd/include/ap_session_backup.h3
-rw-r--r--accel-pppd/include/connlimit.h3
-rw-r--r--accel-pppd/include/vlan_mon.h2
-rw-r--r--accel-pppd/ipv6/dhcpv6.c2
-rw-r--r--accel-pppd/libnetlink/ipset.h2
-rw-r--r--accel-pppd/libnetlink/iputils.h2
-rw-r--r--accel-pppd/libnetlink/libnetlink.h1
-rw-r--r--accel-pppd/lua/luasupp.h2
-rw-r--r--accel-pppd/lua/session.c2
-rw-r--r--accel-pppd/memdebug.h5
-rw-r--r--accel-pppd/ppp/ppp_auth.h3
-rw-r--r--accel-pppd/ppp/ppp_fsm.h7
-rw-r--r--accel-pppd/ppp/ppp_lcp.h2
-rw-r--r--accel-pppd/radius/radius.h6
-rw-r--r--accel-pppd/triton/mempool.h2
23 files changed, 63 insertions, 13 deletions
diff --git a/accel-pppd/backup/backup.h b/accel-pppd/backup/backup.h
index d36f70bd..106303e2 100644
--- a/accel-pppd/backup/backup.h
+++ b/accel-pppd/backup/backup.h
@@ -2,6 +2,9 @@
#define __BACKUP_H
#include <stdint.h>
+#include <sys/types.h>
+
+#include "ap_session.h"
#include "list.h"
#define MODID_COMMON 1
@@ -12,8 +15,6 @@
#define MODID_L2TP 6
#define MODID_IPPOOL 7
-
-struct ap_session;
struct backup_storage;
struct backup_data;
diff --git a/accel-pppd/cli/cli.h b/accel-pppd/cli/cli.h
index ef74d334..6eda5d3f 100644
--- a/accel-pppd/cli/cli.h
+++ b/accel-pppd/cli/cli.h
@@ -2,7 +2,8 @@
#define __CLI_H
#include <pcre.h>
-#include <list.h>
+
+#include "list.h"
#define CLI_CMD_OK 0
#define CLI_CMD_FAILED -1
diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c
index 443b186a..0ea3c94e 100644
--- a/accel-pppd/cli/show_sessions.c
+++ b/accel-pppd/cli/show_sessions.c
@@ -379,6 +379,11 @@ early_out:
goto out;
}
+static void print_netns(struct ap_session *ses, char *buf)
+{
+ snprintf(buf, CELL_SIZE, "%s", ses->net->name);
+}
+
static void print_ifname(struct ap_session *ses, char *buf)
{
snprintf(buf, CELL_SIZE, "%s", ses->ifname);
@@ -414,7 +419,7 @@ static void print_ip6(struct ap_session *ses, char *buf)
struct in6_addr addr;
char *ptr;
- if (!ses->ipv6) {
+ if (!ses->ipv6 || list_empty(&ses->ipv6->addr_list)) {
*buf = 0;
return;
}
@@ -633,6 +638,7 @@ static void init(void)
cli_register_simple_cmd2(show_ses_exec, show_ses_help, 2, "show", "sessions");
+ cli_show_ses_register("netns", "network namespace name", print_netns);
cli_show_ses_register("ifname", "interface name", print_ifname);
cli_show_ses_register("username", "user name", print_username);
cli_show_ses_register("ip", "IP address", print_ip);
diff --git a/accel-pppd/extra/chap-secrets.c b/accel-pppd/extra/chap-secrets.c
index becb687c..92cfb42f 100644
--- a/accel-pppd/extra/chap-secrets.c
+++ b/accel-pppd/extra/chap-secrets.c
@@ -24,7 +24,7 @@ static char *def_chap_secrets = "/etc/ppp/chap-secrets";
static char *conf_chap_secrets;
static int conf_encrypted;
static in_addr_t conf_gw_ip_address = 0;
-static int conf_netmask;
+static int conf_netmask = 0;
static void *pd_key;
static struct ipdb_t ipdb;
@@ -762,6 +762,7 @@ static void load_config(void)
parse_gw_ip_address(opt);
else {
conf_gw_ip_address = 0;
+ conf_netmask = 0;
}
opt = conf_get_opt("chap-secrets", "encrypted");
diff --git a/accel-pppd/extra/ippool.c b/accel-pppd/extra/ippool.c
index 0c0831c2..73ad3987 100644
--- a/accel-pppd/extra/ippool.c
+++ b/accel-pppd/extra/ippool.c
@@ -264,6 +264,7 @@ static void generate_pool_p2p(struct ippool_t *p)
break;
}
+ memset(it, 0, sizeof(*it));
it->pool = p;
it->it.owner = &ipdb;
if (conf_gw_ip_address)
@@ -304,6 +305,7 @@ static void generate_pool_net30(struct ippool_t *p)
break;
}
+ memset(it, 0, sizeof(*it));
it->pool = p;
it->it.owner = &ipdb;
it->it.addr = addr[1]->addr;
@@ -443,6 +445,7 @@ static int session_restore(struct ap_session *ses, struct backup_mod *m)
ses->ipv4 = &it0->it;
else {
ses->ipv4 = _malloc(sizeof(*ses->ipv4));
+ memset(ses->ipv4, 0, sizeof(*ses->ipv4));
ses->ipv4->addr = addr;
ses->ipv4->peer_addr = peer_addr;
ses->ipv4->owner = &ipdb_b;
diff --git a/accel-pppd/extra/ipv6pool.c b/accel-pppd/extra/ipv6pool.c
index 6fa5cc53..4f29a280 100644
--- a/accel-pppd/extra/ipv6pool.c
+++ b/accel-pppd/extra/ipv6pool.c
@@ -83,6 +83,7 @@ static void generate_ippool(struct in6_addr *addr, int mask, int prefix_len)
while (in6_addr_cmp(&ip, &end) <= 0) {
it = malloc(sizeof(*it));
+ memset(it, 0, sizeof(*it));
it->it.owner = &ipdb;
INIT_LIST_HEAD(&it->it.addr_list);
a = malloc(sizeof(*a));
@@ -119,6 +120,7 @@ static void generate_dppool(struct in6_addr *addr, int mask, int prefix_len)
while (in6_addr_cmp(&ip, &end) <= 0) {
it = malloc(sizeof(*it));
+ memset(it, 0, sizeof(*it));
it->it.owner = &ipdb;
INIT_LIST_HEAD(&it->it.prefix_list);
a = malloc(sizeof(*a));
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c
index 318327e8..7c23eca0 100644
--- a/accel-pppd/extra/pppd_compat.c
+++ b/accel-pppd/extra/pppd_compat.c
@@ -622,7 +622,7 @@ static void fill_env(char **env, char *mem, struct pppd_compat_pd *pd)
mem += write_sz + 1;
++n;
- if (ses->ipv6) {
+ if (ses->ipv6 && !list_empty(&ses->ipv6->addr_list)) {
///FIXME only first address is passed to env
struct ipv6db_addr_t *a = list_first_entry(&ses->ipv6->addr_list,
typeof(*a), entry);
diff --git a/accel-pppd/include/ap_net.h b/accel-pppd/include/ap_net.h
index 25121d94..91ebdd5e 100644
--- a/accel-pppd/include/ap_net.h
+++ b/accel-pppd/include/ap_net.h
@@ -1,7 +1,11 @@
#ifndef __AP_NET_H
#define __AP_NET_H
-struct rtnl_handle;
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include "libnetlink.h"
+#include "list.h"
struct ap_net {
struct list_head entry;
diff --git a/accel-pppd/include/ap_session_backup.h b/accel-pppd/include/ap_session_backup.h
index e6382ff5..9e175c85 100644
--- a/accel-pppd/include/ap_session_backup.h
+++ b/accel-pppd/include/ap_session_backup.h
@@ -1,6 +1,9 @@
#ifndef __AP_SESSION_BACKUP_H
#define __AP_SESSION_BACKUP_H
+#include <netinet/in.h>
+#include <stdint.h>
+
#define SES_TAG_USERNAME 1
#define SES_TAG_SESSIONID 2
#define SES_TAG_START_TIME 3
diff --git a/accel-pppd/include/connlimit.h b/accel-pppd/include/connlimit.h
index 8711cf8b..2b2f0f4d 100644
--- a/accel-pppd/include/connlimit.h
+++ b/accel-pppd/include/connlimit.h
@@ -1,6 +1,9 @@
#ifndef __CONNLIMIT_H
#define __CONNLIMIT_H
+#include <stdint.h>
+#include <string.h>
+
static inline uint64_t cl_key_from_ipv4(uint32_t ip)
{
return ip;
diff --git a/accel-pppd/include/vlan_mon.h b/accel-pppd/include/vlan_mon.h
index 23d5e60d..673150b3 100644
--- a/accel-pppd/include/vlan_mon.h
+++ b/accel-pppd/include/vlan_mon.h
@@ -1,6 +1,8 @@
#ifndef __VLAN_MON_H
#define __VLAN_MON_H
+#include <stdint.h>
+
typedef void (*vlan_mon_notify)(int ifindex, int vid, int vlan_ifindex);
void vlan_mon_register_proto(uint16_t proto, vlan_mon_notify cb);
diff --git a/accel-pppd/ipv6/dhcpv6.c b/accel-pppd/ipv6/dhcpv6.c
index 84d36caa..36a5f15e 100644
--- a/accel-pppd/ipv6/dhcpv6.c
+++ b/accel-pppd/ipv6/dhcpv6.c
@@ -69,7 +69,7 @@ static void ev_ses_started(struct ap_session *ses)
int sock;
int f = 1;
- if (!ses->ipv6)
+ if (!ses->ipv6 || list_empty(&ses->ipv6->addr_list))
return;
a = list_entry(ses->ipv6->addr_list.next, typeof(*a), entry);
diff --git a/accel-pppd/libnetlink/ipset.h b/accel-pppd/libnetlink/ipset.h
index cd5523dc..7121eaa0 100644
--- a/accel-pppd/libnetlink/ipset.h
+++ b/accel-pppd/libnetlink/ipset.h
@@ -1,6 +1,8 @@
#ifndef __IPSET_H
#define __IPSET_H
+#include <netinet/in.h>
+
int ipset_add(const char *name, in_addr_t addr);
int ipset_del(const char *name, in_addr_t addr);
int ipset_flush(const char *name);
diff --git a/accel-pppd/libnetlink/iputils.h b/accel-pppd/libnetlink/iputils.h
index 66aa9747..6c1d3878 100644
--- a/accel-pppd/libnetlink/iputils.h
+++ b/accel-pppd/libnetlink/iputils.h
@@ -2,6 +2,8 @@
#define __IPLINK_H
#include <linux/if_link.h>
+#include <netinet/in.h>
+#include <stdint.h>
typedef int (*iplink_list_func)(int index, int flags, const char *name, int iflink, int vid, void *arg);
diff --git a/accel-pppd/libnetlink/libnetlink.h b/accel-pppd/libnetlink/libnetlink.h
index 5089c46f..aeab3ef4 100644
--- a/accel-pppd/libnetlink/libnetlink.h
+++ b/accel-pppd/libnetlink/libnetlink.h
@@ -7,6 +7,7 @@
#include <linux/if_link.h>
#include <linux/if_addr.h>
#include <linux/neighbour.h>
+#include <sys/types.h>
#define TCA_BUF_MAX 64*1024
#define MAX_MSG 16384
diff --git a/accel-pppd/lua/luasupp.h b/accel-pppd/lua/luasupp.h
index f7efab8c..0a29dfdc 100644
--- a/accel-pppd/lua/luasupp.h
+++ b/accel-pppd/lua/luasupp.h
@@ -3,6 +3,8 @@
#include <lua.h>
+#include "ap_session.h"
+
int luaopen_lpack(lua_State *L);
int luaopen_bit(lua_State *L);
diff --git a/accel-pppd/lua/session.c b/accel-pppd/lua/session.c
index 277b299f..bd98911b 100644
--- a/accel-pppd/lua/session.c
+++ b/accel-pppd/lua/session.c
@@ -197,7 +197,7 @@ static int session_ipv6(lua_State *L)
if (!ses)
return 0;
- if (ses->ipv6) {
+ if (ses->ipv6 && !list_empty(&ses->ipv6->addr_list)) {
a = list_entry(ses->ipv6->addr_list.next, typeof(*a), entry);
if (a->prefix_len) {
build_ip6_addr(a, ses->ipv6->peer_intf_id, &addr);
diff --git a/accel-pppd/memdebug.h b/accel-pppd/memdebug.h
index 09978f43..501b882d 100644
--- a/accel-pppd/memdebug.h
+++ b/accel-pppd/memdebug.h
@@ -21,6 +21,11 @@ int md_asprintf(const char *fname, int line, char **strp, const char *fmt, ...)
void md_check(void *ptr);
#else
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#define _malloc(size) malloc(size)
#define _realloc(ptr, size) realloc(ptr, size)
#define _free(ptr) free(ptr)
diff --git a/accel-pppd/ppp/ppp_auth.h b/accel-pppd/ppp/ppp_auth.h
index 5049fd5a..c8df9fc6 100644
--- a/accel-pppd/ppp/ppp_auth.h
+++ b/accel-pppd/ppp/ppp_auth.h
@@ -1,7 +1,10 @@
#ifndef PPP_AUTH_H
#define PPP_AUTH_H
+#include <stdint.h>
+
#include "list.h"
+#include "ppp.h"
struct ppp_auth_handler_t;
diff --git a/accel-pppd/ppp/ppp_fsm.h b/accel-pppd/ppp/ppp_fsm.h
index 57abb869..6208d9ad 100644
--- a/accel-pppd/ppp/ppp_fsm.h
+++ b/accel-pppd/ppp/ppp_fsm.h
@@ -1,6 +1,11 @@
#ifndef PPP_FSM_H
#define PPP_FSM_H
+#include <stdint.h>
+
+#include "ppp.h"
+#include "triton.h"
+
typedef enum {FSM_Initial=0,FSM_Starting,FSM_Closed,FSM_Stopped,FSM_Closing,FSM_Stopping,FSM_Req_Sent,FSM_Ack_Rcvd,FSM_Ack_Sent,FSM_Opened} FSM_STATE;
/*
* CP (LCP, IPCP, etc.) codes.
@@ -18,8 +23,6 @@ typedef enum {FSM_Initial=0,FSM_Starting,FSM_Closed,FSM_Stopped,FSM_Closing,FSM_
#define DISCARDREQ 11 /* Discard Request */
#define IDENT 12 /* Identification */
-struct ppp_t;
-
struct ppp_fsm_t
{
struct ppp_t *ppp;
diff --git a/accel-pppd/ppp/ppp_lcp.h b/accel-pppd/ppp/ppp_lcp.h
index cfc81229..10c55b06 100644
--- a/accel-pppd/ppp/ppp_lcp.h
+++ b/accel-pppd/ppp/ppp_lcp.h
@@ -4,7 +4,9 @@
#include <stdint.h>
#include "triton.h"
+#include "ppp.h"
#include "ppp_fsm.h"
+
/*
* Options.
*/
diff --git a/accel-pppd/radius/radius.h b/accel-pppd/radius/radius.h
index 6428bb1f..9fc8869d 100644
--- a/accel-pppd/radius/radius.h
+++ b/accel-pppd/radius/radius.h
@@ -1,9 +1,13 @@
#ifndef __RADIUS_H
#define __RADIUS_H
+#include <netinet/in.h>
#include <stdint.h>
#include <sys/time.h>
+#include "ap_session.h"
+#include "list.h"
+
#define REQ_LENGTH_MAX 4096
#define ATTR_TYPE_INTEGER 0
@@ -112,8 +116,6 @@ struct rad_plugin_t
int (*send_accounting_request)(struct rad_plugin_t *, struct rad_packet_t *pack);
};
-struct ap_session;
-
void rad_register_plugin(struct ap_session *, struct rad_plugin_t *);
struct rad_dict_attr_t *rad_dict_find_attr(const char *name);
diff --git a/accel-pppd/triton/mempool.h b/accel-pppd/triton/mempool.h
index 9b95af09..9ad2c370 100644
--- a/accel-pppd/triton/mempool.h
+++ b/accel-pppd/triton/mempool.h
@@ -15,6 +15,8 @@ mempool_t *mempool_create2(int size);
struct mempool_stat_t mempool_get_stat(void);
#ifdef MEMDEBUG
+#include "memdebug.h"
+
void *md_mempool_alloc(mempool_t*, const char *fname, int line);
#define mempool_alloc(pool) md_mempool_alloc(pool, __FILE__, __LINE__)
#define mempool_free(ptr) md_free(ptr, __FILE__, __LINE__)