Commit c101f43a authored by Lorenzo Martinico's avatar Lorenzo Martinico

Match all interfaces

parent e8700da0
......@@ -26,10 +26,11 @@
#include <stdlib.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <unistd.h>
#include <sys/auxv.h>
#define ORIGINAL_CONF_PATH "/proc/sys/net/ipv6/conf/wlan0/accept_ra"
#define ORIGINAL_CONF_PATH "/proc/sys/net/ipv6/conf/*/accept_ra"
/* Standard O_TMPFILE includes O_DIRECTORY bit, but we do not want to call
* va_arg if O_DIRECTORY is set alone. Hence, define a "purer" O_TMPFILE. */
......@@ -64,7 +65,7 @@ static void init(void) {
int open(const char *__file, int __oflag, ...) {
if (!original_open)
init();
if (!strcmp(__file, ORIGINAL_CONF_PATH))
if (!fnmatch(ORIGINAL_CONF_PATH, __file, FNM_PATHNAME))
__file = "/dev/null";
if (__oflag & (O_CREAT | PURE_O_TMPFILE)) {
va_list ap;
......@@ -81,7 +82,7 @@ int open(const char *__file, int __oflag, ...) {
FILE *fopen(const char *path, const char *mode) {
if (!original_fopen)
init();
if (!strcmp(path, ORIGINAL_CONF_PATH))
if (!fnmatch(ORIGINAL_CONF_PATH, path, FNM_PATHNAME))
path = "/dev/null";
return (*original_fopen)(path, mode);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment