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