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"
20 #define IPRULE_PRIORITY_ADDR 80000
21 #define IPRULE_PRIORITY_NW 90000
24 /* address family for rule */
25 IPRULE_INET4 = (0 << 0),
26 IPRULE_INET6 = (1 << 0),
27 IPRULE_FAMILY = IPRULE_INET4 | IPRULE_INET6,
29 /* rule specifies input device */
32 /* rule specifies output device */
33 IPRULE_OUT = (1 << 3),
35 /* rule specifies src */
36 IPRULE_SRC = (1 << 4),
38 /* rule specifies dest */
39 IPRULE_DEST = (1 << 5),
41 /* rule specifies priority */
42 IPRULE_PRIORITY = (1 << 6),
44 /* rule specifies diffserv/tos */
45 IPRULE_TOS = (1 << 7),
47 /* rule specifies fwmark */
48 IPRULE_FWMARK = (1 << 8),
50 /* rule specifies fwmask */
51 IPRULE_FWMASK = (1 << 9),
53 /* rule performs table lookup */
54 IPRULE_LOOKUP = (1 << 10),
56 /* rule performs routing action */
57 IPRULE_ACTION = (1 << 11),
60 IPRULE_GOTO = (1 << 12),
64 struct vlist_node node;
67 /* everything below is used as avl tree key */
68 enum iprule_flags flags;
72 char in_dev[IFNAMSIZ + 1];
73 char out_dev[IFNAMSIZ + 1];
75 unsigned int src_mask;
76 union if_addr src_addr;
78 unsigned int dest_mask;
79 union if_addr dest_addr;
81 unsigned int priority;
92 extern struct vlist_tree iprules;
93 extern const struct config_param_list rule_attr_list;
95 void iprule_add(struct blob_attr *attr, bool v6);
96 void iprule_update_start(void);
97 void iprule_update_complete(void);