98: s.sin_addr.s_addr = htonl(INADDR_ANY);
99: s.sin_port = htons(DHCP_CLIENT_PORT);
100: re = so_bind(sd, (struct sockaddr*)&s, sizeof s);
146: }
147: p.eth.ether_type = htons(0x0800); // IPv4
148:
155:
156: p.udphdr.uh_sport = htons(DHCP_CLIENT_PORT);
157: p.udphdr.uh_dport = htons(DHCP_SERVER_PORT);
158:
169: time = (tim.lo - state->start_time.lo) / 1000;
170: p.dhcp.secs = htons(time > 65535 ? 65535 : time);
171: }
172: p.dhcp.flags = htons(BROADCAST_FLAG);
173: p.dhcp.yiaddr = state->yiaddr;
196: udp_len = sizeof p.udphdr + offsetof(struct dhcp_message, options) + state->option_length;
197: p.udphdr.uh_ulen = htons(udp_len);
198: sum = p.ip.ip_src.s_addr & 0xffffU;
201: sum += (p.ip.ip_dst.s_addr >> 16) & 0xffffU;
202: sum += htons(IPPROTO_UDP);
203: sum += htons(udp_len);
204: p.udphdr.uh_sum = checksum2((unsigned short*)&p.udphdr, udp_len, sum);
205:
206: p.ip.ip_len = htons(sizeof p.ip + udp_len);
207: p.ip.ip_sum = checksum((unsigned short*)&p.ip, sizeof p.ip);
327: sa.sin_addr.s_addr = INADDR_ANY;
328: sa.sin_port = htons(53);
329: re = so_resctl(SO_RES_DEL_SERVER, &sa, sizeof sa);
336: sa.sin_addr.s_addr = state->dns[i];
337: sa.sin_port = htons(53);
338: re = so_resctl(SO_RES_ADD_SERVER, &sa, sizeof sa);