1 /* 2 * netifd - network interface daemon 3 * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org> 4 * Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org> 5 * 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 9 * 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. 14 */ 15 #ifndef __IPRULE_H 16 #define __IPRULE_H 17 18 #include "interface-ip.h" 19 20 #define IPRULE_PRIORITY_ADDR 10000 21 #define IPRULE_PRIORITY_ADDR_MASK 20000 22 #define IPRULE_PRIORITY_NW 90000 23 #define IPRULE_PRIORITY_REJECT 4200000000 24 25 enum iprule_flags { 26 /* address family for rule */ 27 IPRULE_INET4 = (0 << 0), 28 IPRULE_INET6 = (1 << 0), 29 IPRULE_FAMILY = IPRULE_INET4 | IPRULE_INET6, 30 31 /* rule specifies input device */ 32 IPRULE_IN = (1 << 2), 33 34 /* rule specifies output device */ 35 IPRULE_OUT = (1 << 3), 36 37 /* rule specifies src */ 38 IPRULE_SRC = (1 << 4), 39 40 /* rule specifies dest */ 41 IPRULE_DEST = (1 << 5), 42 43 /* rule specifies priority */ 44 IPRULE_PRIORITY = (1 << 6), 45 46 /* rule specifies diffserv/tos */ 47 IPRULE_TOS = (1 << 7), 48 49 /* rule specifies fwmark */ 50 IPRULE_FWMARK = (1 << 8), 51 52 /* rule specifies fwmask */ 53 IPRULE_FWMASK = (1 << 9), 54 55 /* rule performs table lookup */ 56 IPRULE_LOOKUP = (1 << 10), 57 58 /* rule performs routing action */ 59 IPRULE_ACTION = (1 << 11), 60 61 /* rule is a goto */ 62 IPRULE_GOTO = (1 << 12), 63 64 /* rule suppresses results by prefix length */ 65 IPRULE_SUP_PREFIXLEN = (1 << 13), 66 67 /* rule specifies uidrange */ 68 IPRULE_UIDRANGE = (1 << 14), 69 70 /* rule specifies ipproto */ 71 IPRULE_IPPROTO = (1 << 15), 72 73 /* rule specifies sport */ 74 IPRULE_SPORT = (1 << 16), 75 76 /* rule specifies dport */ 77 IPRULE_DPORT = (1 << 17), 78 }; 79 80 struct iprule { 81 struct vlist_node node; 82 unsigned int order; 83 84 /* to receive interface events */ 85 struct interface_user in_iface_user; 86 struct interface_user out_iface_user; 87 88 /* device name */ 89 char in_dev[IFNAMSIZ]; 90 char out_dev[IFNAMSIZ]; 91 92 /* everything below is used as avl tree key */ 93 /* don't change the order */ 94 95 /* uci interface name */ 96 char *in_iface; 97 char *out_iface; 98 99 enum iprule_flags flags; 100 101 bool invert; 102 103 unsigned int src_mask; 104 union if_addr src_addr; 105 106 unsigned int dest_mask; 107 union if_addr dest_addr; 108 109 unsigned int priority; 110 unsigned int tos; 111 112 unsigned int fwmark; 113 unsigned int fwmask; 114 115 unsigned int lookup; 116 unsigned int sup_prefixlen; 117 unsigned int uidrange_start; 118 unsigned int uidrange_end; 119 unsigned int action; 120 unsigned int gotoid; 121 unsigned int ipproto; 122 unsigned int sport_start; 123 unsigned int sport_end; 124 unsigned int dport_start; 125 unsigned int dport_end; 126 }; 127 128 extern struct vlist_tree iprules; 129 extern const struct uci_blob_param_list rule_attr_list; 130 131 void iprule_add(struct blob_attr *attr, bool v6); 132 void iprule_update_start(void); 133 void iprule_update_complete(void); 134 135 #endif 136
This page was automatically generated by LXR 0.3.1. • OpenWrt