/* If we don't find it, attempt to add an entry for it, with the specified flags and description, and, if that succeeds, return 0, otherwise return -1 and set errbuf to an error message.  */
pcap_if_t* find_or_add_dev(pcap_if_list_t *devlistp, const char *name, bpf_u_int32 flags, get_if_flags_func get_flags_func, const char *description, char *errbuf)
/* If we don't find it, attempt to add an entry for it, with the specified flags and description, and, if that succeeds, return 0, otherwise return -1 and set errbuf to an error message.  */
pcap_if_t* find_or_add_dev(pcap_if_list_t *devlistp, const char *name, bpf_u_int32 flags, get_if_flags_func get_flags_func, const char *description, char *errbuf)
{
	pcap_if_t *curdev;
	curdev = find_dev(devlistp, name);
	if (curdev != NULL) {
		return (curdev);
	}
	if ((*get_flags_func)(name, &flags, errbuf) == -1) {
		return (NULL);
	}
	return (add_dev(devlistp, name, flags, description, errbuf));
}