summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe/ipoe.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2017-12-27 14:54:00 +0300
committerDmitry Kozlov <xeb@mail.ru>2017-12-27 14:54:00 +0300
commit5ed4291f41c8f493f5cf6737e871ca1bf4e7f2a5 (patch)
treee192a4c992788f374f3c352e3ca7d02be9bc3d0f /accel-pppd/ctrl/ipoe/ipoe.c
parent1d6f68a518cd7f8cc182080b57d76ed16dc3973a (diff)
downloadaccel-ppp-5ed4291f41c8f493f5cf6737e871ca1bf4e7f2a5.tar.gz
accel-ppp-5ed4291f41c8f493f5cf6737e871ca1bf4e7f2a5.zip
ipoe: include server's mac into weight notify packet to be used as additional key when weights are equal
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe.c')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 16cc65fd..ed2419fd 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1685,7 +1685,7 @@ static int check_notify(struct ipoe_serv *serv, struct dhcpv4_packet *pack)
if (!opt)
return 0;
- if (opt->len != 8)
+ if (opt->len != 8 + ETH_ALEN)
return 0;
if (*(uint32_t *)opt->data != htonl(ACCEL_PPP_MAGIC))
@@ -1694,8 +1694,8 @@ static int check_notify(struct ipoe_serv *serv, struct dhcpv4_packet *pack)
w = htonl(*(uint32_t *)(opt->data + 4));
list_for_each_entry(ses, &serv->sessions, entry) {
- if (ses->xid == pack->hdr->xid) {
- if (w < ses->weight || ses->weight == 0) {
+ if (ses->xid == pack->hdr->xid && memcmp(pack->hdr->chaddr, ses->hwaddr, ETH_ALEN) == 0) {
+ if (w < ses->weight || ses->weight == 0 || (w == ses->weight && memcmp(serv->hwaddr, opt->data + 8, ETH_ALEN) < 0)) {
log_debug("ipoe: terminate %s by weight %u (%u)\n", ses->ses.ifname, w, ses->weight);
triton_context_call(&ses->ctx, (triton_event_func)__terminate, &ses->ses);
}