Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/pf/if_pfsync.c
Show First 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) | ||||
struct pfsync_softc *sc = V_pfsyncif; | struct pfsync_softc *sc = V_pfsyncif; | ||||
#ifndef __NO_STRICT_ALIGNMENT | #ifndef __NO_STRICT_ALIGNMENT | ||||
struct pfsync_state_key key[2]; | struct pfsync_state_key key[2]; | ||||
#endif | #endif | ||||
struct pfsync_state_key *kw, *ks; | struct pfsync_state_key *kw, *ks; | ||||
struct pf_state *st = NULL; | struct pf_state *st = NULL; | ||||
struct pf_state_key *skw = NULL, *sks = NULL; | struct pf_state_key *skw = NULL, *sks = NULL; | ||||
struct pf_krule *r = NULL; | struct pf_krule *r = NULL; | ||||
struct pfi_kif *kif; | struct pfi_kkif *kif; | ||||
int error; | int error; | ||||
PF_RULES_RASSERT(); | PF_RULES_RASSERT(); | ||||
if (sp->creatorid == 0) { | if (sp->creatorid == 0) { | ||||
if (V_pf_status.debug >= PF_DEBUG_MISC) | if (V_pf_status.debug >= PF_DEBUG_MISC) | ||||
printf("%s: invalid creator id: %08x\n", __func__, | printf("%s: invalid creator id: %08x\n", __func__, | ||||
ntohl(sp->creatorid)); | ntohl(sp->creatorid)); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
if ((kif = pfi_kif_find(sp->ifname)) == NULL) { | if ((kif = pfi_kkif_find(sp->ifname)) == NULL) { | ||||
if (V_pf_status.debug >= PF_DEBUG_MISC) | if (V_pf_status.debug >= PF_DEBUG_MISC) | ||||
printf("%s: unknown interface: %s\n", __func__, | printf("%s: unknown interface: %s\n", __func__, | ||||
sp->ifname); | sp->ifname); | ||||
if (flags & PFSYNC_SI_IOCTL) | if (flags & PFSYNC_SI_IOCTL) | ||||
return (EINVAL); | return (EINVAL); | ||||
return (0); /* skip this state */ | return (0); /* skip this state */ | ||||
} | } | ||||
▲ Show 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | if (mp == NULL) { | ||||
return (-1); | return (-1); | ||||
} | } | ||||
clr = (struct pfsync_clr *)(mp->m_data + offp); | clr = (struct pfsync_clr *)(mp->m_data + offp); | ||||
for (i = 0; i < count; i++) { | for (i = 0; i < count; i++) { | ||||
creatorid = clr[i].creatorid; | creatorid = clr[i].creatorid; | ||||
if (clr[i].ifname[0] != '\0' && | if (clr[i].ifname[0] != '\0' && | ||||
pfi_kif_find(clr[i].ifname) == NULL) | pfi_kkif_find(clr[i].ifname) == NULL) | ||||
continue; | continue; | ||||
for (int i = 0; i <= pf_hashmask; i++) { | for (int i = 0; i <= pf_hashmask; i++) { | ||||
struct pf_idhash *ih = &V_pf_idhash[i]; | struct pf_idhash *ih = &V_pf_idhash[i]; | ||||
struct pf_state *s; | struct pf_state *s; | ||||
relock: | relock: | ||||
PF_HASHROW_LOCK(ih); | PF_HASHROW_LOCK(ih); | ||||
LIST_FOREACH(s, &ih->states, entry) { | LIST_FOREACH(s, &ih->states, entry) { | ||||
▲ Show 20 Lines • Show All 1,790 Lines • Show Last 20 Lines |