- if ((needed = getkerninfo(op, 0, 0, RTF_LLINFO)) < 0)
- quit("route-getkerninfo-estimate");
- if ((buf = malloc(needed)) == NULL)
- quit("malloc");
- if ((rlen = getkerninfo(op, buf, &needed, RTF_LLINFO)) < 0)
- quit("actual retrieval of routing table");
- lim = buf + rlen;
- for (next = buf; next < lim; next += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)next;
- sin = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl *)(sin + 1);
- if (addr) {
- if (addr != sin->sin_addr.s_addr)
- continue;
- found_entry = 1;
- }