-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI about locator and related funcs #16894
Open
Yubin-Li
wants to merge
3
commits into
FRRouting:master
Choose a base branch
from
wenwang00:project-phoenixwing-ysj
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+726
−19
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
#include <zebra.h> | ||
#include "prefix.h" | ||
#include "json.h" | ||
#include "vrf.h" | ||
|
||
#include <arpa/inet.h> | ||
#include <netinet/in.h> | ||
|
@@ -63,6 +64,11 @@ enum seg6local_action_t { | |
ZEBRA_SEG6_LOCAL_ACTION_END_AM = 14, | ||
ZEBRA_SEG6_LOCAL_ACTION_END_BPF = 15, | ||
ZEBRA_SEG6_LOCAL_ACTION_END_DT46 = 16, | ||
|
||
ZEBRA_SEG6_LOCAL_ACTION_END_UDT6 = 19, | ||
ZEBRA_SEG6_LOCAL_ACTION_END_UDT4 = 20, | ||
ZEBRA_SEG6_LOCAL_ACTION_END_UDT46 = 21, | ||
ZEBRA_SEG6_LOCAL_ACTION_END_UN = 22, | ||
}; | ||
|
||
/* Flavor operations for SRv6 End* Behaviors */ | ||
|
@@ -129,6 +135,7 @@ struct srv6_locator { | |
uint64_t current; | ||
bool status_up; | ||
struct list *chunks; | ||
struct list *sids; | ||
|
||
uint8_t flags; | ||
#define SRV6_LOCATOR_USID (1 << 0) /* The SRv6 Locator is a uSID Locator */ | ||
|
@@ -167,6 +174,13 @@ struct srv6_locator_chunk { | |
uint8_t flags; | ||
}; | ||
|
||
struct seg6_sid { | ||
enum seg6local_action_t sidaction; | ||
char vrfName[VRF_NAMSIZ + 1]; | ||
struct prefix_ipv6 ipv6Addr; | ||
char sidstr[PREFIX_STRLEN]; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/* | ||
* SRv6 Endpoint Behavior codepoints, as defined by IANA in | ||
* https://www.iana.org/assignments/segment-routing/segment-routing.xhtml | ||
|
@@ -366,6 +380,10 @@ static inline const char *srv6_sid_ctx2str(char *str, size_t size, | |
case ZEBRA_SEG6_LOCAL_ACTION_END_AS: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_AM: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_BPF: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_UN: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_UDT4: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_UDT6: | ||
case ZEBRA_SEG6_LOCAL_ACTION_END_UDT46: | ||
default: | ||
snprintf(str + len, size - len, " unknown(%s)", __func__); | ||
} | ||
|
@@ -378,6 +396,8 @@ 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 struct seg6_sid *srv6_locator_sid_alloc(void); | ||
extern void srv6_locator_sid_free(struct seg6_sid *sid); | ||
extern void srv6_locator_free(struct srv6_locator *locator); | ||
extern void srv6_locator_chunk_list_free(void *data); | ||
extern void srv6_locator_chunk_free(struct srv6_locator_chunk **chunk); | ||
|
@@ -388,6 +408,8 @@ 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); | ||
json_object *srv6_locator_sid_detailed_json(const struct srv6_locator *locator, | ||
const struct seg6_sid *sid); | ||
|
||
extern struct srv6_sid_format *srv6_sid_format_alloc(const char *name); | ||
extern void srv6_sid_format_free(struct srv6_sid_format *format); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,9 @@ typedef enum { | |
ZEBRA_SRV6_MANAGER_GET_LOCATOR, | ||
ZEBRA_SRV6_MANAGER_GET_SRV6_SID, | ||
ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID, | ||
ZEBRA_SRV6_MANAGER_GET_LOCATOR_SID, | ||
ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_SID, | ||
ZEBRA_SRV6_MANAGER_GET_LOCATOR_ALL, | ||
ZEBRA_ERROR, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GET_LOCATOR_ALL is unused. to be removed. |
||
ZEBRA_CLIENT_CAPABILITIES, | ||
ZEBRA_OPAQUE_MESSAGE, | ||
|
@@ -1064,6 +1067,8 @@ extern struct interface *zebra_interface_link_params_read(struct stream *s, | |
bool *changed); | ||
extern size_t zebra_interface_link_params_write(struct stream *, | ||
struct interface *); | ||
|
||
extern int zapi_srv6_locator_sid_encode(struct stream *s, struct srv6_locator *loc); | ||
extern enum zclient_send_status | ||
zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep, | ||
uint32_t chunk_size, uint32_t base); | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
router bgp 65000 | ||
no bgp ebgp-requires-policy | ||
timers bgp start-timer 0 | ||
neighbor aaa peer-group | ||
neighbor aaa remote-as 65001 | ||
neighbor 192.168.254.2 peer-group aaa | ||
neighbor 192.168.255.2 remote-as 65001 | ||
neighbor 192.168.255.2 timers 3 10 | ||
exit-address-family | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
! | ||
interface r1-eth0 | ||
ip address 192.168.255.1/24 | ||
! | ||
interface r1-eth1 | ||
ip address 192.168.254.1/24 | ||
! | ||
ip forwarding | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
router bgp 65001 | ||
no bgp ebgp-requires-policy | ||
timers bgp start-timer 0 | ||
neighbor aaa peer-group | ||
neighbor aaa remote-as 65000 | ||
neighbor 192.168.254.1 peer-group aaa | ||
neighbor 192.168.255.1 remote-as 65000 | ||
neighbor 192.168.255.1 timers 3 10 | ||
exit-address-family | ||
! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
! | ||
interface r2-eth0 | ||
ip address 192.168.255.2/24 | ||
! | ||
interface r2-eth1 | ||
ip address 192.168.254.2/24 | ||
! | ||
ip forwarding | ||
! |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.