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

Function pfsync_in_ins

freebsd/netpfil/pf/if_pfsync.c:789–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787}
788
789static int
790pfsync_in_ins(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
791{
792 struct mbuf *mp;
793 struct pfsync_state *sa, *sp;
794 int len = sizeof(*sp) * count;
795 int i, offp;
796
797 mp = m_pulldown(m, offset, len, &offp);
798 if (mp == NULL) {
799 V_pfsyncstats.pfsyncs_badlen++;
800 return (-1);
801 }
802 sa = (struct pfsync_state *)(mp->m_data + offp);
803
804 for (i = 0; i < count; i++) {
805 sp = &sa[i];
806
807 /* Check for invalid values. */
808 if (sp->timeout >= PFTM_MAX ||
809 sp->src.state > PF_TCPS_PROXY_DST ||
810 sp->dst.state > PF_TCPS_PROXY_DST ||
811 sp->direction > PF_OUT ||
812 (sp->af != AF_INET && sp->af != AF_INET6)) {
813 if (V_pf_status.debug >= PF_DEBUG_MISC)
814 printf("%s: invalid value\n", __func__);
815 V_pfsyncstats.pfsyncs_badval++;
816 continue;
817 }
818
819 if (pfsync_state_import(sp, pkt->flags) == ENOMEM)
820 /* Drop out, but process the rest of the actions. */
821 break;
822 }
823
824 return (len);
825}
826
827static int
828pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)

Callers

nothing calls this directly

Calls 3

m_pulldownFunction · 0.85
pfsync_state_importFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected