Home | History | Annotate | Download | only in rump_dhcpclient

Lines Matching refs:ifp

60 get_hwaddr(struct interface *ifp)
67 strlcpy(iflr.iflr_name, ifp->name, sizeof(iflr.iflr_name));
84 memcpy(ifp->hwaddr, sdl->sdl_data+strlen(ifp->name), ETHER_ADDR_LEN);
85 ifp->hwlen = ETHER_ADDR_LEN;
86 ifp->family = ARPHRD_ETHER;
93 send_discover(struct interface *ifp)
102 mlen = make_message(&dhcp, ifp, DHCP_DISCOVER);
104 if (send_raw_packet(ifp, ETHERTYPE_IP, udp, ulen) == -1)
109 send_request(struct interface *ifp)
118 mlen = make_message(&dhcp, ifp, DHCP_REQUEST);
120 if (send_raw_packet(ifp, ETHERTYPE_IP, udp, ulen) == -1)
127 get_network(struct interface *ifp, uint8_t **rawp,
136 pfd.fd = ifp->raw_fd;
150 if ((n = get_raw_packet(ifp, ETHERTYPE_IP,
174 if (ifp->state->xid != dhcp->xid) {
187 get_offer(struct interface *ifp)
193 get_network(ifp, &raw, &dhcp);
205 ifp->state->offer = xzalloc(sizeof(*ifp->state->offer));
206 memcpy(ifp->state->offer, dhcp, sizeof(*ifp->state->offer));
207 ifp->state->lease.addr.s_addr = dhcp->yiaddr;
208 ifp->state->lease.cookie = dhcp->cookie;
213 get_ack(struct interface *ifp)
219 get_network(ifp, &raw, &dhcp);
224 ifp->state->new = ifp->state->offer;
225 get_lease(&ifp->state->lease, ifp->state->new);
231 struct interface *ifp;
245 if ((ifp = init_interface(argv[1])) == NULL)
247 ifaces = ifp;
248 if (open_socket(ifp, ETHERTYPE_IP) == -1)
250 up_interface(ifp);
252 ifp->state = xzalloc(sizeof(*ifp->state));
253 ifp->state->options = ifo = xzalloc(sizeof(*ifp->state->options));
254 ifp->state->xid = arc4random();
263 if (get_hwaddr(ifp) == -1)
264 err(EXIT_FAILURE, "failed to get hwaddr for %s", ifp->name);
266 send_discover(ifp);
267 get_offer(ifp);
268 send_request(ifp);
269 get_ack(ifp);
271 configure(ifp);