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 | |
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
-rw-r--r-- | accel-pppd/accel-ppp.conf | 1 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 38 | ||||
-rw-r--r-- | drivers/ipoe/ipoe.c | 2 |
3 files changed, 35 insertions, 6 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index 4af92ca..943dc92 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -75,6 +75,7 @@ called-sid=mac #padi-limit=0 #ip-pool=pppoe #interface=eth1,padi-limit=1000 +#sid-uppercase=0 interface=eth0 [l2tp] diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 07019d8..fba6291 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) { diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c index 04fc711..cee7edb 100644 --- a/drivers/ipoe/ipoe.c +++ b/drivers/ipoe/ipoe.c @@ -1680,7 +1680,7 @@ static int ipoe_nl_cmd_del_exclude(struct sk_buff *skb, struct genl_info *info) if (!info->attrs[IPOE_ATTR_ADDR]) return -EINVAL; - addr = ntohl(nla_get_u32(info->attrs[IPOE_ATTR_ADDR])); + addr = nla_get_u32(info->attrs[IPOE_ATTR_ADDR]); if (!addr) { clean_excl_list(); return 0; |