h2_6->ip6_vfc |= IPV6_VERSION;
pf_send_reset(int off, struct tcphdr *th, struct pf_pdesc *pd, int af){	struct mbuf *m;	struct m_tag *mtag;	int len;#ifdef INET	struct ip *h2;#endif /* INET */#ifdef INET6	struct ip6_hdr *h2_6;#endif /* INET6 */	struct tcphdr *th2;	switch (af) {#ifdef INET	case AF_INET:		len = sizeof(struct ip) + sizeof(struct tcphdr);		break;#endif /* INET */#ifdef INET6	case AF_INET6:		len = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);		break;#endif /* INET6 */	}	/* don't reply to RST packets */	if (th->th_flags & TH_RST)		return;	/* create outgoing mbuf */	mtag = m_tag_get(PACKET_TAG_PF_GENERATED, 0, M_NOWAIT);	if (mtag == NULL)		return;	m = m_gethdr(M_DONTWAIT, MT_HEADER);	if (m == NULL) {		m_tag_free(mtag);		return;	}	m_tag_prepend(m, mtag);	m->m_data += max_linkhdr;	m->m_pkthdr.len = m->m_len = len;	m->m_pkthdr.rcvif = NULL;	bzero(m->m_data, len);	switch (af) {#ifdef INET	case AF_INET:		h2 = mtod(m, struct ip *);		/* IP header fields included in the TCP checksum */		h2->ip_p = IPPROTO_TCP;		h2->ip_len = htons(sizeof(*th2));		h2->ip_src.s_addr = pd->dst->v4.s_addr;		h2->ip_dst.s_addr = pd->src->v4.s_addr;		th2 = (struct tcphdr *)((caddr_t)h2 + sizeof(struct ip));		break;#endif /* INET */#ifdef INET6	case AF_INET6:		h2_6 = mtod(m, struct ip6_hdr *);		/* IP header fields included in the TCP checksum */		h2_6->ip6_nxt = IPPROTO_TCP;		h2_6->ip6_plen = htons(sizeof(*th2));		memcpy(&h2_6->ip6_src, pd->dst, sizeof(struct in6_addr));		memcpy(&h2_6->ip6_dst, pd->src, sizeof(struct in6_addr));  		th2 = (struct tcphdr *)((caddr_t)h2_6 + sizeof(struct ip6_hdr));		break;#endif /* INET6 */	}	/* TCP header */	th2->th_sport = th->th_dport;	th2->th_dport = th->th_sport;	if (th->th_flags & TH_ACK) {		th2->th_seq = th->th_ack;		th2->th_flags = TH_RST;	} else {		int tlen = pd->p_len;		if (th->th_flags & TH_SYN)			tlen++;		if (th->th_flags & TH_FIN)			tlen++;		th2->th_ack = htonl(ntohl(th->th_seq) + tlen);		th2->th_flags = TH_RST | TH_ACK;	}	th2->th_off = sizeof(*th2) >> 2;	switch (af) {#ifdef INET	case AF_INET:		/* TCP checksum */		th2->th_sum = in_cksum(m, len);		/* Finish the IP header */		h2->ip_v = 4;		h2->ip_hl = sizeof(*h2) >> 2;		h2->ip_ttl = 128;		h2->ip_sum = 0;		h2->ip_len = len;		h2->ip_off = 0;		ip_output(m, NULL, NULL, 0, NULL, NULL);		break;#endif /* INET */#ifdef INET6	case AF_INET6:		/* TCP checksum */		th2->th_sum = in6_cksum(m, IPPROTO_TCP,		    sizeof(struct ip6_hdr), sizeof(*th));		h2_6->ip6_hlim = 128;		ip6_output(m, NULL, NULL, 0, NULL, NULL);#endif /* INET6 */	}}