2 * netifd - network interface daemon
3 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
18 #include "interface-ip.h"
21 /* address family for rule */
22 IPRULE_INET4
= (0 << 0),
23 IPRULE_INET6
= (1 << 0),
24 IPRULE_FAMILY
= IPRULE_INET4
| IPRULE_INET6
,
26 /* rule specifies input device */
29 /* rule specifies output device */
30 IPRULE_OUT
= (1 << 3),
32 /* rule specifies src */
33 IPRULE_SRC
= (1 << 4),
35 /* rule specifies dest */
36 IPRULE_DEST
= (1 << 5),
38 /* rule specifies priority */
39 IPRULE_PRIORITY
= (1 << 6),
41 /* rule specifies diffserv/tos */
42 IPRULE_TOS
= (1 << 7),
44 /* rule specifies fwmark */
45 IPRULE_FWMARK
= (1 << 8),
47 /* rule specifies fwmask */
48 IPRULE_FWMASK
= (1 << 9),
50 /* rule performs table lookup */
51 IPRULE_LOOKUP
= (1 << 10),
53 /* rule performs routing action */
54 IPRULE_ACTION
= (1 << 11),
57 IPRULE_GOTO
= (1 << 12),
61 struct vlist_node node
;
64 /* everything below is used as avl tree key */
65 enum iprule_flags flags
;
69 char in_dev
[IFNAMSIZ
+ 1];
70 char out_dev
[IFNAMSIZ
+ 1];
72 unsigned int src_mask
;
73 union if_addr src_addr
;
75 unsigned int dest_mask
;
76 union if_addr dest_addr
;
78 unsigned int priority
;
89 extern struct vlist_tree iprules
;
90 extern const struct config_param_list rule_attr_list
;
92 void iprule_add(struct blob_attr
*attr
, bool v6
);
93 void iprule_update_start(void);
94 void iprule_update_complete(void);