diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-12-04 15:09:02 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-12-04 15:09:02 +0300 |
commit | faf40d498c6f519ea24e4063c2e64b8e9581cbbb (patch) | |
tree | 2cd7d872056c7de44bc76fc79129761afe32dbf1 /accel-pppd/ctrl | |
parent | 574912df113888ea19b4811b406612544514d9eb (diff) | |
download | accel-ppp-xebd-faf40d498c6f519ea24e4063c2e64b8e9581cbbb.tar.gz accel-ppp-xebd-faf40d498c6f519ea24e4063c2e64b8e9581cbbb.zip |
ipoe: send DHCP reply to sessions's dhcp socket if exists
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/ipoe/dhcpv4.c | 2 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c index 18dea80..330038f 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.c +++ b/accel-pppd/ctrl/ipoe/dhcpv4.c @@ -765,7 +765,7 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack if (req->hdr->giaddr) r = dhcpv4_send_udp(serv, pack, req->hdr->giaddr, DHCP_SERV_PORT); - else if (pack->hdr->ciaddr) + else if (req->hdr->ciaddr && !(pack->hdr->flags & DHCP_F_BROADCAST)) r = dhcpv4_send_udp(serv, pack, req->hdr->ciaddr, DHCP_CLIENT_PORT); else r = dhcpv4_send_raw(serv, pack, siaddr, yiaddr); diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index cca2096..32eaaa4 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -928,7 +928,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) if (ses->dhcpv4_request) { if (ses->ses.state == AP_STATE_ACTIVE) - dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); + dhcpv4_send_reply(DHCPACK, ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); else dhcpv4_send_nak(ses->serv->dhcpv4, ses->dhcpv4_request); @@ -983,9 +983,9 @@ static void ipoe_session_keepalive(struct dhcpv4_packet *pack) } if (ses->ses.state == AP_STATE_ACTIVE) { - dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); + dhcpv4_send_reply(DHCPACK, ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); } else - dhcpv4_send_nak(ses->serv->dhcpv4, ses->dhcpv4_request); + dhcpv4_send_nak(ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request); dhcpv4_packet_free(ses->dhcpv4_request); ses->dhcpv4_request = NULL; @@ -1317,7 +1317,7 @@ static void ipoe_ses_recv_dhcpv4_discover(struct dhcpv4_packet *pack) } if (ses->yiaddr) - dhcpv4_send_reply(DHCPOFFER, ses->serv->dhcpv4, pack, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); + dhcpv4_send_reply(DHCPOFFER, ses->dhcpv4 ?: ses->serv->dhcpv4, pack, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); dhcpv4_packet_free(pack); } @@ -1655,15 +1655,15 @@ static void ipoe_ses_recv_dhcpv4_relay(struct dhcpv4_packet *pack) __ipoe_session_start(ses); } else - dhcpv4_send_reply(DHCPOFFER, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); + dhcpv4_send_reply(DHCPOFFER, ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); } else if (pack->msg_type == DHCPACK) { if (ses->ses.state == AP_STATE_STARTING) __ipoe_session_activate(ses); else - dhcpv4_send_reply(DHCPACK, ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); + dhcpv4_send_reply(DHCPACK, ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request, ses->yiaddr, ses->siaddr, ses->router, ses->mask, ses->lease_time, ses->dhcpv4_relay_reply); } else if (pack->msg_type == DHCPNAK) { - dhcpv4_send_nak(ses->serv->dhcpv4, ses->dhcpv4_request); + dhcpv4_send_nak(ses->dhcpv4 ?: ses->serv->dhcpv4, ses->dhcpv4_request); ap_session_terminate(&ses->ses, TERM_NAS_REQUEST, 0); return; } |