summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe/dhcpv4.c
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2013-01-26 08:48:19 +0400
committerKozlov Dmitry <xeb@mail.ru>2013-01-26 08:48:19 +0400
commitcde7ee4d629b32c810ceac836b70a4289b4f00b3 (patch)
treee488abbf65cd9c9c993a8bf10d378aa1948eb8af /accel-pppd/ctrl/ipoe/dhcpv4.c
parent8e64c1f76836af915d9530d396ed2028decdc6d3 (diff)
downloadaccel-ppp-cde7ee4d629b32c810ceac836b70a4289b4f00b3.tar.gz
accel-ppp-cde7ee4d629b32c810ceac836b70a4289b4f00b3.zip
ipoe: insert opt82 to each relay packet
Diffstat (limited to 'accel-pppd/ctrl/ipoe/dhcpv4.c')
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c
index 0c43b944..8bcc2e02 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.c
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.c
@@ -891,7 +891,7 @@ void dhcpv4_relay_free(struct dhcpv4_relay *r, struct triton_context_t *ctx)
}
}
-int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request, uint32_t server_id)
+int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request, uint32_t server_id, const char *agent_circuit_id, const char *agent_remote_id)
{
int n;
int len = request->ptr - request->data;
@@ -899,6 +899,9 @@ int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request,
struct dhcpv4_option *opt = NULL;
uint32_t _server_id;
+ if (!request->relay_agent && dhcpv4_packet_insert_opt82(request, agent_circuit_id, agent_remote_id))
+ return -1;
+
request->hdr->giaddr = relay->giaddr;
if (server_id) {
@@ -928,7 +931,8 @@ int dhcpv4_relay_send(struct dhcpv4_relay *relay, struct dhcpv4_packet *request,
}
int dhcpv4_relay_send_release(struct dhcpv4_relay *relay, uint8_t *chaddr, uint32_t xid, uint32_t ciaddr,
- struct dhcpv4_option *client_id, struct dhcpv4_option *relay_agent)
+ struct dhcpv4_option *client_id, struct dhcpv4_option *relay_agent,
+ const char *agent_circuit_id, const char *agent_remote_id)
{
struct dhcpv4_packet *pack;
int n, len;
@@ -959,8 +963,14 @@ int dhcpv4_relay_send_release(struct dhcpv4_relay *relay, uint8_t *chaddr, uint3
if (relay_agent && dhcpv4_packet_add_opt(pack, 82, relay_agent->data, relay_agent->len))
goto out_err;
-
- *pack->ptr = 255; pack->ptr++;
+ else if (!relay_agent) {
+ pack->ptr++;
+ if (dhcpv4_packet_insert_opt82(pack, agent_circuit_id, agent_remote_id))
+ goto out_err;
+ pack->ptr--;
+ }
+
+ *pack->ptr++ = 255;
len = pack->ptr - pack->data;