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;
63 /* everything below is used as avl tree key */
64 enum iprule_flags flags;
68 char in_dev[IFNAMSIZ + 1];
69 char out_dev[IFNAMSIZ + 1];
71 unsigned int src_mask;
72 union if_addr src_addr;
74 unsigned int dest_mask;
75 union if_addr dest_addr;
77 unsigned int priority;
88 extern struct vlist_tree iprules;
89 extern const struct config_param_list rule_attr_list;
91 void iprule_add(struct blob_attr *attr, bool v6);
92 void iprule_update_start(void);
93 void iprule_update_complete(void);