This patch implements the L2 frame encapsulation mechanism, referred to as T.Encaps.L2 in the SRv6 specifications [1]. A new type of SRv6 tunnel mode is added (SEG6_IPTUN_MODE_L2ENCAP). It only accepts packets with an existing MAC header (i.e., it will not work for locally generated packets). The resulting packet looks like IPv6 -> SRH -> Ethernet -> original L3 payload. The next header field of the SRH is set to NEXTHDR_NONE. [1] https://tools.ietf.org/html/draft-filsfils-spring-srv6-network-programming-01
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -33,16 +33,26 @@ struct seg6_iptunnel_encap { · 32 unmodified lines | |||
| 33 | enum { | 33 | enum { |
| 34 | SEG6_IPTUN_MODE_INLINE, | 34 | SEG6_IPTUN_MODE_INLINE, |
| 35 | SEG6_IPTUN_MODE_ENCAP, | 35 | SEG6_IPTUN_MODE_ENCAP, |
| 36 | SEG6_IPTUN_MODE_L2ENCAP, | ||
| 36 | }; | 37 | }; |
| 37 | 38 | ||
| 38 | #ifdef __KERNEL__ | 39 | #ifdef __KERNEL__ |
| 39 | 40 | ||
| 40 | static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo) | 41 | static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo) |
| 41 | { | 42 | { |
| 42 | int encap = (tuninfo->mode == SEG6_IPTUN_MODE_ENCAP); | 43 | int head = 0; |
| 43 | 44 | ||
| 44 | return ((tuninfo->srh->hdrlen + 1) << 3) + | 45 | switch (tuninfo->mode) { |
| 45 | (encap * sizeof(struct ipv6hdr)); | 46 | case SEG6_IPTUN_MODE_INLINE: |
| 47 | break; | ||
| 48 | case SEG6_IPTUN_MODE_ENCAP: | ||
| 49 | head = sizeof(struct ipv6hdr); | ||
| 50 | break; | ||
| 51 | case SEG6_IPTUN_MODE_L2ENCAP: | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | return ((tuninfo->srh->hdrlen + 1) << 3) + head; | ||
| 46 | } | 56 | } |
| 47 | 57 | ||
| 48 | #endif | 58 | #endif |