| 862 | } |
| 863 | |
| 864 | static int |
| 865 | pfsync_upd_tcp(struct pf_state *st, struct pfsync_state_peer *src, |
| 866 | struct pfsync_state_peer *dst) |
| 867 | { |
| 868 | int sync = 0; |
| 869 | |
| 870 | PF_STATE_LOCK_ASSERT(st); |
| 871 | |
| 872 | /* |
| 873 | * The state should never go backwards except |
| 874 | * for syn-proxy states. Neither should the |
| 875 | * sequence window slide backwards. |
| 876 | */ |
| 877 | if ((st->src.state > src->state && |
| 878 | (st->src.state < PF_TCPS_PROXY_SRC || |
| 879 | src->state >= PF_TCPS_PROXY_SRC)) || |
| 880 | |
| 881 | (st->src.state == src->state && |
| 882 | SEQ_GT(st->src.seqlo, ntohl(src->seqlo)))) |
| 883 | sync++; |
| 884 | else |
| 885 | pf_state_peer_ntoh(src, &st->src); |
| 886 | |
| 887 | if ((st->dst.state > dst->state) || |
| 888 | |
| 889 | (st->dst.state >= TCPS_SYN_SENT && |
| 890 | SEQ_GT(st->dst.seqlo, ntohl(dst->seqlo)))) |
| 891 | sync++; |
| 892 | else |
| 893 | pf_state_peer_ntoh(dst, &st->dst); |
| 894 | |
| 895 | return (sync); |
| 896 | } |
| 897 | |
| 898 | static int |
| 899 | pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) |
no outgoing calls
no test coverage detected