summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2013-10-30 16:00:16 +0400
committerDmitry Kozlov <xeb@mail.ru>2013-10-30 16:00:16 +0400
commit7499d96d719042e4b8a89dbbacf2fa9138d700cc (patch)
tree195e9c6e7d13faae7fd16e9891c4e8c06d1c74a0 /accel-pppd/ctrl
parent2351344eb1dfbe882589acc48cf7ef0c989e862f (diff)
downloadaccel-ppp-7499d96d719042e4b8a89dbbacf2fa9138d700cc.tar.gz
accel-ppp-7499d96d719042e4b8a89dbbacf2fa9138d700cc.zip
ipoe: implemented source/local address detection for up sessions
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 05ce44e2..8ec49808 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -640,8 +640,27 @@ static void __ipoe_session_start(struct ipoe_session *ses)
ses->timer.period = 0;
ses->timer.expire_tv.tv_sec = conf_offer_timeout;
triton_timer_add(&ses->ctx, &ses->timer, 0);
- } else
+ } else {
+ if (!ses->siaddr)
+ find_gw_addr(ses);
+
+ if (!ses->siaddr)
+ ses->siaddr = ses->serv->opt_src;
+
+ if (!ses->siaddr)
+ ses->siaddr = iproute_get(ses->yiaddr);
+
+ if (!ses->siaddr) {
+ log_ppp_error("can't determine local address\n");
+ ap_session_terminate(&ses->ses, TERM_NAS_ERROR, 0);
+ return;
+ }
+
+ if (ses->ses.ipv4 && !ses->ses.ipv4->addr)
+ ses->ses.ipv4->addr = ses->siaddr;
+
__ipoe_session_activate(ses);
+ }
}
static void ipoe_serv_add_addr(struct ipoe_serv *serv, in_addr_t addr)