That means that if an interface ID is greater than *or equal to* the
number of Interface Description Blocks we've seen, we haven't seen an
IDB for that interface.
Rather than use a custom sed script to replace things in pcap-config,
use the already existing config.status script. This keeps people from
having to update the Makefile.in every time they want to add a new var
to the file.
Also, clean up the pcap-config.in script a bit to set local vars at the
top of the file and then refer to those rather than replacing all things
through out. This makes it easier to tweak on the fly as there is only
line to change rather than trying and figure out all the locations.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
While we're at it, don't special-case ENFILE for "delete monitor device"
operations; that's not like "add monitor device", where we want to drive
on if a device with that name already exists.
DLPI device but don't have permission to put the interface in
promiscuous mode; some systems using DLPI work that way.
Change the libdlpi code to return a warning if you *are* using
physical promiscuous mode and you fail to turn on SAP promiscuous mode,
not if you *aren't* using physical promiscuous mode and you fail to turn
on SAP promiscuous mode; that matches with the no-libdlpi code does, and
matches what the comment says.
Pull dlattachreq up into dl_doattach().
If the last record read in by a read() from a BPF device isn't a
multiple of the alignment value for BPF_WORDALIGN(), we could increment
bp past ep; handle that case.
While we're at it, properly set p->bp and p->cc in the case where we
break out of the loop due to a pcap_breakloop() call.
Use "link-layer header type" as the term for DLT_ values; it doesn't
necessarily correspond to the actual data link type of the device
(802.11 devices, for example, can supply Ethernet headers).
In the pcap_list_datalinks() man page, refer to the
pcap_datalink_val_to_name() man page, as the routines described there
can be used to print out names and descriptive text for the values
returned by pcap_list_datalinks().
In the pcap_set_datalink() man page, refer to the
pcap_datalink_name_to_val() man page, as pcap_datalink_name_to_val() can
be used to convert a name for a link-layer header type into a value to
be handed to pcap_set_datalink().
Update the change date on some man pages while we're at it.
Pull the documentation for pcap_freealldevs() into the
pcap_findalldevs() man page, and pull the documentation for
pcap_free_datalinks() into the pcap_list_datalinks() man page.
The RA field is absent from management frames (addr1 is DA there), and
addr1 in other frames.
The TA field is absent from management frames (addr2 is SA there), and
addr2, if present, in other frames.
While we're at it, fix a font glitch in the pcap-filter man page.
Do the standard userland filtering on USB and Bluetooth captures, rather
than returning "success" when the filter is installed without doing
anything with the filter.
Also, squelch some "dereferencing type-punned pointer will break
strict-aliasing rules" warnings in pcap-bt-linux.c, by using memcpy
rather than pointer-casting.
Don't ignore them, reject them, so applications know that non-blocking
mode didn't get turned on, if they're expecting non-blocking reads from
a pipe, for example.
bpf_open() already handles returning the right PCAP_ERROR_ value and
setting p->errbuf; let it do its thing.
Enhance its thing so that it tries to do a better job of figuring out
what the problem is (no BPF devices at all, all BPF devices busy, no
permission to open BPF device, something else).
Have pcap_can_set_rfmon() return PCAP_ERROR_PERM_DENIED if you don't
have permission to check the device and PCAP_ERROR_NO_SUCH_DEVICE if
there's no such device, at least on Mac OS X. Other platforms need to
be fixed as well.
Update the documentatation to reflect that it can return
PCAP_ERROR_PERM_DENIED, fix a typo, and speak of capture sources rather
than devices.
Update from Jason (Xin) Li to reflect changes to the FreeBSD
SIOCGIFDESCR implementation - it now doesn't return an error if the
buffer is too short, it sets the buffer pointer to NULL. No FreeBSD
release has SIOCGIFDESCR, so this doesn't break on any release.
The loop, trying to increase the buffer size until it's big enough,
works only on FreeBSD, as that's the only OS where you get told what
length to use; OpenBSD clamps the description length at IFDESCRSIZE, so
we just use that.
Both of them are indications that there's no such interface, so the file
probably corresponds to something other than a device.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
BPV_RVAL() is the macro to check the type of the return value of a "ret"
instruction; it tests more bits than are appropriate for a "div"
instruction, and the test fails.