0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Strange, on atrey ioctl() does not fill structure, and bird segfaults

on it. Now we "only" die().
This commit is contained in:
Pavel Machek 1998-10-13 14:59:46 +00:00
parent 21580e304f
commit fdf33cde1c

View File

@ -140,7 +140,7 @@ scan_if(timer *t)
ic.ifc_ifcu.ifcu_req = r; ic.ifc_ifcu.ifcu_req = r;
ic.ifc_len = last_ifbuf_size; ic.ifc_len = last_ifbuf_size;
res = ioctl(if_scan_sock, SIOCGIFCONF, &ic); res = ioctl(if_scan_sock, SIOCGIFCONF, &ic);
if (res < 0 && errno != EFAULT) if (res < 0 && errno != EFAULT) /* FIXME: I would sigsegv you if I were kernel at this point */
die("SIOCCGIFCONF: %m"); die("SIOCCGIFCONF: %m");
if (res < last_ifbuf_size) if (res < last_ifbuf_size)
{ {
@ -149,8 +149,11 @@ scan_if(timer *t)
} }
} }
ic.ifc_ifcu.ifcu_req = NULL; ic.ifc_ifcu.ifcu_req = NULL;
ic.ifc_len = 999999999;
if (ioctl(if_scan_sock, SIOCGIFCONF, &ic) < 0) if (ioctl(if_scan_sock, SIOCGIFCONF, &ic) < 0)
die("SIOCIFCONF: %m"); die("SIOCIFCONF: %m");
if (ic.ifc_len > 100*1024)
die("Buf size MUCH too big: %d\n", ic.ifc_len);
ic.ifc_len += sizeof(struct ifreq); ic.ifc_len += sizeof(struct ifreq);
if (last_ifbuf_size < ic.ifc_len) if (last_ifbuf_size < ic.ifc_len)
{ {