int fr_dhcp_add_arp_entry(int fd, const char *interface, VALUE_PAIR *hwvp, VALUE_PAIR *clvp);
-int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original);
+int fr_dhcp_encode(RADIUS_PACKET *packet);
ssize_t fr_dhcp_decode_options(uint8_t *data, size_t len, VALUE_PAIR **head);
int fr_dhcp_decode(RADIUS_PACKET *packet);
}
-int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original)
+int fr_dhcp_encode(RADIUS_PACKET *packet)
{
unsigned int i, num_vps;
uint8_t *p;
*/
packet->data_len = dhcp_size;
- if (original) {
- /*
- * FIXME: This may set it to broadcast, which we don't
- * want. Instead, set it to the real address of the
- * socket.
- */
- packet->src_ipaddr = original->dst_ipaddr;
-
- packet->sockfd = original->sockfd;
- }
-
if (packet->data_len < DEFAULT_PACKET_SIZE) {
memset(packet->data + packet->data_len, 0,
DEFAULT_PACKET_SIZE - packet->data_len);
/*
* Encode the packet
*/
- if (fr_dhcp_encode(request, NULL) < 0) {
+ if (fr_dhcp_encode(request) < 0) {
fprintf(stderr, "dhclient: failed encoding: %s\n",
fr_strerror());
exit(1);
request->packet->dst_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
request->packet->dst_port = request->packet->dst_port;
- if (fr_dhcp_encode(request->packet, NULL) < 0) {
+ if (fr_dhcp_encode(request->packet) < 0) {
DEBUG("dhcprelay_process_client_request: ERROR in fr_dhcp_encode\n");
return -1;
}
}
}
- if (fr_dhcp_encode(request->packet, NULL) < 0) {
+ if (fr_dhcp_encode(request->packet) < 0) {
DEBUG("dhcprelay_process_server_reply: ERROR in fr_dhcp_encode\n");
return -1;
}
if (request->reply->code == 0) return 0; /* don't reply */
if (request->packet->code != request->reply->code) {
- if (fr_dhcp_encode(request->reply, request->packet) < 0) {
+ if (fr_dhcp_encode(request->reply) < 0) {
return -1;
}
} else {
- if (fr_dhcp_encode(request->reply, NULL) < 0) {
+ if (fr_dhcp_encode(request->reply) < 0) {
return -1;
}
}