seg6.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * SR-IPv6 implementation
  4. *
  5. * Author:
  6. * David Lebrun <david.lebrun@uclouvain.be>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #ifndef _UAPI_LINUX_SEG6_H
  15. #define _UAPI_LINUX_SEG6_H
  16. #include <linux/types.h>
  17. #include <linux/in6.h> /* For struct in6_addr. */
  18. /*
  19. * SRH
  20. */
  21. struct ipv6_sr_hdr {
  22. __u8 nexthdr;
  23. __u8 hdrlen;
  24. __u8 type;
  25. __u8 segments_left;
  26. __u8 first_segment; /* Represents the last_entry field of SRH */
  27. __u8 flags;
  28. __u16 tag;
  29. struct in6_addr segments[0];
  30. };
  31. #define SR6_FLAG1_PROTECTED (1 << 6)
  32. #define SR6_FLAG1_OAM (1 << 5)
  33. #define SR6_FLAG1_ALERT (1 << 4)
  34. #define SR6_FLAG1_HMAC (1 << 3)
  35. #define SR6_TLV_INGRESS 1
  36. #define SR6_TLV_EGRESS 2
  37. #define SR6_TLV_OPAQUE 3
  38. #define SR6_TLV_PADDING 4
  39. #define SR6_TLV_HMAC 5
  40. #define sr_has_hmac(srh) ((srh)->flags & SR6_FLAG1_HMAC)
  41. struct sr6_tlv {
  42. __u8 type;
  43. __u8 len;
  44. __u8 data[0];
  45. };
  46. #endif