From 58433ae670938991c5521d972516cc51aa4a7fe8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 16 Nov 2016 14:25:04 +0000 Subject: [PATCH 1/3] bgpd: 'show ip bgp neighbor json' some keys are in the wrong place Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-13511 connectionsEstablished, etc are no longer under the addressFamilyInfo keyword, they are now at the top level --- bgpd/bgp_vty.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4232ff8d9a..47fcae5c51 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12387,8 +12387,9 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (use_json) { - json_object_int_add(json_hold, "connectionsEstablished", p->established); - json_object_int_add(json_hold, "connectionsDropped", p->dropped); + json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); + json_object_int_add(json, "connectionsEstablished", p->established); + json_object_int_add(json, "connectionsDropped", p->dropped); } else vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, @@ -12397,7 +12398,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (! p->last_reset) { if (use_json) - json_object_string_add(json_hold, "lastReset", "never"); + json_object_string_add(json, "lastReset", "never"); else vty_out (vty, " Last reset never%s", VTY_NEWLINE); } @@ -12411,13 +12412,13 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js uptime = bgp_clock(); uptime -= p->resettime; tm = gmtime(&uptime); - json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); - json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); + json_object_int_add(json, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); + json_object_string_add(json, "lastResetDueTo", peer_down_str[(int) p->last_reset]); if (p->last_reset_cause_size) { char errorcodesubcode_hexstr[5]; sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); - json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr); + json_object_string_add(json, "lastErrorCodeSubcode", errorcodesubcode_hexstr); } } else @@ -12468,7 +12469,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) { if (use_json) - json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); + json_object_boolean_true_add(json, "prefixesConfigExceedMax"); else vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); @@ -12476,8 +12477,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js { if (use_json) { - json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); - json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); + json_object_boolean_true_add(json, "reducePrefixNumFrom"); + json_object_int_add(json, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); } else vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", @@ -12487,16 +12488,13 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js else { if (use_json) - json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); + json_object_boolean_true_add(json, "reducePrefixNumAndClearIpBgp"); else vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", p->host, VTY_NEWLINE); } } - if (use_json) - json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); - /* EBGP Multihop and GTSM */ if (p->sort != BGP_PEER_IBGP) { From e08ac8b7afa03ca235434f8407f4c37d49de8a3a Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 16 Nov 2016 15:33:35 +0000 Subject: [PATCH 2/3] bgpd: 'show ip bgp neighbor json' some keys are in the wrong place Signed-off-by: Daniel Walton Reviewed-by: Sam Tannous Ticket: CM-13511 --- bgpd/bgp_vty.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 47fcae5c51..aff1aabe0c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12388,8 +12388,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (use_json) { json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); - json_object_int_add(json, "connectionsEstablished", p->established); - json_object_int_add(json, "connectionsDropped", p->dropped); + json_object_int_add(json_neigh, "connectionsEstablished", p->established); + json_object_int_add(json_neigh, "connectionsDropped", p->dropped); } else vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, @@ -12398,7 +12398,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (! p->last_reset) { if (use_json) - json_object_string_add(json, "lastReset", "never"); + json_object_string_add(json_neigh, "lastReset", "never"); else vty_out (vty, " Last reset never%s", VTY_NEWLINE); } @@ -12412,13 +12412,13 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js uptime = bgp_clock(); uptime -= p->resettime; tm = gmtime(&uptime); - json_object_int_add(json, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); - json_object_string_add(json, "lastResetDueTo", peer_down_str[(int) p->last_reset]); + json_object_int_add(json_neigh, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); + json_object_string_add(json_neigh, "lastResetDueTo", peer_down_str[(int) p->last_reset]); if (p->last_reset_cause_size) { char errorcodesubcode_hexstr[5]; sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); - json_object_string_add(json, "lastErrorCodeSubcode", errorcodesubcode_hexstr); + json_object_string_add(json_neigh, "lastErrorCodeSubcode", errorcodesubcode_hexstr); } } else @@ -12469,7 +12469,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) { if (use_json) - json_object_boolean_true_add(json, "prefixesConfigExceedMax"); + json_object_boolean_true_add(json_neigh, "prefixesConfigExceedMax"); else vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); @@ -12477,8 +12477,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js { if (use_json) { - json_object_boolean_true_add(json, "reducePrefixNumFrom"); - json_object_int_add(json, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); + json_object_boolean_true_add(json_neigh, "reducePrefixNumFrom"); + json_object_int_add(json_neigh, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); } else vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", @@ -12488,7 +12488,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js else { if (use_json) - json_object_boolean_true_add(json, "reducePrefixNumAndClearIpBgp"); + json_object_boolean_true_add(json_neigh, "reducePrefixNumAndClearIpBgp"); else vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", p->host, VTY_NEWLINE); From 50e24903ba3e90d3502428eaa1bdb961de305c72 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 18 Nov 2016 10:11:46 -0500 Subject: [PATCH 3/3] *: Fix up licensing to be right These files were submitted by Cumulus but did not properly setup the licensing of them. This fixes that issue. Signed-off-by: Donald Sharp --- lib/bitfield.h | 20 ++++++++++++++++++++ lib/csv.c | 20 ++++++++++++++++++++ lib/csv.h | 21 ++++++++++++++++++++- lib/ptm_lib.c | 21 +++++++++++++++++---- lib/ptm_lib.h | 24 +++++++++++++++++++++--- tools/cmd_check.py | 20 ++++++++++++++++++++ tools/quagga-reload.py | 21 ++++++++++++++++++++- zebra/zebra_rnh_null.c | 20 ++++++++++++++++++++ 8 files changed, 158 insertions(+), 9 deletions(-) diff --git a/lib/bitfield.h b/lib/bitfield.h index b3f40a948b..6c97ac0f19 100644 --- a/lib/bitfield.h +++ b/lib/bitfield.h @@ -1,3 +1,23 @@ +/* Bitfields + * Copyright (C) 2016 Cumulus Networks, Inc. + * + * This file is part of Quagga. + * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ /** * A simple bit array implementation to allocate and free IDs. An example * of its usage is in allocating link state IDs for OSPFv3 as OSPFv3 has diff --git a/lib/csv.c b/lib/csv.c index b90a8a9b92..7df9292647 100644 --- a/lib/csv.c +++ b/lib/csv.c @@ -1,3 +1,23 @@ +/* CSV + * Copyright (C) 2013 Cumulus Networks, Inc. + * + * This file is part of Quagga. + * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ #include #include #include diff --git a/lib/csv.h b/lib/csv.h index 078f390873..3fb4453761 100644 --- a/lib/csv.h +++ b/lib/csv.h @@ -1,4 +1,23 @@ -/* Copyright 2013 Cumulus Networks, LLC. All rights reserved. */ +/* CSV + * Copyright (C) 2013 Cumulus Networks, Inc. + * + * This file is part of Quagga. + * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ #ifndef __CSV_H__ #define __CSV_H__ diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c index bcf0be623d..0666797fad 100644 --- a/lib/ptm_lib.c +++ b/lib/ptm_lib.c @@ -1,10 +1,23 @@ -/********************************************************************* - * Copyright 2015 Cumulus Networks, LLC. All rights reserved. +/* PTM Library + * Copyright (C) 2015 Cumulus Networks, Inc. * - * library file used by clients for sending commands and parsing response + * This file is part of Quagga. * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ - #include #include #include diff --git a/lib/ptm_lib.h b/lib/ptm_lib.h index e79529a819..be4170bb37 100644 --- a/lib/ptm_lib.h +++ b/lib/ptm_lib.h @@ -1,9 +1,25 @@ -/********************************************************************* - * Copyright 2015 Cumulus Networks, LLC. All rights reserved. +/* PTM Library + * Copyright (C) 2015 Cumulus Networks, Inc. * - * library file used by clients for sending commands and parsing response + * This file is part of Quagga. * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. */ +#ifndef __PTM_LIB_H__ +#define __PTM_LIB_H__ #define PTMLIB_MSG_SZ 1024 #define PTMLIB_MSG_HDR_LEN 37 @@ -47,3 +63,5 @@ int ptm_lib_find_key_in_msg(void *, const char *, char *); int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **); int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *); int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *); + +#endif diff --git a/tools/cmd_check.py b/tools/cmd_check.py index 5bd8032b70..bfe90c4392 100755 --- a/tools/cmd_check.py +++ b/tools/cmd_check.py @@ -1,4 +1,24 @@ #!/usr/bin/python3 +# Command Checker +# Copyright (C) 2016 Cumulus Networks, Inc. +# +# This file is part of Quagga. +# +# Quagga 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, or (at your option) any +# later version. +# +# Quagga 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 Quagga; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# # Parses a source file, ensuring that CLI definitions (DEFUNs, ALIASs, etc) # have install_command called on them at some point. diff --git a/tools/quagga-reload.py b/tools/quagga-reload.py index ed36b940a9..4d6e9259fd 100755 --- a/tools/quagga-reload.py +++ b/tools/quagga-reload.py @@ -1,5 +1,24 @@ #!/usr/bin/python - +# Quagga Reloader +# Copyright (C) 2014 Cumulus Networks, Inc. +# +# This file is part of Quagga. +# +# Quagga 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, or (at your option) any +# later version. +# +# Quagga 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 Quagga; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# """ This program - reads a quagga configuration text file diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c index 3ec8be027d..eecb8519d5 100644 --- a/zebra/zebra_rnh_null.c +++ b/zebra/zebra_rnh_null.c @@ -1,3 +1,23 @@ +/* Zebra next hop tracking code + * Copyright (C) 2013 Cumulus Networks, Inc. + * + * This file is part of Quagga. + * + * Quagga 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, or (at your option) any + * later version. + * + * Quagga 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 Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ #include #include "zebra/rib.h" #include "zebra/zserv.h"