install-exec-hook:
if BUILD_FOR_LINUX
-# NQPTP runs as user/group nqptp/nqptp on Linux and uses setcap to access ports 319 and 320
- setcap 'cap_net_bind_service=+ep' $(bindir)/nqptp
+# Note: NQPTP runs as user/group nqptp/nqptp on Linux.
+# Access is given via AmbientCapabilities in the service file.
+# If you want to run it from the command line, e.g. for debugging, run it as root user.
# no installer for System V
if INSTALL_SYSTEMD_STARTUP
getent group nqptp &>/dev/null || groupadd -r nqptp &>/dev/null
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
-AC_INIT([nqptp], [1.2.4d0], [4265913+mikebrady@users.noreply.github.com])
+AC_INIT([nqptp], [1.2.5-dev], [4265913+mikebrady@users.noreply.github.com])
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
}
freeaddrinfo(info);
if (sockets_opened == 0) {
- if (port < 1024)
- die("unable to listen on port %d. The error is: \"%s\". NQPTP must run as root to access "
- "this port. Or is another PTP daemon -- possibly another instance on NQPTP -- running "
- "already?",
- port, strerror(errno));
- else
- die("unable to listen on port %d. The error is: \"%s\". "
- "Is another instance on NQPTP running already?",
- port, strerror(errno));
+ if (errno == EACCES) {
+ die("nqptp does not have permission to access port %u. It must (a) [Linux only] have been given CAP_NET_BIND_SERVICE capabilities using e.g. setcap or systemd's AmbientCapabilities, or (b) run as root.", port);
+ } else {
+ die("nqptp is unable to listen on port %u. The error is: %d, \"%s\".", port, errno, strerror(errno));
+ }
}
}
mode_t oldumask = umask(0);
shm_fd = shm_open(NQPTP_INTERFACE_NAME, O_RDWR | O_CREAT, 0644);
if (shm_fd == -1) {
- die("cannot open shared memory \"%s\".", NQPTP_INTERFACE_NAME);
+ die("nqptp cannot open the shared memory \"%s\" for writing. Is another copy of nqptp (e.g. an nqptp daemon) running already?", NQPTP_INTERFACE_NAME);
}
(void)umask(oldumask);