diff options
| author | Renato Westphal <renato@openbsd.org> | 2017-09-05 10:20:49 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-05 10:20:49 -0300 |
| commit | 5ba345ccb231bb747bfe80dda952320e8cc18c7c (patch) | |
| tree | 5c4b4377786b10a6d70c9d6eb846e2390e38ab27 /bgpd/bgp_community.c | |
| parent | dfd8f05f97b38a78b7b71feab05f7f580a26c9df (diff) | |
| parent | 31d5efe2ea59ea4bc2e1101127c757129e9a5327 (diff) | |
Merge pull request #1047 from dwalton76/bgpd-draft-ietf-grow-bgp-gshut-10
bgpd: implement draft-ietf-grow-bgp-gshut-10
Diffstat (limited to 'bgpd/bgp_community.c')
| -rw-r--r-- | bgpd/bgp_community.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 389d723e04..7e8411b6a0 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -191,6 +191,7 @@ struct community *community_uniq_sort(struct community *com) 0xFFFFFF01 "no-export" 0xFFFFFF02 "no-advertise" 0xFFFFFF03 "local-AS" + 0xFFFF0000 "graceful-shutdown" For other values, "AS:VAL" format is used. */ static void set_community_string(struct community *com) @@ -244,6 +245,9 @@ static void set_community_string(struct community *com) case COMMUNITY_LOCAL_AS: len += strlen(" local-AS"); break; + case COMMUNITY_GSHUT: + len += strlen(" graceful-shutdown"); + break; default: len += strlen(" 65536:65535"); break; @@ -289,6 +293,12 @@ static void set_community_string(struct community *com) json_string = json_object_new_string("localAs"); json_object_array_add(json_community_list, json_string); break; + case COMMUNITY_GSHUT: + strcpy(pnt, "graceful-shutdown"); + pnt += strlen("graceful-shutdown"); + json_string = json_object_new_string("gracefulShutdown"); + json_object_array_add(json_community_list, json_string); + break; default: as = (comval >> 16) & 0xFFFF; val = comval & 0xFFFF; @@ -480,6 +490,7 @@ enum community_token { community_token_no_export, community_token_no_advertise, community_token_local_as, + community_token_gshut, community_token_unknown }; @@ -523,6 +534,12 @@ community_gettoken(const char *buf, enum community_token *token, u_int32_t *val) p += strlen("local-AS"); return p; } + if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown")) == 0) { + *val = COMMUNITY_GSHUT; + *token = community_token_gshut; + p += strlen("graceful-shutdown"); + return p; + } /* Unknown string. */ *token = community_token_unknown; @@ -595,6 +612,7 @@ struct community *community_str2com(const char *str) case community_token_no_export: case community_token_no_advertise: case community_token_local_as: + case community_token_gshut: if (com == NULL) { com = community_new(); com->json = NULL; |
