xref: /linux/include/uapi/linux/seg6.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
21ababebaSDavid Lebrun /*
31ababebaSDavid Lebrun  *  SR-IPv6 implementation
41ababebaSDavid Lebrun  *
51ababebaSDavid Lebrun  *  Author:
61ababebaSDavid Lebrun  *  David Lebrun <david.lebrun@uclouvain.be>
71ababebaSDavid Lebrun  *
81ababebaSDavid Lebrun  *
91ababebaSDavid Lebrun  *  This program is free software; you can redistribute it and/or
101ababebaSDavid Lebrun  *      modify it under the terms of the GNU General Public License
111ababebaSDavid Lebrun  *      as published by the Free Software Foundation; either version
121ababebaSDavid Lebrun  *      2 of the License, or (at your option) any later version.
131ababebaSDavid Lebrun  */
141ababebaSDavid Lebrun 
151ababebaSDavid Lebrun #ifndef _UAPI_LINUX_SEG6_H
161ababebaSDavid Lebrun #define _UAPI_LINUX_SEG6_H
171ababebaSDavid Lebrun 
18a50a05f4SDavid Lebrun #include <linux/types.h>
19ea3ebc73SDmitry V. Levin #include <linux/in6.h>		/* For struct in6_addr. */
20a50a05f4SDavid Lebrun 
211ababebaSDavid Lebrun /*
221ababebaSDavid Lebrun  * SRH
231ababebaSDavid Lebrun  */
241ababebaSDavid Lebrun struct ipv6_sr_hdr {
251ababebaSDavid Lebrun 	__u8	nexthdr;
261ababebaSDavid Lebrun 	__u8	hdrlen;
271ababebaSDavid Lebrun 	__u8	type;
281ababebaSDavid Lebrun 	__u8	segments_left;
296ab6a0ddSAhmed Abdelsalam 	__u8	first_segment; /* Represents the last_entry field of SRH */
30013e8167SDavid Lebrun 	__u8	flags;
316ab6a0ddSAhmed Abdelsalam 	__u16	tag;
321ababebaSDavid Lebrun 
33*94dfc73eSGustavo A. R. Silva 	struct in6_addr segments[];
341ababebaSDavid Lebrun };
351ababebaSDavid Lebrun 
361ababebaSDavid Lebrun #define SR6_FLAG1_PROTECTED	(1 << 6)
371ababebaSDavid Lebrun #define SR6_FLAG1_OAM		(1 << 5)
381ababebaSDavid Lebrun #define SR6_FLAG1_ALERT		(1 << 4)
391ababebaSDavid Lebrun #define SR6_FLAG1_HMAC		(1 << 3)
401ababebaSDavid Lebrun 
411ababebaSDavid Lebrun #define SR6_TLV_INGRESS		1
421ababebaSDavid Lebrun #define SR6_TLV_EGRESS		2
431ababebaSDavid Lebrun #define SR6_TLV_OPAQUE		3
441ababebaSDavid Lebrun #define SR6_TLV_PADDING		4
451ababebaSDavid Lebrun #define SR6_TLV_HMAC		5
461ababebaSDavid Lebrun 
47013e8167SDavid Lebrun #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC)
481ababebaSDavid Lebrun 
491ababebaSDavid Lebrun struct sr6_tlv {
501ababebaSDavid Lebrun 	__u8 type;
511ababebaSDavid Lebrun 	__u8 len;
521ababebaSDavid Lebrun 	__u8 data[0];
531ababebaSDavid Lebrun };
541ababebaSDavid Lebrun 
551ababebaSDavid Lebrun #endif
56