diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-04-12 00:27:09 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-04-12 00:27:09 +0300 |
commit | 599f11b55fefe2eca2c3571a02ce43b0aaf577a1 (patch) | |
tree | 25d7e1ae61cf78aa90893cb07589b119a8d89472 /accel-pppd/ctrl | |
parent | d49a25b9f48ef5c65fe91a79e62c2f677169eac7 (diff) | |
download | accel-ppp-599f11b55fefe2eca2c3571a02ce43b0aaf577a1.tar.gz accel-ppp-599f11b55fefe2eca2c3571a02ce43b0aaf577a1.zip |
ipoe: generate EUI-64 interface identifier for ipv6 addresses
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 620e1f4..e4c1fae 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -825,6 +825,17 @@ static void __ipoe_session_start(struct ipoe_session *ses) } } +static void make_ipv6_intfid(uint64_t *intfid, const uint8_t *hwaddr) +{ + uint8_t *a = (uint8_t *)intfid; + + memcpy(a, hwaddr, 3); + a[3] = 0xff; + a[4] = 0xfe; + memcpy(a + 5, hwaddr + 3, 3); + a[0] ^= 0x02; +} + static void __ipoe_session_activate(struct ipoe_session *ses) { uint32_t addr, gw = 0; @@ -885,8 +896,10 @@ static void __ipoe_session_activate(struct ipoe_session *ses) ses->ses.ipv6 = ipdb_get_ipv6(&ses->ses); if (!ses->ses.ipv6) log_ppp_warn("ipoe: no free IPv6 address\n"); - else if (!ses->ses.ipv6->peer_intf_id) - ses->ses.ipv6->peer_intf_id = htobe64(1); + else { + make_ipv6_intfid(&ses->ses.ipv6->peer_intf_id, ses->hwaddr); + make_ipv6_intfid(&ses->ses.ipv6->intf_id, ses->serv->hwaddr); + } } __sync_sub_and_fetch(&stat_starting, 1); |