/*
- * Copyright (c) 1999-2018 Apple Inc. All rights reserved.
+ * Copyright (c) 1999-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#define PF_TAG_HDR_INET 0x8 /* hdr points to IPv4 */
#define PF_TAG_HDR_INET6 0x10 /* hdr points to IPv6 */
#endif /* PF_ECN */
+#define PF_TAG_REASSEMBLED 0x20 /* pkt reassembled by PF */
+#define PF_TAG_REFRAGMENTED 0x40 /* pkt refragmented by PF */
/*
* PF mbuf tag
*/
#endif /* PF_ECN */
};
+/*
+ * PF fragment tag
+ */
+struct pf_fragment_tag {
+ uint32_t ft_id; /* fragment id */
+ uint16_t ft_hdrlen; /* header length of reassembled pkt */
+ uint16_t ft_unfragpartlen; /* length of the per-fragment headers */
+ uint16_t ft_extoff; /* last extension header offset or 0 */
+ uint16_t ft_maxlen; /* maximum fragment payload length */
+};
+
/*
* TCP mbuf tag
*/
* Protocol specific mbuf tag (at most one protocol metadata per mbuf).
*
* Care must be taken to ensure that they are mutually exclusive, e.g.
- * IPSec policy ID implies no TCP segment offload (which is fine given
+ * IPsec policy ID implies no TCP segment offload (which is fine given
* that the former is used on the virtual ipsec interface that does
* not advertise the TSO capability.)
*/
#define bufstatus_if _pkt_bsr.if_data
#define bufstatus_sndbuf _pkt_bsr.sndbuf_data
};
- u_int64_t pkt_timestamp; /* enqueue time */
+ u_int64_t pkt_timestamp; /* TX: enqueue time, RX: receive timestamp */
/*
* Tags (external and built-in)
#define FLOWSRC_PF 3 /* flow ID generated by PF */
#define FLOWSRC_CHANNEL 4 /* flow ID generated by channel */
+/*
+ * FLOWSRC_MPKL_INPUT is not a true flow data source and is used for
+ * multi-layer packet logging. We're usurping the pkt_flowsrc field because
+ * the mbuf packet header ran out of space and pkt_flowsrc is normally
+ * used on output so we assume we can safely overwrite the normal semantic of
+ * the field.
+ * This value is meant to be used on incoming packet from a lower level protocol
+ * to pass information to some upper level protocol. When FLOWSRC_MPKL_INPUT
+ * is set, the following fields are used:
+ * - pkt_proto: the IP protocol ID of the lower level protocol
+ * - pkt_flowid: the identifier of the packet at the lower protocol.
+ * For example ESP would set pkt_proto to IPPROTO_ESP and pkt_flowid to the SPI.
+ */
+
/*
* Packet flags. Unlike m_flags, all packet flags are copied along when
* copying m_pkthdr, i.e. no equivalent of M_COPYFLAGS here. These flags
*/
/* VLAN tag present */
-#define CSUM_VLAN_TAG_VALID 0x10000 /* vlan_tag field is valid */
+#define CSUM_VLAN_TAG_VALID 0x00010000 /* vlan_tag field is valid */
+
+/* checksum start adjustment has been done */
+#define CSUM_ADJUST_DONE 0x00020000
/* TCP Segment Offloading requested on this mbuf */
-#define CSUM_TSO_IPV4 0x100000 /* This mbuf needs to be segmented by the NIC */
-#define CSUM_TSO_IPV6 0x200000 /* This mbuf needs to be segmented by the NIC */
+#define CSUM_TSO_IPV4 0x00100000 /* This mbuf needs to be segmented by the NIC */
+#define CSUM_TSO_IPV6 0x00200000 /* This mbuf needs to be segmented by the NIC */
#define TSO_IPV4_OK(_ifp, _m) \
(((_ifp)->if_hwassist & IFNET_TSO_IPV4) && \
#define MBUFQ_LAST(head) \
(((head)->mq_last == &MBUFQ_FIRST(head)) ? NULL : \
((struct mbuf *)(void *)((char *)(head)->mq_last - \
- (size_t)(&MBUFQ_NEXT((struct mbuf *)0)))))
+ __builtin_offsetof(struct mbuf, m_nextpkt))))
#define max_linkhdr P2ROUNDUP(_max_linkhdr, sizeof (u_int32_t))
#define max_protohdr P2ROUNDUP(_max_protohdr, sizeof (u_int32_t))
#define M_COPYM_MUST_COPY_HDR 3 /* MUST copy pkthdr from old to new */
#define M_COPYM_MUST_MOVE_HDR 4 /* MUST move pkthdr from old to new */
-extern void m_freem(struct mbuf *);
+extern void m_freem(struct mbuf *) __XNU_INTERNAL(m_freem);
extern u_int64_t mcl_to_paddr(char *);
extern void m_adj(struct mbuf *, int);
extern void m_cat(struct mbuf *, struct mbuf *);
__private_extern__ void m_16kfree(caddr_t, u_int, caddr_t);
__private_extern__ struct mbuf *m_m16kget(struct mbuf *, int);
__private_extern__ int m_reinit(struct mbuf *, int);
-__private_extern__ struct mbuf *m_free(struct mbuf *);
+__private_extern__ struct mbuf *m_free(struct mbuf *) __XNU_INTERNAL(m_free);
__private_extern__ struct mbuf *m_getclr(int, int);
__private_extern__ struct mbuf *m_getptr(struct mbuf *, int, int *);
__private_extern__ unsigned int m_length(struct mbuf *);
KERNEL_TAG_TYPE_IPSEC = 10,
KERNEL_TAG_TYPE_DRVAUX = 11,
KERNEL_TAG_TYPE_CFIL_UDP = 13,
+ KERNEL_TAG_TYPE_PF_REASS = 14,
};
/* Packet tag routines */