FreeBSD Bugzilla – Attachment 196324 Details for
Bug 208566
Ipnat (10.1-10.2) does not work properly after 1-2 days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to resolve this PR.
ip_nat.c.diff (text/plain), 5.52 KB, created by
Cy Schubert
on 2018-08-18 17:21:21 UTC
(
hide
)
Description:
Patch to resolve this PR.
Filename:
MIME Type:
Creator:
Cy Schubert
Created:
2018-08-18 17:21:21 UTC
Size:
5.52 KB
patch
obsolete
>Index: sys/contrib/ipfilter/netinet/ip_nat.c >=================================================================== >--- sys/contrib/ipfilter/netinet/ip_nat.c (revision 337991) >+++ sys/contrib/ipfilter/netinet/ip_nat.c (working copy) >@@ -2304,7 +2304,8 @@ > > bkt = nat->nat_hv[0] % softn->ipf_nat_table_sz; > nss = &softn->ipf_nat_stats.ns_side[0]; >- nss->ns_bucketlen[bkt]--; >+ if (nss->ns_bucketlen[bkt] > 0) >+ nss->ns_bucketlen[bkt]--; > if (nss->ns_bucketlen[bkt] == 0) { > nss->ns_inuse--; > } >@@ -2311,7 +2312,8 @@ > > bkt = nat->nat_hv[1] % softn->ipf_nat_table_sz; > nss = &softn->ipf_nat_stats.ns_side[1]; >- nss->ns_bucketlen[bkt]--; >+ if (nss->ns_bucketlen[bkt] > 0) >+ nss->ns_bucketlen[bkt]--; > if (nss->ns_bucketlen[bkt] == 0) { > nss->ns_inuse--; > } >@@ -2676,6 +2678,7 @@ > if ((np->in_nsrcmsk == 0xffffffff) && (np->in_spnext == 0)) { > if (l > 0) { > NBUMPSIDEX(1, ns_exhausted, ns_exhausted_1); >+ DT4(ns_exhausted_1, fr_info_t *, fin, nat_t *, nat, natinfo_t *, ni, ipnat_t *, np); > return -1; > } > } >@@ -2693,6 +2696,7 @@ > if ((l >= np->in_ppip) || ((l > 0) && > !(flags & IPN_TCPUDP))) { > NBUMPSIDEX(1, ns_exhausted, ns_exhausted_2); >+ DT4(ns_exhausted_2, fr_info_t *, fin, nat_t *, nat, natinfo_t *, ni, ipnat_t *, np); > return -1; > } > /* >@@ -2728,6 +2732,7 @@ > ipf_ifpaddr(softc, 4, FRI_NORMAL, fin->fin_ifp, > &in6, NULL) == -1) { > NBUMPSIDEX(1, ns_new_ifpaddr, ns_new_ifpaddr_1); >+ DT4(ns_new_ifpaddr_1, fr_info_t *, fin, nat_t *, nat, natinfo_t *, ni, ipnat_t *, np); > return -1; > } > in.s_addr = ntohl(in6.in4.s_addr); >@@ -2738,6 +2743,7 @@ > */ > if (l > 0) { > NBUMPSIDEX(1, ns_exhausted, ns_exhausted_3); >+ DT4(ns_exhausted_3, fr_info_t *, fin, nat_t *, nat, natinfo_t *, ni, ipnat_t *, np); > return -1; > } > in.s_addr = ntohl(fin->fin_saddr); >@@ -2833,6 +2839,7 @@ > (np->in_spnext != 0) && (st_port == np->in_spnext) && > (np->in_snip != 0) && (st_ip == np->in_snip)) { > NBUMPSIDED(1, ns_wrap); >+ DT4(ns_wrap, fr_info_t *, fin, nat_t *, nat, natinfo_t *, ni, ipnat_t *, np); > return -1; > } > l++; >@@ -2968,6 +2975,7 @@ > if (ipf_ifpaddr(softc, 4, FRI_NORMAL, fin->fin_ifp, > &in6, NULL) == -1) { > NBUMPSIDEX(0, ns_new_ifpaddr, ns_new_ifpaddr_2); >+ DT3(ns_new_ifpaddr_2, fr_info_t *, fin, nat_t *, nat, natinfo_t, ni); > return -1; > } > in.s_addr = ntohl(in6.in4.s_addr); >@@ -3114,6 +3122,7 @@ > > if (nsp->ns_active >= softn->ipf_nat_table_max) { > NBUMPSIDED(fin->fin_out, ns_table_max); >+ DT2(ns_table_max, nat_stat_t *, nsp, ipf_nat_softc_t *, softn); > return NULL; > } > >@@ -3128,6 +3137,7 @@ > /* Give me a new nat */ > KMALLOC(nat, nat_t *); > if (nat == NULL) { >+ DT(ns_memfail); > NBUMPSIDED(fin->fin_out, ns_memfail); > /* > * Try to automatically tune the max # of entries in the >@@ -3223,6 +3233,7 @@ > if ((np->in_apr != NULL) && ((nat->nat_flags & NAT_SLAVE) == 0)) { > if (ipf_proxy_new(fin, nat) == -1) { > NBUMPSIDED(fin->fin_out, ns_appr_fail); >+ DT3(ns_appr_fail, fr_info_t *, fin, nat_t *, nat, ipnat_t *, np); > goto badnat; > } > } >@@ -3259,7 +3270,7 @@ > > goto done; > badnat: >- DT2(ns_badnatnew, fr_info_t *, fin, nat_t *, nat); >+ DT3(ns_badnatnew, fr_info_t *, fin, nat_t *, nat, ipnat_t *, np); > NBUMPSIDE(fin->fin_out, ns_badnatnew); > if ((hm = nat->nat_hm) != NULL) > ipf_nat_hostmapdel(softc, &hm); >@@ -3380,6 +3391,7 @@ > } > > NBUMPSIDED(fin->fin_out, ns_unfinalised); >+ DT2(ns_unfinalised, fr_info_t *, fin, nat_t *, nat); > /* > * nat_insert failed, so cleanup time... > */ >@@ -7065,6 +7077,7 @@ > do { > changed = -1; > /* TRACE (l, src_search, dst_search, np) */ >+ DT4(ipf_nat_rewrite_1, int, l, int, src_search, int, dst_search, ipnat_t *, np); > > if ((src_search == 0) && (np->in_spnext == 0) && > (dst_search == 0) && (np->in_dpnext == 0)) { >@@ -7129,6 +7142,7 @@ > * Find a new destination address > */ > /* TRACE (fin, np, l, frnat) */ >+ DT4(ipf_nat_rewrite_2, frinfo_t *, fin, ipnat_t *, np, int, l, frinfo_t *, &frnat); > > if (ipf_nat_nextaddr(fin, &np->in_ndst, &frnat.fin_daddr, > &frnat.fin_daddr) == -1) >@@ -7179,6 +7193,7 @@ > } > > /* TRACE (frnat) */ >+ DT1(ipf_nat_rewrite_3, frinfo_t *, &frnat); > > /* > * Here we do a lookup of the connection as seen from >@@ -7218,6 +7233,7 @@ > } > > /* TRACE natl, in_stepnext, l */ >+ DT3(ipf_nat_rewrite_2, nat_t *, natl, ipnat_t *, np , int, l); > > if ((natl != NULL) && (l > 8)) /* XXX 8 is arbitrary */ > return -1; >@@ -7310,6 +7326,7 @@ > > if (natl != NULL) { > NBUMPSIDED(fin->fin_out, ns_divert_exist); >+ DT3(ns_divert_exist, fr_info_t *, fin, nat_t *, nat, natinfo_t, nai); > return -1; > } > >@@ -7562,6 +7579,7 @@ > case FRI_PEERADDR : > case FRI_NETWORK : > default : >+ DT4(ns_na_atype, fr_info_t *, fin, nat_addr_t *, na, u_32_t *, old, u_32_t *, new); > return -1; > } > >@@ -7573,6 +7591,7 @@ > NULL); > } else { > NBUMPSIDE(fin->fin_out, ns_badnextaddr); >+ DT4(ns_badnextaddr_1, fr_info_t *, fin, nat_addr_t *, na, u_32_t *, old, u_32_t *, new); > } > > } else if (na->na_atype == IPLT_NONE) { >@@ -7591,6 +7610,7 @@ > if (ipf_ifpaddr(softc, 4, na->na_atype, > fin->fin_ifp, &newip, NULL) == -1) { > NBUMPSIDED(fin->fin_out, ns_ifpaddrfail); >+ DT4(ns_ifpaddrfail, fr_info_t *, fin, nat_addr_t *, na, u_32_t *, old, u_32_t *, new); > return -1; > } > new = newip.in4.s_addr; >@@ -7602,6 +7622,7 @@ > > } else { > NBUMPSIDE(fin->fin_out, ns_badnextaddr); >+ DT4(ns_badnextaddr_2, fr_info_t *, fin, nat_addr_t *, na, u_32_t *, old, u_32_t *, new); > } > > return error;
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 208566
:
195977
|
196269
|
196320
| 196324