FreeBSD Bugzilla – Attachment 144551 Details for
Bug 187381
[panic] pfsync: memory address not aligned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
revised patch
pr187381.diff (text/plain), 2.35 KB, created by
Gleb Smirnoff
on 2014-07-10 09:54:23 UTC
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Gleb Smirnoff
Created:
2014-07-10 09:54:23 UTC
Size:
2.35 KB
patch
obsolete
>Index: if_pfsync.c >=================================================================== >--- if_pfsync.c (revision 268450) >+++ if_pfsync.c (working copy) >@@ -402,6 +402,10 @@ static int > pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) > { > struct pfsync_softc *sc = V_pfsyncif; >+#ifndef __NO_STRICT_ALIGNMENT >+ struct pfsync_state_key key[2]; >+#endif >+ struct pfsync_state_key *kw, *ks; > struct pf_state *st = NULL; > struct pf_state_key *skw = NULL, *sks = NULL; > struct pf_rule *r = NULL; >@@ -451,12 +455,19 @@ pfsync_state_import(struct pfsync_state *sp, u_int > if ((skw = uma_zalloc(V_pf_state_key_z, M_NOWAIT)) == NULL) > goto cleanup; > >- if (PF_ANEQ(&sp->key[PF_SK_WIRE].addr[0], >- &sp->key[PF_SK_STACK].addr[0], sp->af) || >- PF_ANEQ(&sp->key[PF_SK_WIRE].addr[1], >- &sp->key[PF_SK_STACK].addr[1], sp->af) || >- sp->key[PF_SK_WIRE].port[0] != sp->key[PF_SK_STACK].port[0] || >- sp->key[PF_SK_WIRE].port[1] != sp->key[PF_SK_STACK].port[1]) { >+#ifndef __NO_STRICT_ALIGNMENT >+ bcopy(&sp->key, key, sizeof(struct pfsync_state_key) * 2); >+ kw = key[PF_SK_WIRE]; >+ ks = key[PF_SK_STACK]; >+#else >+ kw = &sp->key[PF_SK_WIRE]; >+ ks = &sp->key[PF_SK_STACK]; >+#endif >+ >+ if (PF_ANEQ(&kw->addr[0], &ks->addr[0], sp->af) || >+ PF_ANEQ(&kw->addr[1], &ks->addr[1], sp->af) || >+ kw->port[0] != ks->port[0] || >+ kw->port[1] != ks->port[1]) { > sks = uma_zalloc(V_pf_state_key_z, M_NOWAIT); > if (sks == NULL) > goto cleanup; >@@ -468,18 +479,18 @@ pfsync_state_import(struct pfsync_state *sp, u_int > pfsync_alloc_scrub_memory(&sp->dst, &st->dst)) > goto cleanup; > >- /* copy to state key(s) */ >- skw->addr[0] = sp->key[PF_SK_WIRE].addr[0]; >- skw->addr[1] = sp->key[PF_SK_WIRE].addr[1]; >- skw->port[0] = sp->key[PF_SK_WIRE].port[0]; >- skw->port[1] = sp->key[PF_SK_WIRE].port[1]; >+ /* Copy to state key(s). */ >+ skw->addr[0] = kw->addr[0]; >+ skw->addr[1] = kw->addr[1]; >+ skw->port[0] = kw->port[0]; >+ skw->port[1] = kw->port[1]; > skw->proto = sp->proto; > skw->af = sp->af; > if (sks != skw) { >- sks->addr[0] = sp->key[PF_SK_STACK].addr[0]; >- sks->addr[1] = sp->key[PF_SK_STACK].addr[1]; >- sks->port[0] = sp->key[PF_SK_STACK].port[0]; >- sks->port[1] = sp->key[PF_SK_STACK].port[1]; >+ sks->addr[0] = ks->addr[0]; >+ sks->addr[1] = ks->addr[1]; >+ sks->port[0] = ks->port[0]; >+ sks->port[1] = ks->port[1]; > sks->proto = sp->proto; > sks->af = sp->af; > }
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 187381
:
144257
|
144551
|
144553