diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-07-24 22:11:59 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-07-24 22:11:59 +0400 |
commit | aa53abbed4e1f833ee64e2a4d4b36e9b4175775a (patch) | |
tree | 8d33c85ce4cf7c3498ec2a15de9087a1cfd86195 /accel-pppd/ctrl | |
parent | 768ad4d4f1930ffe1630e82789cd58191b651a64 (diff) | |
parent | 2871fd96eec87d2781ec7cb6460479f1519a8e2b (diff) | |
download | accel-ppp-aa53abbed4e1f833ee64e2a4d4b36e9b4175775a.tar.gz accel-ppp-aa53abbed4e1f833ee64e2a4d4b36e9b4175775a.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/accel-ppp/code
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 07019d89..fba6291e 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -88,6 +88,7 @@ char *conf_pado_delay; int conf_tr101 = 1; int conf_padi_limit = 0; int conf_mppe = MPPE_UNSET; +int conf_sid_uppercase = 0; static const char *conf_ip_pool; enum {CSID_MAC, CSID_IFNAME, CSID_IFNAME_MAC}; static int conf_called_sid; @@ -285,25 +286,48 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui conn->ctrl.called_station_id = _strdup(serv->ifname); else if (conf_called_sid == CSID_IFNAME_MAC) { conn->ctrl.called_station_id = _malloc(IFNAMSIZ + 19); - sprintf(conn->ctrl.called_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, + if (conf_sid_uppercase) + sprintf(conn->ctrl.called_station_id, "%s:%02X:%02X:%02X:%02X:%02X:%02X", serv->ifname, serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + else + sprintf(conn->ctrl.called_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, + serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + } else { conn->ctrl.called_station_id = _malloc(IFNAMSIZ + 19); if (conf_ifname_in_sid == 2 || conf_ifname_in_sid == 3) - sprintf(conn->ctrl.called_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, + if (conf_sid_uppercase) + sprintf(conn->ctrl.called_station_id, "%s:%02X:%02X:%02X:%02X:%02X:%02X", serv->ifname, + serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + else + sprintf(conn->ctrl.called_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + else - sprintf(conn->ctrl.called_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", + if (conf_sid_uppercase) + sprintf(conn->ctrl.called_station_id, "%02X:%02X:%02X:%02X:%02X:%02X", + serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + else + sprintf(conn->ctrl.called_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", serv->hwaddr[0], serv->hwaddr[1], serv->hwaddr[2], serv->hwaddr[3], serv->hwaddr[4], serv->hwaddr[5]); + } conn->ctrl.calling_station_id = _malloc(IFNAMSIZ + 19); if (conf_ifname_in_sid == 1 || conf_ifname_in_sid == 3) - sprintf(conn->ctrl.calling_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, + if (conf_sid_uppercase) + sprintf(conn->ctrl.calling_station_id, "%s:%02X:%02X:%02X:%02X:%02X:%02X", serv->ifname, + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + else + sprintf(conn->ctrl.calling_station_id, "%s:%02x:%02x:%02x:%02x:%02x:%02x", serv->ifname, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); else - sprintf(conn->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", + if (conf_sid_uppercase) + sprintf(conn->ctrl.calling_station_id, "%02X:%02X:%02X:%02X:%02X:%02X", + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); + else + sprintf(conn->ctrl.calling_station_id, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); ppp_init(&conn->ppp); @@ -1503,6 +1527,10 @@ static void load_config(void) if (opt) conf_padi_limit = atoi(opt); + opt = conf_get_opt("pppoe", "sid-uppercase"); + if (opt) + conf_sid_uppercase = atoi(opt); + conf_mppe = MPPE_UNSET; opt = conf_get_opt("pppoe", "mppe"); if (opt) { |