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

Function pfsync_in_ureq

freebsd/netpfil/pf/if_pfsync.c:1071–1110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069}
1070
1071static int
1072pfsync_in_ureq(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)
1073{
1074 struct pfsync_upd_req *ur, *ura;
1075 struct mbuf *mp;
1076 int len = count * sizeof(*ur);
1077 int i, offp;
1078
1079 struct pf_state *st;
1080
1081 mp = m_pulldown(m, offset, len, &offp);
1082 if (mp == NULL) {
1083 V_pfsyncstats.pfsyncs_badlen++;
1084 return (-1);
1085 }
1086 ura = (struct pfsync_upd_req *)(mp->m_data + offp);
1087
1088 for (i = 0; i < count; i++) {
1089 ur = &ura[i];
1090
1091 if (ur->id == 0 && ur->creatorid == 0)
1092 pfsync_bulk_start();
1093 else {
1094 st = pf_find_state_byid(ur->id, ur->creatorid);
1095 if (st == NULL) {
1096 V_pfsyncstats.pfsyncs_badstate++;
1097 continue;
1098 }
1099 if (st->state_flags & PFSTATE_NOSYNC) {
1100 PF_STATE_UNLOCK(st);
1101 continue;
1102 }
1103
1104 pfsync_update_state_req(st);
1105 PF_STATE_UNLOCK(st);
1106 }
1107 }
1108
1109 return (len);
1110}
1111
1112static int
1113pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count)

Callers

nothing calls this directly

Calls 4

m_pulldownFunction · 0.85
pfsync_bulk_startFunction · 0.85
pf_find_state_byidFunction · 0.85
pfsync_update_state_reqFunction · 0.85

Tested by

no test coverage detected