summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-12-09 20:51:41 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-12-09 20:51:41 +0300
commit58ed82d19ab229f203e03c3eb10f78863cb5177a (patch)
tree673bce27f56687ec6675ce40a4d9d283dc853e50
parentfc33b4c6ec83533d35db3626887fb5156478bca3 (diff)
downloadaccel-ppp-58ed82d19ab229f203e03c3eb10f78863cb5177a.tar.gz
accel-ppp-58ed82d19ab229f203e03c3eb10f78863cb5177a.zip
ipoe: assign 2 ptp address to interface for sessions with nat
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 39f414ab..46bf68d0 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -933,9 +933,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses)
if (ses->ifindex == -1) {
if (serv->opt_ifcfg)
ipaddr_add_peer(serv->ifindex, ses->router, ses->yiaddr);
- } else if (ses->ses.ipv4->peer_addr != ses->yiaddr)
- ipaddr_add_peer(ses->ifindex, ses->router, ses->yiaddr);
- else
+ } else
ses->ctrl.dont_ifcfg = 0;
if (ses->serv->opt_mode == MODE_L2 && ses->serv->opt_ipv6 && sock6_fd != -1) {
@@ -1055,6 +1053,9 @@ static void ipoe_session_started(struct ap_session *s)
if (ses->timer.tpd)
triton_timer_mod(&ses->timer, 0);
+ if (ses->ses.ipv4->peer_addr != ses->yiaddr)
+ ipaddr_add_peer(ses->ses.ifindex, ses->router, ses->yiaddr);
+
if (ses->ifindex != -1 && ses->xid) {
ses->dhcpv4 = dhcpv4_create(ses->ctrl.ctx, ses->ses.ifname, "");
if (!ses->dhcpv4) {
@@ -1063,9 +1064,6 @@ static void ipoe_session_started(struct ap_session *s)
}
ses->dhcpv4->recv = ipoe_ses_recv_dhcpv4;
}
-
- if (ses->ses.ipv4->peer_addr != ses->yiaddr)
- iproute_add(ses->ifindex, ses->ses.ipv4->addr, ses->ses.ipv4->peer_addr, 0, conf_proto, 32);
}
static void ipoe_session_free(struct ipoe_session *ses)
@@ -1125,7 +1123,7 @@ static void ipoe_session_finished(struct ap_session *s)
ioctl(sock_fd, SIOCSIFFLAGS, &ifr);
}
- ipaddr_del_peer(ses->ifindex, ses->router, ses->yiaddr);
+ ipaddr_del_peer(s->ifindex, ses->router, ses->yiaddr);
ipoe_nl_modify(ses->ifindex, 0, 0, 0, 0, NULL);