Révision ab686552
Ajouté par Ermal il y a presque 10 ans
patches/stable/10/CP_speedup.diff | ||
---|---|---|
767 | 767 |
{ |
768 | 768 |
ipfw_xtable *tbl; |
769 | 769 |
diff --git a/sys/netpfil/ipfw/ip_fw_table.c b/sys/netpfil/ipfw/ip_fw_table.c |
770 |
index 95cff5c..5c00420 100644
|
|
770 |
index 95cff5c..c1cf6f4 100644
|
|
771 | 771 |
--- a/sys/netpfil/ipfw/ip_fw_table.c |
772 | 772 |
+++ b/sys/netpfil/ipfw/ip_fw_table.c |
773 | 773 |
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); |
... | ... | |
936 | 936 |
default: |
937 | 937 |
return (EINVAL); |
938 | 938 |
} |
939 |
@@ -281,6 +369,19 @@ ipfw_add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
939 |
@@ -281,6 +369,28 @@ ipfw_add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
940 | 940 |
IPFW_WUNLOCK(ch); |
941 | 941 |
|
942 | 942 |
if (rn == NULL) { |
943 | 943 |
+ if (type == IPFW_TABLE_CIDR) { |
944 | 944 |
+ /* Just update if any new value needed */ |
945 |
+ struct table_entry *ent2; |
|
946 |
+ |
|
947 |
+ ent2 = (struct table_entry *)(rnh->rnh_lookup(&ent->addr, NULL, rnh)); |
|
948 |
+ if (ent2 != NULL) { |
|
949 |
+ if (ent2->mac_addr) { |
|
950 |
+ if (!bcmp(&mac_addr, &ent2->mac_addr, ETHER_ADDR_LEN)) |
|
951 |
+ ent2->value = value; |
|
952 |
+ } else |
|
953 |
+ ent2->value = value; |
|
945 |
+ if (plen == sizeof(in_addr_t)) { |
|
946 |
+ ent = (struct table_entry *)(rnh->rnh_lookup(addr_ptr, NULL, rnh)); |
|
947 |
+ if (ent != NULL) { |
|
948 |
+ if (ent->mac_addr) { |
|
949 |
+ if (!bcmp(&mac_addr, &ent->mac_addr, ETHER_ADDR_LEN)) |
|
950 |
+ ent->value = value; |
|
951 |
+ } else |
|
952 |
+ ent->value = value; |
|
953 |
+ } |
|
954 |
+ } else { |
|
955 |
+ xent = (struct table_xentry *)(rnh->rnh_lookup(addr_ptr, NULL, rnh)); |
|
956 |
+ if (xent != NULL) { |
|
957 |
+ if (xent->mac_addr) { |
|
958 |
+ if (!bcmp(&mac_addr, &xent->mac_addr, ETHER_ADDR_LEN)) |
|
959 |
+ xent->value = value; |
|
960 |
+ } else |
|
961 |
+ xent->value = value; |
|
962 |
+ } |
|
954 | 963 |
+ } |
955 | 964 |
+ } |
956 | 965 |
free(ent_ptr, M_IPFW_TBL); |
957 | 966 |
return (EEXIST); |
958 | 967 |
} |
959 |
@@ -367,6 +468,41 @@ ipfw_del_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
968 |
@@ -367,6 +477,41 @@ ipfw_del_table_entry(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
960 | 969 |
|
961 | 970 |
break; |
962 | 971 |
|
... | ... | |
998 | 1007 |
default: |
999 | 1008 |
return (EINVAL); |
1000 | 1009 |
} |
1001 |
@@ -552,9 +688,199 @@ ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
|
|
1010 |
@@ -552,9 +697,199 @@ ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
|
|
1002 | 1011 |
return (0); |
1003 | 1012 |
} |
1004 | 1013 |
|
... | ... | |
1199 | 1208 |
{ |
1200 | 1209 |
struct radix_node_head *rnh; |
1201 | 1210 |
struct table_xentry *xent; |
1202 |
@@ -562,15 +888,21 @@ ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
1211 |
@@ -562,15 +897,21 @@ ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
1203 | 1212 |
struct xaddr_iface iface; |
1204 | 1213 |
|
1205 | 1214 |
if (tbl >= V_fw_tables_max) |
... | ... | |
1223 | 1232 |
break; |
1224 | 1233 |
|
1225 | 1234 |
case IPFW_TABLE_INTERFACE: |
1226 |
@@ -581,15 +913,37 @@ ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
1235 |
@@ -581,15 +922,37 @@ ipfw_lookup_table_extended(struct ip_fw_chain *ch, uint16_t tbl, void *paddr,
|
|
1227 | 1236 |
xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); |
1228 | 1237 |
break; |
1229 | 1238 |
|
... | ... | |
1264 | 1273 |
} |
1265 | 1274 |
|
1266 | 1275 |
static int |
1267 |
@@ -697,7 +1051,12 @@ dump_table_xentry_base(struct radix_node *rn, void *arg)
|
|
1276 |
@@ -697,7 +1060,12 @@ dump_table_xentry_base(struct radix_node *rn, void *arg)
|
|
1268 | 1277 |
xent->masklen = 33 - ffs(ntohl(n->mask.sin_addr.s_addr)); |
1269 | 1278 |
/* Save IPv4 address as deprecated IPv6 compatible */ |
1270 | 1279 |
xent->k.addr6.s6_addr32[3] = n->addr.sin_addr.s_addr; |
... | ... | |
1277 | 1286 |
tbl->cnt++; |
1278 | 1287 |
return (0); |
1279 | 1288 |
} |
1280 |
@@ -735,12 +1094,31 @@ dump_table_xentry_extended(struct radix_node *rn, void *arg)
|
|
1289 |
@@ -735,12 +1103,31 @@ dump_table_xentry_extended(struct radix_node *rn, void *arg)
|
|
1281 | 1290 |
memcpy(&xent->k, &n->a.iface.ifname, IF_NAMESIZE); |
1282 | 1291 |
break; |
1283 | 1292 |
|
Formats disponibles : Unified diff
Properly update value for v6 and v4