summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-08-17 12:30:03 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-08-17 12:30:03 +0300
commitae822e2dc968a1d0e9985f4f864343c6684f95bc (patch)
tree0616f2a4d541840afa8966f0287178bd42a77dc7 /accel-pppd
parent87ddec14232bec6d533a0bd337468a7e56de0b80 (diff)
downloadaccel-ppp-ae822e2dc968a1d0e9985f4f864343c6684f95bc.tar.gz
accel-ppp-ae822e2dc968a1d0e9985f4f864343c6684f95bc.zip
ipoe: introduced 'calling-sid' option
This option specifies value of Calling-Station-Id value. Available options are 'mac' and 'ip'.
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/accel-ppp.conf1
-rw-r--r--accel-pppd/accel-ppp.conf.53
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c25
3 files changed, 26 insertions, 3 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index 3102e20f..328831bc 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -138,6 +138,7 @@ start=dhcpv4
#session-timeout=0
#soft-terminate=0
#check-mac-change=1
+#calling-sid=mac
interface=eth0
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index b5c5e881..bb6dd4d8 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -390,6 +390,9 @@ Turns on soft terminate mode. Soft terminate means that session won't be termina
.TP
.BI "check-mac-change=" 0|1
If enabled accel-ppp will terminate session when detects change of mac address of client (by default it is enabled).
+.TP
+.BI "calling-sid=" mac|ip
+Specifies value of Calling-Station-Id attribute.
.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 81c4df30..7112051e 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -95,6 +95,8 @@ struct request_item {
int cnt;
};
+enum {SID_MAC, SID_IP};
+
static int conf_dhcpv4 = 1;
static int conf_up;
static int conf_mode;
@@ -152,6 +154,7 @@ static const char *conf_vlan_name;
static int conf_ip_unnumbered;
static int conf_check_mac_change;
static int conf_soft_terminate;
+static int conf_calling_sid = SID_MAC;
static unsigned int stat_starting;
static unsigned int stat_active;
@@ -1791,9 +1794,14 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc
ses->ctrl.called_station_id = _strdup(serv->ifname);
- ses->ctrl.calling_station_id = _malloc(19);
- sprintf(ses->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x",
- hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
+ if (conf_calling_sid == SID_MAC) {
+ ses->ctrl.calling_station_id = _malloc(19);
+ sprintf(ses->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x",
+ hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
+ } else {
+ ses->ctrl.calling_station_id = _malloc(17);
+ u_inet_ntoa(iph->saddr, ses->ctrl.calling_station_id);
+ }
ses->username = _malloc(17);
u_inet_ntoa(iph->saddr, ses->username);
@@ -3288,6 +3296,17 @@ static void load_config(void)
else
conf_check_mac_change = 1;
+ opt = conf_get_opt("ipoe", "calling-sid");
+ if (opt) {
+ if (!strcmp(opt, "mac"))
+ conf_calling_sid = SID_MAC;
+ else if (!strcmp(opt, "ip"))
+ conf_calling_sid = SID_IP;
+ else
+ log_error("ipoe: failed to parse 'calling-sid=%s'\n", opt);
+ } else
+ conf_calling_sid = SID_MAC;
+
#ifdef RADIUS
if (triton_module_loaded("radius"))
load_radius_attrs();