MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pfsync_in_clr

Function pfsync_in_clr

freebsd/netpfil/pf/if_pfsync.c:747–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745}
746
747static int
748pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
749{
750 struct pfsync_clr *clr;
751 struct mbuf *mp;
752 int len = sizeof(*clr) * count;
753 int i, offp;
754 u_int32_t creatorid;
755
756 mp = m_pulldown(m, offset, len, &offp);
757 if (mp == NULL) {
758 V_pfsyncstats.pfsyncs_badlen++;
759 return (-1);
760 }
761 clr = (struct pfsync_clr *)(mp->m_data + offp);
762
763 for (i = 0; i < count; i++) {
764 creatorid = clr[i].creatorid;
765
766 if (clr[i].ifname[0] != '\0' &&
767 pfi_kkif_find(clr[i].ifname) == NULL)
768 continue;
769
770 for (int i = 0; i <= pf_hashmask; i++) {
771 struct pf_idhash *ih = &V_pf_idhash[i];
772 struct pf_state *s;
773relock:
774 PF_HASHROW_LOCK(ih);
775 LIST_FOREACH(s, &ih->states, entry) {
776 if (s->creatorid == creatorid) {
777 s->state_flags |= PFSTATE_NOSYNC;
778 pf_unlink_state(s, PF_ENTER_LOCKED);
779 goto relock;
780 }
781 }
782 PF_HASHROW_UNLOCK(ih);
783 }
784 }
785
786 return (len);
787}
788
789static int
790pfsync_in_ins(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)

Callers

nothing calls this directly

Calls 3

m_pulldownFunction · 0.85
pfi_kkif_findFunction · 0.85
pf_unlink_stateFunction · 0.85

Tested by

no test coverage detected