mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-17 06:50:37 +08:00
Update to FreeBSD stable/12 2020-02-10
Git mirror commit 0d1c391321b34b3025cf0e72f2231d836ff76da8.
This commit is contained in:
@@ -125,10 +125,6 @@ The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* HAVE_CAP_NG_H */
|
||||
#endif /* HAVE_LIBCAP_NG */
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/sysctl.h>
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#include "netdissect.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@@ -652,11 +648,10 @@ droproot(const char *username, const char *chroot_dir)
|
||||
#ifdef HAVE_LIBCAP_NG
|
||||
{
|
||||
int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "error : ret %d\n", ret);
|
||||
} else {
|
||||
if (ret < 0)
|
||||
error("capng_change_id(): return %d\n", ret);
|
||||
else
|
||||
fprintf(stderr, "dropped privs to %s\n", username);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifndef __rtems__
|
||||
@@ -747,13 +742,15 @@ static char *
|
||||
get_next_file(FILE *VFile, char *ptr)
|
||||
{
|
||||
char *ret;
|
||||
size_t len;
|
||||
|
||||
ret = fgets(ptr, PATH_MAX, VFile);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
if (ptr[strlen(ptr) - 1] == '\n')
|
||||
ptr[strlen(ptr) - 1] = '\0';
|
||||
len = strlen (ptr);
|
||||
if (len > 0 && ptr[len - 1] == '\n')
|
||||
ptr[len - 1] = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1099,6 +1096,10 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
|
||||
if (status < 0)
|
||||
error("%s: Can't set time stamp type: %s",
|
||||
device, pcap_statustostr(status));
|
||||
else if (status > 0)
|
||||
warning("When trying to set timestamp type '%s' on %s: %s",
|
||||
pcap_tstamp_type_val_to_name(jflag), device,
|
||||
pcap_statustostr(status));
|
||||
}
|
||||
#endif
|
||||
status = pcap_activate(pc);
|
||||
@@ -1120,30 +1121,6 @@ open_interface(const char *device, netdissect_options *ndo, char *ebuf)
|
||||
} else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0')
|
||||
error("%s: %s\n(%s)", device,
|
||||
pcap_statustostr(status), cp);
|
||||
#ifdef __FreeBSD__
|
||||
else if (status == PCAP_ERROR_RFMON_NOTSUP &&
|
||||
strncmp(device, "wlan", 4) == 0) {
|
||||
char parent[8], newdev[8];
|
||||
char sysctl[32];
|
||||
size_t s = sizeof(parent);
|
||||
|
||||
snprintf(sysctl, sizeof(sysctl),
|
||||
"net.wlan.%d.%%parent", atoi(device + 4));
|
||||
sysctlbyname(sysctl, parent, &s, NULL, 0);
|
||||
strlcpy(newdev, device, sizeof(newdev));
|
||||
/* Suggest a new wlan device. */
|
||||
/* FIXME: incrementing the index this way is not going to work well
|
||||
* when the index is 9 or greater but the only consequence in this
|
||||
* specific case would be an error message that looks a bit odd.
|
||||
*/
|
||||
newdev[strlen(newdev)-1]++;
|
||||
error("%s is not a monitor mode VAP\n"
|
||||
"To create a new monitor mode VAP use:\n"
|
||||
" ifconfig %s create wlandev %s wlanmode monitor\n"
|
||||
"and use %s as the tcpdump interface",
|
||||
device, newdev, parent, newdev);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
error("%s: %s", device,
|
||||
pcap_statustostr(status));
|
||||
|
Reference in New Issue
Block a user