]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/srv6.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / lib / srv6.h
index 715fc3723b3194075c25a0a8b5f5ecb3adaa5c40..0d3ee7d2ffa81df185537e65f0cbbb0813debe21 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * SRv6 definitions
  * Copyright (C) 2020  Hiroki Shirokura, LINE Corporation
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _FRR_SRV6_H
@@ -60,6 +47,7 @@ enum seg6local_action_t {
        ZEBRA_SEG6_LOCAL_ACTION_END_AS       = 13,
        ZEBRA_SEG6_LOCAL_ACTION_END_AM       = 14,
        ZEBRA_SEG6_LOCAL_ACTION_END_BPF      = 15,
+       ZEBRA_SEG6_LOCAL_ACTION_END_DT46     = 16,
 };
 
 struct seg6_segs {
@@ -91,6 +79,9 @@ struct srv6_locator {
        bool status_up;
        struct list *chunks;
 
+       uint8_t flags;
+#define SRV6_LOCATOR_USID (1 << 0) /* The SRv6 Locator is a uSID Locator */
+
        QOBJ_FIELDS;
 };
 DECLARE_QOBJ_TYPE(srv6_locator);
@@ -115,6 +106,23 @@ struct srv6_locator_chunk {
        uint8_t proto;
        uint16_t instance;
        uint32_t session_id;
+
+       uint8_t flags;
+};
+
+/*
+ * SRv6 Endpoint Behavior codepoints, as defined by IANA in
+ * https://www.iana.org/assignments/segment-routing/segment-routing.xhtml
+ */
+enum srv6_endpoint_behavior_codepoint {
+       SRV6_ENDPOINT_BEHAVIOR_RESERVED       = 0x0000,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT6        = 0x0012,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT4        = 0x0013,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT46       = 0x0014,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID   = 0x003E,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID   = 0x003F,
+       SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID  = 0x0040,
+       SRV6_ENDPOINT_BEHAVIOR_OPAQUE         = 0xFFFF,
 };
 
 struct nexthop_srv6 {
@@ -186,9 +194,12 @@ int snprintf_seg6_segs(char *str,
 extern struct srv6_locator *srv6_locator_alloc(const char *name);
 extern struct srv6_locator_chunk *srv6_locator_chunk_alloc(void);
 extern void srv6_locator_free(struct srv6_locator *locator);
-extern void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk);
+extern void srv6_locator_chunk_free(struct srv6_locator_chunk **chunk);
 json_object *srv6_locator_chunk_json(const struct srv6_locator_chunk *chunk);
 json_object *srv6_locator_json(const struct srv6_locator *loc);
+json_object *srv6_locator_detailed_json(const struct srv6_locator *loc);
+json_object *
+srv6_locator_chunk_detailed_json(const struct srv6_locator_chunk *chunk);
 
 #ifdef __cplusplus
 }