FreeBSD Bugzilla – Attachment 145818 Details for
Bug 184003
On state creation src_node is looked up twice.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Version updated for latest changes in 183997.
lookup-src_nodes-only-once2.patch (text/plain), 2.13 KB, created by
Kajetan Staszkiewicz
on 2014-08-15 14:04:54 UTC
(
hide
)
Description:
Version updated for latest changes in 183997.
Filename:
MIME Type:
Creator:
Kajetan Staszkiewicz
Created:
2014-08-15 14:04:54 UTC
Size:
2.13 KB
patch
obsolete
>diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c >index 256204e..f5daacb 100644 >--- a/sys/netpfil/pf/pf.c >+++ b/sys/netpfil/pf/pf.c >@@ -3521,8 +3521,6 @@ pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, > } > > if (r->rt && r->rt != PF_FASTROUTE) { >- struct pf_src_node *sn = NULL; >- > if (pf_map_addr(pd->af, r, pd->src, &s->rt_addr, NULL, &sn)) { > REASON_SET(&reason, PFRES_MAPFAILED); > pf_src_tree_remove_state(s); >diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c >index c93fbfd..be688d4 100644 >--- a/sys/netpfil/pf/pf_lb.c >+++ b/sys/netpfil/pf/pf_lb.c >@@ -307,22 +307,31 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, > struct pf_pool *rpool = &r->rpool; > struct pf_addr *raddr = NULL, *rmask = NULL; > >+ /* Try to find a src_node if none was given and this >+ is a sticky-address rule. */ > if (*sn == NULL && r->rpool.opts & PF_POOL_STICKYADDR && > (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) { > *sn = pf_find_src_node(saddr, r, af, 0); >- if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) { >- PF_ACPY(naddr, &(*sn)->raddr, af); >- if (V_pf_status.debug >= PF_DEBUG_MISC) { >- printf("pf_map_addr: src tracking maps "); >- pf_print_host(saddr, 0, af); >- printf(" to "); >- pf_print_host(naddr, 0, af); >- printf("\n"); >- } >- return (0); >+ } >+ >+ /* If a src_node was found or explicitly given and it has a non-zero >+ route address, use this address. A zeroed address is found if the >+ src node was created just a moment ago in pf_create_state and it >+ needs to be filled in with routing decission calculated here. */ >+ if (*sn != NULL && !PF_AZERO(&(*sn)->raddr, af)) { >+ PF_ACPY(naddr, &(*sn)->raddr, af); >+ if (V_pf_status.debug >= PF_DEBUG_MISC) { >+ printf("pf_map_addr: src tracking maps "); >+ pf_print_host(saddr, 0, af); >+ printf(" to "); >+ pf_print_host(naddr, 0, af); >+ printf("\n"); > } >+ return (0); > } > >+ /* Find the route using chosen algorithm. Store the found route >+ in src_node if it was given or found. */ > if (rpool->cur->addr.type == PF_ADDR_NOROUTE) > return (1); > if (rpool->cur->addr.type == PF_ADDR_DYNIFTL) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 184003
:
138144
| 145818