| 787 | } |
| 788 | |
| 789 | static int |
| 790 | pfsync_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 | |
| 827 | static int |
| 828 | pfsync_in_iack(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) |
nothing calls this directly
no test coverage detected