int udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
uint32_t source_nip, int source_port,
- uint32_t dest_nip, int dest_port,
- int send_flags
-) FAST_FUNC;
+ uint32_t dest_nip, int dest_port) FAST_FUNC;
void udhcp_sp_setup(void) FAST_FUNC;
void udhcp_sp_fd_set(struct pollfd *pfds, int extra_fd) FAST_FUNC;
opt_ptr = add_d6_client_options(opt_ptr);
bb_error_msg("sending %s", "renew");
- if (server_ipv6) {
+ if (server_ipv6)
return d6_send_kernel_packet(
&packet, (opt_ptr - (uint8_t*) &packet),
our_cur_ipv6, CLIENT_PORT6,
server_ipv6, SERVER_PORT6,
client_config.ifindex
- /* TODO? send_flags: MSG_DONTROUTE (see IPv4 code for reason why) */
);
- }
return d6_mcast_from_client_config_ifindex(&packet, opt_ptr);
}
static int bcast_or_ucast(struct dhcp_packet *packet, uint32_t ciaddr, uint32_t server)
{
- if (server) {
- /* Without MSG_DONTROUTE, the packet was seen routed over
- * _other interface_ if server ID is bogus (example: 1.1.1.1).
- */
+ if (server)
return udhcp_send_kernel_packet(packet,
ciaddr, CLIENT_PORT,
- server, SERVER_PORT,
- /*send_flags: "to hosts only on directly connected networks" */ MSG_DONTROUTE
- );
- }
+ server, SERVER_PORT);
return raw_bcast_from_client_config_ifindex(packet, ciaddr);
}
udhcp_send_kernel_packet(dhcp_pkt,
server_config.server_nip, SERVER_PORT,
- dhcp_pkt->gateway_nip, SERVER_PORT,
- /*send_flags:*/ 0
- );
+ dhcp_pkt->gateway_nip, SERVER_PORT);
}
static void send_packet(struct dhcp_packet *dhcp_pkt, int force_broadcast)
/* Let the kernel do all the work for packet generation */
int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
uint32_t source_nip, int source_port,
- uint32_t dest_nip, int dest_port,
- int send_flags)
+ uint32_t dest_nip, int dest_port)
{
struct sockaddr_in sa;
unsigned padding;
padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options);
if (padding > DHCP_SIZE - 300)
padding = DHCP_SIZE - 300;
- result = send(fd, dhcp_pkt, DHCP_SIZE - padding, send_flags);
- msg = "send";
+ result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding);
+ msg = "write";
ret_close:
close(fd);
if (result < 0) {