Set ping_group_range so ping works

pull/2/head
Graham Mainwaring 2 years ago
parent aa346fd058
commit 1adc7e5a2a
No known key found for this signature in database
GPG Key ID: B9D24092C28D37B5

@ -14,6 +14,7 @@
#include <errno.h>
#include <string.h>
#include <stdbool.h>
#include <fcntl.h>
#include "namespace.h"
@ -108,6 +109,16 @@ int main(int argc, char *argv[])
return EXIT_OTHER_ERROR;
// allow non-root user to use the ping command
int fd = open("/proc/sys/net/ipv4/ping_group_range", O_WRONLY);
if (fd == -1) {
fprintf(stderr, "Error setting ping_group_range: %s\n", strerror(errno));
usage(argv0, true);
}
dprintf(fd, "0 2147483647\n");
close(fd);
drop_root_privileges();

Loading…
Cancel
Save