befa2ccb331985e11f18c62d2726a8d1843fe1c7
2 * netifd - network interface daemon
3 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
17 #include <sys/socket.h>
23 #include <libubox/uloop.h>
24 #include <libubox/ustream.h>
25 #include <libubox/utils.h>
32 #define DEFAULT_MAIN_PATH "./dummy"
33 #define DEFAULT_HOTPLUG_PATH "./scripts/hotplug-cmd"
34 #define DEFAULT_RESOLV_CONF "./tmp/resolv.conf"
36 #define DEFAULT_MAIN_PATH "/lib/netifd"
37 #define DEFAULT_HOTPLUG_PATH "/sbin/hotplug-call"
38 #define DEFAULT_RESOLV_CONF "/tmp/resolv.conf.auto"
41 extern const char *resolv_conf
;
42 extern char *hotplug_cmd_path
;
43 extern unsigned int debug_mask
;
60 #define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__)
61 #define D(level, format, ...) do { \
62 if (debug_mask & (1 << (DEBUG_ ## level))) \
63 DPRINTF(format, ##__VA_ARGS__); \
66 #define DPRINTF(format, ...) no_debug(0, format, ## __VA_ARGS__)
67 #define D(level, format, ...) no_debug(DEBUG_ ## level, format, ## __VA_ARGS__)
70 #define LOG_BUF_SIZE 256
72 static inline void no_debug(int level
, const char *fmt
, ...)
76 struct netifd_process
{
77 struct list_head list
;
78 struct uloop_process uloop
;
79 void (*cb
)(struct netifd_process
*, int ret
);
82 struct ustream_fd log
;
83 const char *log_prefix
;
87 void netifd_log_message(int priority
, const char *format
, ...);
89 int netifd_start_process(const char **argv
, char **env
, struct netifd_process
*proc
);
90 void netifd_kill_process(struct netifd_process
*proc
);
95 extern const char *main_path
;
96 void netifd_restart(void);
97 void netifd_reload(void);