Home | History | Annotate | Download | only in libnetutils

Lines Matching refs:info

131 static int ifc_configure(const char *ifname, dhcp_info *info)
135 if (ifc_set_addr(ifname, info->ipaddr)) {
136 printerr("failed to set ipaddr %s: %s\n", ipaddr(info->ipaddr), strerror(errno));
139 if (ifc_set_mask(ifname, info->netmask)) {
140 printerr("failed to set netmask %s: %s\n", ipaddr(info->netmask), strerror(errno));
143 if (ifc_create_default_route(ifname, info->gateway)) {
144 printerr("failed to set default route %s: %s\n", ipaddr(info->gateway), strerror(errno));
149 property_set(dns_prop_name, info->dns1 ? ipaddr(info->dns1) : "");
151 property_set(dns_prop_name, info->dns2 ? ipaddr(info->dns2) : "");
153 last_good_info = *info;
173 void dump_dhcp_info(dhcp_info *info)
177 dhcp_type_to_name(info->type), info->type);
178 strcpy(addr, ipaddr(info->ipaddr));
179 strcpy(gway, ipaddr(info->gateway));
180 strcpy(mask, ipaddr(info->netmask));
182 if (info->dns1) LOGD("dns1: %s", ipaddr(info->dns1));
183 if (info->dns2) LOGD("dns2: %s", ipaddr(info->dns2));
185 ipaddr(info->serveraddr), info->lease);
189 int decode_dhcp_msg(dhcp_msg *msg, int len, dhcp_info *info)
195 memset(info, 0, sizeof(dhcp_info));
223 if (optlen >= 4) memcpy(&info->netmask, x, 4);
226 if (optlen >= 4) memcpy(&info->gateway, x, 4);
229 if (optlen >= 4) memcpy(&info->dns1, x + 0, 4);
230 if (optlen >= 8) memcpy(&info->dns2, x + 4, 4);
234 memcpy(&info->lease, x, 4);
235 info->lease = ntohl(info->lease);
239 if (optlen >= 4) memcpy(&info->serveraddr, x, 4);
242 info->type = *x;
251 info->ipaddr = msg->yiaddr;
412 dhcp_info info;
435 info.type = 0;
450 if ( info.type == DHCPOFFER ) {
452 return ifc_configure(ifname, &info);
470 size = init_dhcp_request_msg(msg, hwaddr, xid, info.ipaddr, info.serveraddr);
506 decode_dhcp_msg(&reply, r, &info);
518 if (verbose) dump_dhcp_info(&info);
522 if (info.type == DHCPOFFER) {
530 if (info.type == DHCPACK) {
533 return ifc_configure(ifname, &info);
534 } else if (info.type == DHCPNAK) {
540 dhcp_type_to_name(info.type), state);