| 1069 | } |
| 1070 | |
| 1071 | static int |
| 1072 | pfsync_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 | |
| 1112 | static int |
| 1113 | pfsync_in_del(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) |
nothing calls this directly
no test coverage detected