154359Sroberto/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
254359Sroberto/*
354359Sroberto *  SR-IPv6 implementation
454359Sroberto *
554359Sroberto *  Author:
654359Sroberto *  David Lebrun <david.lebrun@uclouvain.be>
754359Sroberto *
8290001Sglebius *
9290001Sglebius *  This program is free software; you can redistribute it and/or
10290001Sglebius *      modify it under the terms of the GNU General Public License
1154359Sroberto *      as published by the Free Software Foundation; either version
12290001Sglebius *      2 of the License, or (at your option) any later version.
13290001Sglebius */
14290001Sglebius
15290001Sglebius#ifndef _UAPI_LINUX_SEG6_H
16290001Sglebius#define _UAPI_LINUX_SEG6_H
17290001Sglebius
18290001Sglebius#include <linux/types.h>
1954359Sroberto#include <linux/in6.h>		/* For struct in6_addr. */
20290001Sglebius
21290001Sglebius/*
22290001Sglebius * SRH
23290001Sglebius */
24290001Sglebiusstruct ipv6_sr_hdr {
25290001Sglebius	__u8	nexthdr;
26290001Sglebius	__u8	hdrlen;
27290001Sglebius	__u8	type;
2854359Sroberto	__u8	segments_left;
2954359Sroberto	__u8	first_segment; /* Represents the last_entry field of SRH */
3054359Sroberto	__u8	flags;
3154359Sroberto	__u16	tag;
3254359Sroberto
3354359Sroberto	struct in6_addr segments[];
3454359Sroberto};
3554359Sroberto
3654359Sroberto#define SR6_FLAG1_PROTECTED	(1 << 6)
3754359Sroberto#define SR6_FLAG1_OAM		(1 << 5)
3854359Sroberto#define SR6_FLAG1_ALERT		(1 << 4)
3954359Sroberto#define SR6_FLAG1_HMAC		(1 << 3)
4054359Sroberto
4154359Sroberto#define SR6_TLV_INGRESS		1
4254359Sroberto#define SR6_TLV_EGRESS		2
4354359Sroberto#define SR6_TLV_OPAQUE		3
4454359Sroberto#define SR6_TLV_PADDING		4
4554359Sroberto#define SR6_TLV_HMAC		5
4654359Sroberto
4754359Sroberto#define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC)
4854359Sroberto
49290001Sglebiusstruct sr6_tlv {
5054359Sroberto	__u8 type;
5154359Sroberto	__u8 len;
5254359Sroberto	__u8 data[0];
5354359Sroberto};
5454359Sroberto
5554359Sroberto#endif
56290001Sglebius