summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorPierre Lebleu <pme.lebleu@gmail.com>2017-05-04 10:52:52 +0200
committerJo-Philipp Wich <jo@mein.io>2017-05-09 23:54:15 +0200
commite264c8e585ea37ccb1739e7a8e12f8454da1d8a4 (patch)
tree3a5e80cd9dde172ae53ae0dd58916daebfcd790d /utils.h
parent6039c7f4b0052c4da21520cdd604f04a5a67f50d (diff)
downloadfirewall3-e264c8e585ea37ccb1739e7a8e12f8454da1d8a4.tar.gz
firewall3: replace warn_rule() by warn_section()
Replace the wan_rule() by warn_section() in order to make it reusable by the other section type. Signed-off-by: Pierre Lebleu <pme.lebleu@gmail.com>
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index c74a5dd..98e1eec 100644
--- a/utils.h
+++ b/utils.h
@@ -46,6 +46,16 @@ void warn(const char *format, ...);
void error(const char *format, ...);
void info(const char *format, ...);
+
+#define warn_section(t, r, e, fmt, ...) \
+ do { \
+ if (e) \
+ warn_elem(e, fmt, ##__VA_ARGS__); \
+ else \
+ warn("Warning: ubus " t " (%s) " fmt, \
+ (r && r->name) ? r->name : "?", ##__VA_ARGS__); \
+ } while(0)
+
#define fw3_setbit(field, flag) field |= (1 << (flag))
#define fw3_delbit(field, flag) field &= ~(1 << (flag))
#define fw3_hasbit(field, flag) (field & (1 << (flag)))