summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-02-20 11:40:04 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-02-20 11:40:04 +0300
commita8cf09aafaf8bd4995cd205537ec8d8aa7fdb969 (patch)
tree9633ce95de21b60ff962f0fb90a0c6a2562ae145 /accel-pppd
parent5697671c8cb6018de4e4307c459afd25d3b58410 (diff)
downloadaccel-ppp-a8cf09aafaf8bd4995cd205537ec8d8aa7fdb969.tar.gz
accel-ppp-a8cf09aafaf8bd4995cd205537ec8d8aa7fdb969.zip
ipoe: set Calling-Station-Id to client mac address for UP sessions
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 3296bd31..6c1953b3 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -343,6 +343,9 @@ static void ipoe_relay_timeout(struct triton_timer_t *t)
static char *ipoe_session_get_username(struct ipoe_session *ses)
{
+ if (ses->username)
+ return ses->username;
+
#ifdef USE_LUA
if (ses->serv->opt_username == USERNAME_LUA)
return ipoe_lua_get_username(ses, ses->serv->opt_lua_username_func ? : conf_lua_username_func);
@@ -1707,6 +1710,7 @@ static void ipoe_recv_dhcpv4_relay(struct dhcpv4_packet *pack)
static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struct ethhdr *eth, struct iphdr *iph)
{
struct ipoe_session *ses;
+ uint8_t *hwaddr = eth->h_source;
if (ap_shutdown)
return NULL;
@@ -1722,10 +1726,14 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc
memcpy(ses->hwaddr, eth->h_source, 6);
ses->yiaddr = iph->saddr;
- ses->ctrl.calling_station_id = _malloc(17);
ses->ctrl.called_station_id = _strdup(serv->ifname);
- u_inet_ntoa(iph->saddr, ses->ctrl.calling_station_id);
+ 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]);
+
+ ses->username = _malloc(17);
+ u_inet_ntoa(iph->saddr, ses->username);
ses->ses.chan_name = ses->ctrl.calling_station_id;