busybox-1.32.0/networking/udhcp/dhcpc.c
static void init_packet(struct dhcp_packet *packet, char type)
{
	unsigned secs;

	/* Fill in: op, htype, hlen, cookie fields; message type option: */
	udhcp_init_header(packet, type);

	packet->xid = random_xid();

	client_data.last_secs = monotonic_sec();
	if (client_data.first_secs == 0)
		client_data.first_secs = client_data.last_secs;
	secs = client_data.last_secs - client_data.first_secs;
	packet->secs = (secs < 0xffff) ? htons(secs) : 0xffff;

	memcpy(packet->chaddr, client_data.client_mac, 6);
	if (client_data.clientid)
		udhcp_add_binary_option(packet, client_data.clientid);
}
/* Initialize the packet with the proper defaults */
Initialize the packet with the proper defaults
Initialize the packet with the proper defaults
static void init_packet(struct dhcp_packet *packet, char type)
{
	unsigned secs;
	udhcp_init_header(packet, type);
	packet->xid = random_xid();
	client_data.last_secs = monotonic_sec();
	if (client_data.first_secs == 0)
		client_data.first_secs = client_data.last_secs;
	secs = client_data.last_secs - client_data.first_secs;
	packet->secs = (secs < 0xffff) ? htons(secs) : 0xffff;
	memcpy(packet->chaddr, client_data.client_mac, 6);
	if (client_data.clientid)
		udhcp_add_binary_option(packet, client_data.clientid);
}
static void init_packet ( struct dhcp_packet * packet , char type ) { unsigned secs ; udhcp_init_header ( packet , type ) ; packet -> xid = random_xid ( ) ; client_data . last_secs = monotonic_sec ( ) ; if ( client_data . first_secs == 0 ) client_data . first_secs = client_data . last_secs ; secs = client_data . last_secs - client_data . first_secs ; packet -> secs = ( secs < 0xffff ) ? htons ( secs ) : 0xffff ; memcpy ( packet -> chaddr , client_data . client_mac , 6 ) ; if ( client_data . clientid ) udhcp_add_binary_option ( packet , client_data . clientid ) ; }
Initialize the packet with the proper defaults
Initialize the packet with the proper defaults
/* Fill in: op, htype, hlen, cookie fields; message type option: */