summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/accel-ppp.conf1
-rw-r--r--accel-pppd/accel-ppp.conf.511
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c38
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c12
-rw-r--r--accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt23
-rw-r--r--accel-pppd/extra/net-snmp/CMakeLists.txt1
-rw-r--r--accel-pppd/extra/net-snmp/statIPOE.c93
-rw-r--r--accel-pppd/extra/net-snmp/statIPOE.h11
8 files changed, 175 insertions, 15 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index 707287f..00e08c5 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -118,6 +118,7 @@ start=dhcpv4
#offer-delay=0,100:100,200:200,-1:1000
#vlan-mon=eth0,10-200
#vlan-timeout=60
+#vlan-name=%I.%N
#ip-pool=ipoe
interface=eth0
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index fd9db87..73a3233 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -347,6 +347,17 @@ vlan-mon=eth1,2,5,10,20-30
.TP
.BI "vlan-timeout=" n
Specifies time of vlan inactivity before it will be removed (seconds).
+.TP
+.BI "vlan-name=" pattern
+Specifies pattern of vlan interface name. Pattern may contain following macros:
+.br
+.B %I
+- name of patern interface.
+.br
+.B %N
+- number of vlan.
+.br
+By default vlan-name=%I.%N.
.SH [dns]
.TP
.BI "dns1=" x.x.x.x
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 8ec4980..d9d71de 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -132,6 +132,7 @@ static int conf_verbose;
static const char *conf_agent_remote_id;
static int conf_proto;
static LIST_HEAD(conf_offer_delay);
+static const char *conf_vlan_name;
static unsigned int stat_starting;
static unsigned int stat_active;
@@ -1846,6 +1847,32 @@ static int get_offer_delay()
return 0;
}
+static int make_vlan_name(const char *parent, int vid, char *name)
+{
+ char *ptr1 = name, *endptr = name + IFNAMSIZ - 1;
+ const char *ptr2 = conf_vlan_name;
+ char num[5], *ptr3 = num;
+
+ sprintf(num, "%i", vid);
+
+ while (ptr1 < endptr && *ptr2) {
+ if (ptr2[0] == '%' && ptr2[1] == 'I') {
+ while (ptr1 < endptr && *parent)
+ *ptr1++ = *parent++;
+ ptr2 += 2;
+ } else if (ptr2[0] == '%' && ptr2[1] == 'N') {
+ while (ptr1 < endptr && *ptr3)
+ *ptr1++ = *ptr3++;
+ ptr2 += 2;
+ } else
+ *ptr1++ = *ptr2++;
+ }
+
+ *ptr1 = 0;
+
+ return ptr1 == endptr;
+}
+
void ipoe_vlan_notify(int ifindex, int vid)
{
struct conf_sect_t *sect = conf_get_section("ipoe");
@@ -1857,6 +1884,7 @@ void ipoe_vlan_notify(int ifindex, int vid)
const char *pcre_err;
char *pattern;
int pcre_offset;
+ char ifname[IFNAMSIZ];
if (!sect)
return;
@@ -1868,12 +1896,12 @@ void ipoe_vlan_notify(int ifindex, int vid)
return;
}
- if (strlen(ifr.ifr_name) + 5 >= sizeof(ifr.ifr_name)) {
+ if (make_vlan_name(ifr.ifr_name, vid, ifname)) {
log_error("ipoe: vlan-mon: %s.%i: interface name is too long\n", ifr.ifr_name, vid);
return;
}
-
- sprintf(ifr.ifr_name + strlen(ifr.ifr_name), ".%i", vid);
+
+ strcpy(ifr.ifr_name, ifname);
len = strlen(ifr.ifr_name);
log_info2("ipoe: create vlan %s\n", ifr.ifr_name);
@@ -2857,6 +2885,10 @@ static void load_config(void)
conf_offer_timeout = 10;
conf_ip_pool = conf_get_opt("ipoe", "ip-pool");
+
+ conf_vlan_name = conf_get_opt("ipoe", "vlan-name");
+ if (!conf_vlan_name)
+ conf_vlan_name = "%I.%N";
#ifdef RADIUS
if (triton_module_loaded("radius"))
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index e14bab8..3b2e3f2 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1822,12 +1822,6 @@ static int l2tp_send_ICCN(struct l2tp_sess_t *sess)
return -1;
}
- if (l2tp_packet_add_int16(pack, Assigned_Session_ID,
- sess->sid, 1) < 0) {
- log_session(log_error, sess, "impossible to send ICCN:"
- " adding data to packet failed\n");
- goto out_err;
- }
if (l2tp_packet_add_int32(pack, TX_Speed, 1000, 1) < 0) {
log_session(log_error, sess, "impossible to send ICCN:"
" adding data to packet failed\n");
@@ -3786,12 +3780,6 @@ static int l2tp_create_tunnel_exec(const char *cmd, char * const *fields,
return CLI_CMD_SYNTAX;
}
- if (iprange_client_check(peer.sin_addr.s_addr) < 0) {
- cli_sendv(client, "peer address %s out of IP range\r\n",
- fields[peer_indx]);
- return CLI_CMD_INVAL;
- }
-
conn = l2tp_tunnel_alloc(&peer, &host, 3, lns_mode, 0, hide_avps);
if (conn == NULL) {
cli_send(client, "tunnel allocation failed\r\n");
diff --git a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
index 20f7f94..847a270 100644
--- a/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
+++ b/accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
@@ -33,6 +33,7 @@ statPPP OBJECT IDENTIFIER ::= { accelPPPStat 2 }
statPPTP OBJECT IDENTIFIER ::= { accelPPPStat 3 }
statL2TP OBJECT IDENTIFIER ::= { accelPPPStat 4 }
statPPPOE OBJECT IDENTIFIER ::= { accelPPPStat 5 }
+statIPOE OBJECT IDENTIFIER ::= { accelPPPStat 6 }
--statRadius OBJECT IDENTIFIER ::= { accelPPPStat 6 }
@@ -155,6 +156,27 @@ statPPPOEActive OBJECT-TYPE
"count of active connections"
::= { statPPPOE 2 }
+--
+-- IPOE stats
+--
+
+statIPOEStarting OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "count of connections which are
+ in starting phase"
+ ::= { statIPOE 1 }
+
+statIPOEActive OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "count of active connections"
+ ::= { statIPOE 2 }
+
--
-- PPP session table
@@ -227,6 +249,7 @@ sesType OBJECT-TYPE
pptp(1),
l2tp(2),
pppoe(3)
+ ipoe(4)
}
MAX-ACCESS read-only
STATUS current
diff --git a/accel-pppd/extra/net-snmp/CMakeLists.txt b/accel-pppd/extra/net-snmp/CMakeLists.txt
index 7633f37..5571849 100644
--- a/accel-pppd/extra/net-snmp/CMakeLists.txt
+++ b/accel-pppd/extra/net-snmp/CMakeLists.txt
@@ -10,6 +10,7 @@ SET(sources
statPPP.c
statPPPOE.c
statPPTP.c
+ statIPOE.c
terminate.c
shutdown.c
exec_cli.c
diff --git a/accel-pppd/extra/net-snmp/statIPOE.c b/accel-pppd/extra/net-snmp/statIPOE.c
new file mode 100644
index 0000000..1e15660
--- /dev/null
+++ b/accel-pppd/extra/net-snmp/statIPOE.c
@@ -0,0 +1,93 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "triton.h"
+#include "statIPOE.h"
+
+/*
+ * The variables we want to tie the relevant OIDs to.
+ * The agent will handle all GET and (if applicable) SET requests
+ * to these variables automatically, changing the values as needed.
+ */
+
+void ipoe_get_stat(unsigned int **, unsigned int **);
+
+static unsigned int *stat_starting;
+static unsigned int *stat_active;
+
+/*
+ * Our initialization routine, called automatically by the agent
+ * (Note that the function name must match init_FILENAME())
+ */
+void
+init_statIPOE(void)
+{
+ netsnmp_handler_registration *reg;
+ netsnmp_watcher_info *winfo;
+
+ static oid statIPOEStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,5,1 };
+ static oid statIPOEActive_oid[] = { 1,3,6,1,4,1,8072,100,1,5,2 };
+
+ /*
+ * a debugging statement. Run the agent with -DstatIPOE to see
+ * the output of this debugging statement.
+ */
+ DEBUGMSGTL(("statIPOE", "Initializing the statIPOE module\n"));
+
+ if (!triton_module_loaded("ipoe"))
+ return;
+
+ ipoe_get_stat(&stat_starting, &stat_active);
+
+ /*
+ * Register scalar watchers for each of the MIB objects.
+ * The ASN type and RO/RW status are taken from the MIB definition,
+ * but can be adjusted if needed.
+ *
+ * In most circumstances, the scalar watcher will handle all
+ * of the necessary processing. But the NULL parameter in the
+ * netsnmp_create_handler_registration() call can be used to
+ * supply a user-provided handler if necessary.
+ *
+ * This approach can also be used to handle Counter64, string-
+ * and OID-based watched scalars (although variable-sized writeable
+ * objects will need some more specialised initialisation).
+ */
+ DEBUGMSGTL(("statIPOE",
+ "Initializing statIPOEStarting scalar integer. Default value = %d\n",
+ 0));
+ reg = netsnmp_create_handler_registration(
+ "statIPOEStarting", NULL,
+ statIPOEStarting_oid, OID_LENGTH(statIPOEStarting_oid),
+ HANDLER_CAN_RONLY);
+ winfo = netsnmp_create_watcher_info(
+ stat_starting, sizeof(*stat_starting),
+ ASN_INTEGER, WATCHER_FIXED_SIZE);
+ if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
+ snmp_log( LOG_ERR, "Failed to register watched statIPOEStarting" );
+ }
+
+ DEBUGMSGTL(("statIPOE",
+ "Initializing statIPOEActive scalar integer. Default value = %d\n",
+ 0));
+ reg = netsnmp_create_handler_registration(
+ "statIPOEActive", NULL,
+ statIPOEActive_oid, OID_LENGTH(statIPOEActive_oid),
+ HANDLER_CAN_RONLY);
+ winfo = netsnmp_create_watcher_info(
+ stat_active, sizeof(*stat_active),
+ ASN_INTEGER, WATCHER_FIXED_SIZE);
+ if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
+ snmp_log( LOG_ERR, "Failed to register watched statIPOEActive" );
+ }
+
+
+ DEBUGMSGTL(("statIPOE",
+ "Done initalizing statIPOE module\n"));
+}
diff --git a/accel-pppd/extra/net-snmp/statIPOE.h b/accel-pppd/extra/net-snmp/statIPOE.h
new file mode 100644
index 0000000..a8e9be7
--- /dev/null
+++ b/accel-pppd/extra/net-snmp/statIPOE.h
@@ -0,0 +1,11 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $
+ */
+#ifndef STATPPPOE_H
+#define STATPPPOE_H
+
+/* function declarations */
+void init_statIPOE(void);
+
+#endif /* STATPPPOE_H */