History

ipv6: sr: add support for encapsulation of L2 frames

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

David Lebrun committed 9 years ago

Commit 38ee7f21 parent 32d99d02 files · +37 −6Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/seg6_iptunnel.h+14−4
@@ -33,16 +33,26 @@ struct seg6_iptunnel_encap { · 32 unmodified lines
3333 enum {
3434 SEG6_IPTUN_MODE_INLINE,
3535 SEG6_IPTUN_MODE_ENCAP,
36+ SEG6_IPTUN_MODE_L2ENCAP,
3637 };
3738
3839 #ifdef __KERNEL__
3940
4041 static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo)
4142 {
42− int encap = (tuninfo->mode == SEG6_IPTUN_MODE_ENCAP);
43−
44− return ((tuninfo->srh->hdrlen + 1) << 3) +
45− (encap * sizeof(struct ipv6hdr));
43+ int head = 0;
44+
45+ switch (tuninfo->mode) {
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;
4656 }
4757
4858 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t