diff options
705 files changed, 7764 insertions, 9168 deletions
diff --git a/COMMUNITY.md b/COMMUNITY.md index 0eeb93403..a441929b3 100644 --- a/COMMUNITY.md +++ b/COMMUNITY.md @@ -230,23 +230,22 @@ form of the header is as follows: ``` /* - Title/Function of file - Copyright (C) 2016 Author’s Name - - 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 + * Title/Function of file + * Copyright (C) YEAR Author’s Name + * + * 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 */ #include <zebra.h> @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> + Copyright (C) <year> <name of author> 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 @@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. 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; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am index 4ea045552..a57a66488 100644 --- a/bgpd/Makefile.am +++ b/bgpd/Makefile.am @@ -80,7 +80,7 @@ libbgp_a_SOURCES = \ bgp_mplsvpn.c bgp_nexthop.c \ bgp_damp.c bgp_table.c bgp_advertise.c bgp_vty.c bgp_mpath.c \ bgp_nht.c bgp_updgrp.c bgp_updgrp_packet.c bgp_updgrp_adv.c bgp_bfd.c \ - bgp_encap.c bgp_encap_tlv.c $(BGP_VNC_RFAPI_SRC) bgp_attr_evpn.c \ + bgp_encap_tlv.c $(BGP_VNC_RFAPI_SRC) bgp_attr_evpn.c \ bgp_evpn.c bgp_evpn_vty.c bgp_vpn.c bgp_label.c noinst_HEADERS = \ @@ -91,7 +91,7 @@ noinst_HEADERS = \ bgp_ecommunity.h bgp_lcommunity.h \ bgp_mplsvpn.h bgp_nexthop.h bgp_damp.h bgp_table.h \ bgp_advertise.h bgp_vty.h bgp_mpath.h bgp_nht.h \ - bgp_updgrp.h bgp_bfd.h bgp_encap.h bgp_encap_tlv.h bgp_encap_types.h \ + bgp_updgrp.h bgp_bfd.h bgp_encap_tlv.h bgp_encap_types.h \ $(BGP_VNC_RFAPI_HD) bgp_attr_evpn.h bgp_evpn.h bgp_evpn_vty.h \ bgp_vpn.h bgp_label.h diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c index da5ab94e9..f005b2018 100644 --- a/bgpd/bgp_advertise.c +++ b/bgpd/bgp_advertise.c @@ -1,22 +1,22 @@ /* BGP advertisement and adjacency - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 6dc9bb647..03a1ffcb9 100644 --- a/bgpd/bgp_advertise.h +++ b/bgpd/bgp_advertise.h @@ -1,22 +1,22 @@ /* BGP advertisement and adjacency - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ADVERTISE_H #define _QUAGGA_BGP_ADVERTISE_H diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 006631c1f..372650a2a 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1,23 +1,23 @@ /* AS path management routines. - Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro - Copyright (C) 2005 Sun Microsystems, Inc. - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro + * Copyright (C) 2005 Sun Microsystems, Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h index b15e32fec..abf4c6ccf 100644 --- a/bgpd/bgp_aspath.h +++ b/bgpd/bgp_aspath.h @@ -1,22 +1,22 @@ /* AS path related definitions. - Copyright (C) 1997, 98, 99 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ASPATH_H #define _QUAGGA_BGP_ASPATH_H diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index b97ba61c9..cf2e48759 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1,22 +1,22 @@ /* BGP attributes management routines. - Copyright (C) 1996, 97, 98, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -968,26 +968,6 @@ bgp_attr_default_set (struct attr *attr, u_char origin) return attr; } - -/* Make network statement's attribute. */ -struct attr * -bgp_attr_default_intern (u_char origin) -{ - struct attr attr; - struct attr *new; - - memset (&attr, 0, sizeof (struct attr)); - bgp_attr_extra_get (&attr); - - bgp_attr_default_set(&attr, origin); - - new = bgp_attr_intern (&attr); - bgp_attr_extra_free (&attr); - - aspath_unintern (&new->aspath); - return new; -} - /* Create the attributes for an aggregate */ struct attr * bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin, @@ -1500,8 +1480,7 @@ bgp_attr_as4_path (struct bgp_attr_parser_args *args, struct aspath **as4_path) } /* Set aspath attribute flag. */ - if (as4_path) - attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH); + attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH); return BGP_ATTR_PARSE_PROCEED; } @@ -2827,13 +2806,15 @@ bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size, } size_t -bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, +bgp_packet_mpattr_start (struct stream *s, struct peer *peer, + afi_t afi, safi_t safi, struct bpacket_attr_vec_arr *vecarr, struct attr *attr) { size_t sizep; iana_afi_t pkt_afi; safi_t pkt_safi; + afi_t nh_afi; /* Set extended bit always to encode the attribute length as 2 bytes */ stream_putc (s, BGP_ATTR_FLAG_OPTIONAL|BGP_ATTR_FLAG_EXTLEN); @@ -2847,12 +2828,21 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, stream_putw (s, pkt_afi); /* AFI */ stream_putc (s, pkt_safi); /* SAFI */ - if (afi == AFI_L2VPN) - nh_afi = AFI_L2VPN; - else if (nh_afi == AFI_MAX) - nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len); + + /* Nexthop AFI */ + if (peer_cap_enhe(peer, afi, safi)) { + nh_afi = AFI_IP6; + } else { + if (afi == AFI_L2VPN) + nh_afi = AFI_L2VPN; + else if (safi == SAFI_LABELED_UNICAST) + nh_afi = afi; + else + nh_afi = BGP_NEXTHOP_AFI_FROM_NHLEN(attr->extra->mp_nexthop_len); + } /* Nexthop */ + bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); switch (nh_afi) { case AFI_IP: @@ -2861,12 +2851,10 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, case SAFI_UNICAST: case SAFI_MULTICAST: case SAFI_LABELED_UNICAST: - bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); stream_putc (s, 4); stream_put_ipv4 (s, attr->nexthop.s_addr); break; case SAFI_MPLS_VPN: - bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); stream_putc (s, 12); stream_putl (s, 0); /* RD = 0, per RFC */ stream_putl (s, 0); @@ -2890,7 +2878,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, struct attr_extra *attre = attr->extra; assert (attr->extra); - bpacket_attr_vec_arr_set_vec (vecarr, BGP_ATTR_VEC_NH, s, attr); if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) { stream_putc (s, BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL); @@ -3041,7 +3028,8 @@ bgp_packet_mpattr_tea( case BGP_ATTR_ENCAP: attrname = "Tunnel Encap"; subtlvs = attr->extra->encap_subtlvs; - + if (subtlvs == NULL) /* nothing to do */ + return; /* * The tunnel encap attr has an "outer" tlv. * T = tunneltype, @@ -3056,6 +3044,8 @@ bgp_packet_mpattr_tea( case BGP_ATTR_VNC: attrname = "VNC"; subtlvs = attr->extra->vnc_subtlvs; + if (subtlvs == NULL) /* nothing to do */ + return; attrlenfield = 0; /* no outer T + L */ attrhdrlen = 2 + 2; /* subTLV T + L */ break; @@ -3147,10 +3137,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer, { size_t mpattrlen_pos = 0; - mpattrlen_pos = bgp_packet_mpattr_start(s, afi, safi, - (peer_cap_enhe(peer, afi, safi) ? AFI_IP6 : - AFI_MAX), /* get from NH */ - vecarr, attr); + mpattrlen_pos = bgp_packet_mpattr_start(s, peer, afi, safi, vecarr, attr); bgp_packet_mpattr_prefix(s, afi, safi, p, prd, tag, addpath_encode, addpath_tx_id, attr); bgp_packet_mpattr_end(s, mpattrlen_pos); diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 3351ad223..f25df3a8b 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -1,22 +1,22 @@ /* BGP attributes. - Copyright (C) 1996, 97, 98 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ATTR_H #define _QUAGGA_BGP_ATTR_H @@ -246,7 +246,6 @@ extern void bgp_attr_unintern_sub (struct attr *); extern void bgp_attr_unintern (struct attr **); extern void bgp_attr_flush (struct attr *); extern struct attr *bgp_attr_default_set (struct attr *attr, u_char); -extern struct attr *bgp_attr_default_intern (u_char); extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char, struct aspath *, struct community *, int as_set, u_char); @@ -298,8 +297,8 @@ bgp_attr_flush_encap(struct attr *attr); * one for each NLRI that needs to be encoded into the UPDATE message, and * finally the _end() function. */ -extern size_t bgp_packet_mpattr_start(struct stream *s, afi_t afi, safi_t safi, - afi_t nh_afi, +extern size_t bgp_packet_mpattr_start(struct stream *s, struct peer *peer, + afi_t afi, safi_t safi, struct bpacket_attr_vec_arr *vecarr, struct attr *attr); extern void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c index 5b24d4ec6..e565d0801 100644 --- a/bgpd/bgp_attr_evpn.c +++ b/bgpd/bgp_attr_evpn.c @@ -1,22 +1,22 @@ /* Ethernet-VPN Attribute handling file - Copyright (C) 2016 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2016 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_attr_evpn.h b/bgpd/bgp_attr_evpn.h index 4b7d24de1..3a93f6ae6 100644 --- a/bgpd/bgp_attr_evpn.h +++ b/bgpd/bgp_attr_evpn.h @@ -1,22 +1,22 @@ /* E-VPN attribute handling structure file - Copyright (C) 2016 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2016 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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 _QUAGGA_BGP_ATTR_EVPN_H #define _QUAGGA_BGP_ATTR_EVPN_H diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 0a06a57fe..08cdee76f 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_bfd.h b/bgpd/bgp_bfd.h index e872637e3..e2c85af04 100644 --- a/bgpd/bgp_bfd.h +++ b/bgpd/bgp_bfd.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_BGP_BFD_H diff --git a/bgpd/bgp_btoa.c b/bgpd/bgp_btoa.c index d3162a4ea..be9344830 100644 --- a/bgpd/bgp_btoa.c +++ b/bgpd/bgp_btoa.c @@ -1,22 +1,22 @@ /* BGP dump to ascii converter - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 3def97c73..a61d63bb8 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -1,22 +1,22 @@ /* BGP community-list and extcommunity-list. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -1158,16 +1158,13 @@ extcommunity_list_set (struct community_list_handler *ch, } } - if (str) - { - if (style == EXTCOMMUNITY_LIST_STANDARD) - ecom = ecommunity_str2com (str, 0, 1); - else - regex = bgp_regcomp (str); + if (style == EXTCOMMUNITY_LIST_STANDARD) + ecom = ecommunity_str2com (str, 0, 1); + else + regex = bgp_regcomp (str); - if (! ecom && ! regex) - return COMMUNITY_LIST_ERR_MALFORMED_VAL; - } + if (! ecom && ! regex) + return COMMUNITY_LIST_ERR_MALFORMED_VAL; if (ecom) ecom->str = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_DISPLAY, 0); @@ -1180,8 +1177,7 @@ extcommunity_list_set (struct community_list_handler *ch, entry->config = ecommunity_ecom2str (ecom, ECOMMUNITY_FORMAT_COMMUNITY_LIST, 0); else if (regex) entry->config = XSTRDUP (MTYPE_COMMUNITY_LIST_CONFIG, str); - else - entry->config = NULL; + entry->u.ecom = ecom; entry->reg = regex; diff --git a/bgpd/bgp_clist.h b/bgpd/bgp_clist.h index 68e45c8f7..114acde8f 100644 --- a/bgpd/bgp_clist.h +++ b/bgpd/bgp_clist.h @@ -1,22 +1,22 @@ /* BGP Community list. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_CLIST_H #define _QUAGGA_BGP_CLIST_H diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 17a3d2fda..bd67829d7 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -1,22 +1,22 @@ /* Community attribute related functions. - Copyright (C) 1998, 2001 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 2001 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h index 257f7767b..cda079c13 100644 --- a/bgpd/bgp_community.h +++ b/bgpd/bgp_community.h @@ -1,22 +1,22 @@ /* Community attribute related functions. - Copyright (C) 1998 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_COMMUNITY_H #define _QUAGGA_BGP_COMMUNITY_H diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 114e641eb..dcb4519e1 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -1,22 +1,22 @@ /* BGP flap dampening - Copyright (C) 2001 IP Infusion Inc. - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2001 IP Infusion Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> #include <math.h> diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h index 030a62197..fe44d980b 100644 --- a/bgpd/bgp_damp.h +++ b/bgpd/bgp_damp.h @@ -1,22 +1,22 @@ /* BGP flap dampening - Copyright (C) 2001 IP Infusion Inc. - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2001 IP Infusion Inc. + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_DAMP_H #define _QUAGGA_BGP_DAMP_H diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 0bd74dbdc..f4722e62d 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -1,22 +1,22 @@ /* BGP-4, BGP-4+ packet debug routine - Copyright (C) 1996, 97, 99 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 99 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -383,7 +383,7 @@ bgp_debug_peer_updout_enabled(char *host) /* Dump attribute. */ int -bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) +bgp_dump_attr (struct attr *attr, char *buf, size_t size) { if (! attr) return 0; diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h index 096856822..2912eb750 100644 --- a/bgpd/bgp_debug.h +++ b/bgpd/bgp_debug.h @@ -1,22 +1,22 @@ /* BGP message debug header. - Copyright (C) 1996, 97, 98 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_DEBUG_H #define _QUAGGA_BGP_DEBUG_H @@ -138,7 +138,7 @@ struct bgp_debug_filter extern const char *bgp_type_str[]; -extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t); +extern int bgp_dump_attr (struct attr *, char *, size_t); extern int bgp_debug_peer_updout_enabled(char *host); extern const char *bgp_notify_code_str(char); extern const char *bgp_notify_subcode_str(char, char); diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 10ddf1660..bf26fddf9 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -1,22 +1,22 @@ /* BGP-4 dump routine - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -626,7 +626,7 @@ bgp_dump_parse_time (const char *str) return 0; total += time * 60; time = 0; - seen_h = 1; + seen_m = 1; } else return 0; diff --git a/bgpd/bgp_dump.h b/bgpd/bgp_dump.h index d1e66d91c..a54388fef 100644 --- a/bgpd/bgp_dump.h +++ b/bgpd/bgp_dump.h @@ -1,22 +1,22 @@ /* BGP dump routine. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_DUMP_H #define _QUAGGA_BGP_DUMP_H diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index c80966ec6..fa1ad813f 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -1,22 +1,22 @@ /* BGP Extended Communities Attribute - Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h index 356598f6b..d6006e81d 100644 --- a/bgpd/bgp_ecommunity.h +++ b/bgpd/bgp_ecommunity.h @@ -1,22 +1,22 @@ /* BGP Extended Communities Attribute. - Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ECOMMUNITY_H #define _QUAGGA_BGP_ECOMMUNITY_H diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c deleted file mode 100644 index 603979942..000000000 --- a/bgpd/bgp_encap.c +++ /dev/null @@ -1,914 +0,0 @@ - -/* - * This file created by LabN Consulting, L.L.C. - * - * - * This file is based on bgp_mplsvpn.c which is Copyright (C) 2000 - * Kunihiro Ishiguro <kunihiro@zebra.org> - * - */ - -/* - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#include <zebra.h> - -#include "command.h" -#include "prefix.h" -#include "log.h" -#include "memory.h" -#include "stream.h" -#include "filter.h" - -#include "bgpd/bgpd.h" -#include "bgpd/bgp_table.h" -#include "bgpd/bgp_route.h" -#include "bgpd/bgp_attr.h" -#include "bgpd/bgp_ecommunity.h" -#include "bgpd/bgp_lcommunity.h" -#include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_vty.h" -#include "bgpd/bgp_encap.h" - -#if ENABLE_BGP_VNC -#include "bgpd/rfapi/rfapi_backend.h" -#endif - -static void -ecom2prd(struct ecommunity *ecom, struct prefix_rd *prd) -{ - int i; - - memset(prd, 0, sizeof(struct prefix_rd)); - prd->family = AF_UNSPEC; - prd->prefixlen = 64; - - if (!ecom) - return; - - for (i = 0; i < (ecom->size * ECOMMUNITY_SIZE); i += ECOMMUNITY_SIZE) { - - uint8_t *ep; - - ep = ecom->val + i; - - switch (ep[0]) { - default: - continue; - - case 0x80: - case 0x81: - case 0x82: - if (ep[1] == 0x0) { - prd->val[1] = ep[0] & 0x03; - memcpy(prd->val + 2, ep + 2, 6); - return; - } - } - } -} - -int -bgp_nlri_parse_encap( - struct peer *peer, - struct attr *attr, - struct bgp_nlri *packet) -{ - u_char *pnt; - u_char *lim; - afi_t afi = packet->afi; - struct prefix p; - int psize = 0; - int prefixlen; - struct rd_as rd_as; - struct rd_ip rd_ip; - struct prefix_rd prd; - struct ecommunity *pEcom = NULL; - u_int16_t rdtype = 0xffff; - char buf[BUFSIZ]; - - /* Check peer status. */ - if (peer->status != Established) - return 0; - - /* Make prefix_rd */ - if (attr && attr->extra && attr->extra->ecommunity) - pEcom = attr->extra->ecommunity; - - ecom2prd(pEcom, &prd); - memset(&rd_as, 0, sizeof(rd_as)); - memset(&rd_ip, 0, sizeof(rd_ip)); - - if (pEcom) { - - rdtype = (prd.val[0] << 8) | prd.val[1]; - - /* Decode RD value. */ - if (rdtype == RD_TYPE_AS) - decode_rd_as (prd.val + 2, &rd_as); - else if (rdtype == RD_TYPE_IP) - decode_rd_ip (prd.val + 2, &rd_ip); - else if (rdtype == RD_TYPE_AS4) - decode_rd_as4 (prd.val + 2, &rd_as); - else - { - zlog_err ("Invalid RD type %d", rdtype); - } - - } - - /* - * NB: this code was based on the MPLS VPN code, which supported RDs. - * For the moment we are retaining the underlying RIB structure that - * keeps a per-RD radix tree, but since the RDs are not carried over - * the wire, we set the RD internally to 0. - */ - prd.family = AF_UNSPEC; - prd.prefixlen = 64; - memset(prd.val, 0, sizeof(prd.val)); - - pnt = packet->nlri; - lim = pnt + packet->length; - - for (; pnt < lim; pnt += psize) - { - /* Clear prefix structure. */ - memset (&p, 0, sizeof (struct prefix)); - - /* Fetch prefix length. */ - prefixlen = *pnt++; - p.family = afi2family(afi); - if (p.family == 0) { - /* bad afi, shouldn't happen */ - zlog_warn("%s: bad afi %d, dropping incoming route", __func__, afi); - continue; - } - psize = PSIZE (prefixlen); - - p.prefixlen = prefixlen; - memcpy (&p.u.prefix, pnt, psize); - - if (pnt + psize > lim) - return -1; - - - if (rdtype == RD_TYPE_AS) - zlog_info ("rd-as %u:%u prefix %s/%d", rd_as.as, rd_as.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else if (rdtype == RD_TYPE_IP) - zlog_info ("rd-ip %s:%u prefix %s/%d", inet_ntoa (rd_ip.ip), - rd_ip.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else if (rdtype == RD_TYPE_AS4) - zlog_info ("rd-as4 %u:%u prefix %s/%d", rd_as.as, rd_as.val, - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - else - zlog_info ("rd unknown, default to 0:0 prefix %s/%d", - inet_ntop (p.family, &p.u.prefix, buf, BUFSIZ), - p.prefixlen); - - if (attr) { - bgp_update (peer, &p, 0, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, 0, NULL); - } else { - bgp_withdraw (peer, &p, 0, attr, afi, SAFI_ENCAP, - ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, &prd, NULL, NULL); - } - } - - /* Packet length consistency check. */ - if (pnt != lim) - return -1; - - return 0; -} - - -/* TBD: these routes should probably all be host routes */ - -/* For testing purpose, static route of ENCAP. */ -DEFUN (encap_network, - encap_network_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", - "Specify a network to announce via BGP\n" - "IPv4 prefix\n" - "Specify Route Distinguisher\n" - "ENCAP Route Distinguisher\n" - "BGP tag\n" - "tag value\n") -{ - int idx_ipv4 = 1; - int idx_rd = 3; - int idx_word = 5; - return bgp_static_set_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, - NULL, 0, NULL, NULL, NULL, NULL); -} - -/* For testing purpose, static route of ENCAP. */ -DEFUN (no_encap_network, - no_encap_network_cmd, - "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", - NO_STR - "Specify a network to announce via BGP\n" - "IPv4 prefix\n" - "Specify Route Distinguisher\n" - "ENCAP Route Distinguisher\n" - "BGP tag\n" - "tag value\n") -{ - int idx_ipv4 = 2; - int idx_rd = 4; - int idx_word = 6; - return bgp_static_unset_safi (SAFI_ENCAP, vty, argv[idx_ipv4]->arg, argv[idx_rd]->arg, argv[idx_word]->arg, - 0, NULL, NULL, NULL); -} - -static int -show_adj_route_encap (struct vty *vty, struct peer *peer, struct prefix_rd *prd) -{ - struct bgp *bgp; - struct bgp_table *table; - struct bgp_node *rn; - struct bgp_node *rm; - struct attr *attr; - int rd_header; - int header = 1; - char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s"; - - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - - for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_ENCAP]); rn; - rn = bgp_route_next (rn)) - { - if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) - continue; - - if ((table = rn->info) != NULL) - { - rd_header = 1; - - for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) - if ((attr = rm->info) != NULL) - { - if (header) - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", - inet_ntoa (bgp->router_id), VTY_NEWLINE); - vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", - VTY_NEWLINE); - vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", - VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, v4_header, VTY_NEWLINE); - header = 0; - } - - if (rd_header) - { - u_int16_t type; - struct rd_as rd_as; - struct rd_ip rd_ip; - u_char *pnt; - - pnt = rn->p.u.val; - - vty_out (vty, "Route Distinguisher: "); - - /* Decode RD type. */ - type = decode_rd_type (pnt); - - switch (type) { - - case RD_TYPE_AS: - decode_rd_as (pnt + 2, &rd_as); - vty_out (vty, "%u:%d", rd_as.as, rd_as.val); - break; - - case RD_TYPE_IP: - decode_rd_ip (pnt + 2, &rd_ip); - vty_out (vty, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val); - break; - - default: - vty_out (vty, "unknown RD type"); - } - - - vty_out (vty, "%s", VTY_NEWLINE); - rd_header = 0; - } - route_vty_out_tmp (vty, &rm->p, attr, SAFI_ENCAP, 0, NULL); - } - } - } - return CMD_SUCCESS; -} - -int -bgp_show_encap ( - struct vty *vty, - afi_t afi, - struct prefix_rd *prd, - enum bgp_show_type type, - void *output_arg, - int tags) -{ - struct bgp *bgp; - struct bgp_table *table; - struct bgp_node *rn; - struct bgp_node *rm; - struct bgp_info *ri; - int rd_header; - int header = 1; - char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s"; - char v4_header_tag[] = " Network Next Hop In tag/Out tag%s"; - - unsigned long output_count = 0; - unsigned long total_count = 0; - - bgp = bgp_get_default (); - if (bgp == NULL) - { - vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if ((afi != AFI_IP) && (afi != AFI_IP6)) { - vty_out (vty, "Afi %d not supported%s", afi, VTY_NEWLINE); - return CMD_WARNING; - } - - for (rn = bgp_table_top (bgp->rib[afi][SAFI_ENCAP]); rn; rn = bgp_route_next (rn)) - { - if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) - continue; - - if ((table = rn->info) != NULL) - { - rd_header = 1; - - for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) - for (ri = rm->info; ri; ri = ri->next) - { - total_count++; - if (type == bgp_show_type_neighbor) - { - union sockunion *su = output_arg; - - if (ri->peer->su_remote == NULL || ! sockunion_same(ri->peer->su_remote, su)) - continue; - } - if (header) - { - if (tags) - vty_out (vty, v4_header_tag, VTY_NEWLINE); - else - { - vty_out (vty, "BGP table version is 0, local router ID is %s%s", - inet_ntoa (bgp->router_id), VTY_NEWLINE); - vty_out (vty, "Status codes: s suppressed, d damped, h history, * valid, > best, i - internal%s", - VTY_NEWLINE); - vty_out (vty, "Origin codes: i - IGP, e - EGP, ? - incomplete%s%s", - VTY_NEWLINE, VTY_NEWLINE); - vty_out (vty, v4_header, VTY_NEWLINE); - } - header = 0; - } - - if (rd_header) - { - u_int16_t type; - struct rd_as rd_as; - struct rd_ip rd_ip; - u_char *pnt; - - pnt = rn->p.u.val; - - /* Decode RD type. */ - type = decode_rd_type (pnt); - - vty_out (vty, "Route Distinguisher: "); - - switch (type) { - - case RD_TYPE_AS: - decode_rd_as (pnt + 2, &rd_as); - vty_out (vty, "%u:%d", rd_as.as, rd_as.val); - break; - - case RD_TYPE_IP: - decode_rd_ip (pnt + 2, &rd_ip); - vty_out (vty, "%s:%d", inet_ntoa (rd_ip.ip), rd_ip.val); - break; - - default: - vty_out (vty, "Unknown RD type"); - break; - } - - vty_out (vty, "%s", VTY_NEWLINE); - rd_header = 0; - } - if (tags) - route_vty_out_tag (vty, &rm->p, ri, 0, SAFI_ENCAP, NULL); - else - route_vty_out (vty, &rm->p, ri, 0, SAFI_ENCAP, NULL); - output_count++; - } - } - } - - if (output_count == 0) - { - vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE); - } - else - vty_out (vty, "%sDisplayed %ld routes and %ld total paths%s", - VTY_NEWLINE, output_count, total_count, VTY_NEWLINE); - - return CMD_SUCCESS; -} - -DEFUN (show_bgp_ipv4_encap_rd, - show_bgp_ipv4_encap_rd_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0); -} - -DEFUN (show_bgp_ipv6_encap_rd, - show_bgp_ipv6_encap_rd_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0); -} - -DEFUN (show_bgp_ipv4_encap_tags, - show_bgp_ipv4_encap_tags_cmd, - "show [ip] bgp ipv4 encap tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display BGP tags for prefixes\n") -{ - return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv6_encap_tags, - show_bgp_ipv6_encap_tags_cmd, - "show [ip] bgp ipv6 encap tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display BGP tags for prefixes\n") -{ - return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv4_encap_rd_tags, - show_bgp_ipv4_encap_rd_tags_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv6_encap_rd_tags, - show_bgp_ipv6_encap_rd_tags_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Display BGP tags for prefixes\n") -{ - int idx_rd = 5; - int ret; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1); -} - -DEFUN (show_bgp_ipv4_encap_neighbor_routes, - show_bgp_ipv4_encap_neighbor_routes_cmd, - "show [ip] bgp ipv4 encap neighbors A.B.C.D routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_peer = 0; - union sockunion *su; - struct peer *peer; - - argv_find(argv, argc, "A.B.C.D", &idx_peer); - su = sockunion_str2su (argv[idx_peer]->arg); - - if (!su) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, su, 0); -} - -DEFUN (show_bgp_ipv6_encap_neighbor_routes, - show_bgp_ipv6_encap_neighbor_routes_cmd, - "show [ip] bgp ipv6 encap neighbors A.B.C.D routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_peer = 5; - union sockunion su; - struct peer *peer; - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_neighbor, &su, 0); -} - -DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, - show_bgp_ipv4_encap_rd_neighbor_routes_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - union sockunion su; - struct peer *peer; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0); -} - -DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, - show_bgp_ipv6_encap_rd_neighbor_routes_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display routes learned from neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - union sockunion su; - struct peer *peer; - struct prefix_rd prd; - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - if (str2sockunion(argv[idx_peer]->arg, &su)) - { - vty_out (vty, "Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_neighbor, &su, 0); -} - -DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, - show_bgp_ipv4_encap_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv4 encap neighbors A.B.C.D advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_peer = 5; - int ret; - struct peer *peer; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, NULL); -} - -DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, - show_bgp_ipv6_encap_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv6 encap neighbors A.B.C.D advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_peer = 5; - int ret; - struct peer *peer; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, NULL); -} - -DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, - show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv4 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - struct peer *peer; - struct prefix_rd prd; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, &prd); -} - -DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, - show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, - "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", - SHOW_STR - IP_STR - BGP_STR - "Address Family\n" - "Display ENCAP NLRI specific information\n" - "Display information for a route distinguisher\n" - "ENCAP Route Distinguisher\n" - "Detailed information on TCP and BGP neighbor connections\n" - "Neighbor to display information about\n" - "Neighbor to display information about\n" - "Display the routes advertised to a BGP neighbor\n") -{ - int idx_rd = 5; - int idx_peer = 7; - int ret; - struct peer *peer; - struct prefix_rd prd; - union sockunion su; - - ret = str2sockunion (argv[idx_peer]->arg, &su); - if (ret < 0) - { - vty_out (vty, "%% Malformed address: %s%s", argv[idx_peer]->arg, VTY_NEWLINE); - return CMD_WARNING; - } - peer = peer_lookup (NULL, &su); - if (! peer || ! peer->afc[AFI_IP6][SAFI_ENCAP]) - { - vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = str2prefix_rd (argv[idx_rd]->arg, &prd); - if (! ret) - { - vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); - return CMD_WARNING; - } - - return show_adj_route_encap (vty, peer, &prd); -} - -void -bgp_encap_init (void) -{ - install_element (BGP_ENCAP_NODE, &encap_network_cmd); - install_element (BGP_ENCAP_NODE, &no_encap_network_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd); - - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_tags_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd); - install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd); -} diff --git a/bgpd/bgp_encap.h b/bgpd/bgp_encap.h deleted file mode 100644 index 4d57fca79..000000000 --- a/bgpd/bgp_encap.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * Copyright 2009-2015, LabN Consulting, L.L.C. - * - * - * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef _QUAGGA_BGP_ENCAP_H -#define _QUAGGA_BGP_ENCAP_H -#include "bgpd/bgp_route.h" - -extern void bgp_encap_init (void); -extern int bgp_nlri_parse_encap (struct peer *, struct attr *, struct bgp_nlri *); -extern int bgp_show_encap (struct vty *vty, afi_t afi, struct prefix_rd *prd, - enum bgp_show_type type, void *output_arg, int tags); -#include "bgp_encap_types.h" -#endif /* _QUAGGA_BGP_ENCAP_H */ diff --git a/bgpd/bgp_encap_tlv.c b/bgpd/bgp_encap_tlv.c index 7acd23b9a..eee2cb72c 100644 --- a/bgpd/bgp_encap_tlv.c +++ b/bgpd/bgp_encap_tlv.c @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_encap_tlv.h b/bgpd/bgp_encap_tlv.h index d94d544d2..487762714 100644 --- a/bgpd/bgp_encap_tlv.h +++ b/bgpd/bgp_encap_tlv.h @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_ENCAP_TLV_H diff --git a/bgpd/bgp_encap_types.h b/bgpd/bgp_encap_types.h index 04c0d2f23..ffeb2f61e 100644 --- a/bgpd/bgp_encap_types.h +++ b/bgpd/bgp_encap_types.h @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_ENCAP_TYPES_H diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 612f49f1c..c5a0ef889 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1,22 +1,22 @@ /* Ethernet-VPN Packet and vty Processing File - Copyright (C) 2016 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2016 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index 9b24bb066..95d428015 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -1,22 +1,22 @@ /* E-VPN header for packet handling - Copyright (C) 2016 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2016 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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 _QUAGGA_BGP_EVPN_H #define _QUAGGA_BGP_EVPN_H diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index c133d7ba3..e91a6d9bf 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -1,22 +1,22 @@ /* Ethernet-VPN Packet and vty Processing File - Copyright (C) 2017 6WIND - -This file is part of FRRouting - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2017 6WIND + * + * This file is part of FRRouting + * + * FRRouting 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. + * + * FRRouting 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 + */ #include <zebra.h> #include "command.h" @@ -705,7 +705,7 @@ DEFUN(evpnrt5_network, int idx_ethtag = 5; int idx_routermac = 13; int idx_rmap = 15; - return bgp_static_set_safi(SAFI_EVPN, vty, + return bgp_static_set_safi(AFI_L2VPN, SAFI_EVPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, @@ -739,7 +739,7 @@ DEFUN(no_evpnrt5_network, int idx_ethtag = 6; int idx_esi = 10; int idx_gwip = 12; - return bgp_static_unset_safi(SAFI_EVPN, vty, + return bgp_static_unset_safi(AFI_L2VPN, SAFI_EVPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, EVPN_IP_PREFIX, diff --git a/bgpd/bgp_evpn_vty.h b/bgpd/bgp_evpn_vty.h index 68b5f5cfb..fe01e84e2 100644 --- a/bgpd/bgp_evpn_vty.h +++ b/bgpd/bgp_evpn_vty.h @@ -1,22 +1,22 @@ /* EVPN VTY functions to EVPN - Copyright (C) 2017 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2017 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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_BGP_EVPN_VTY_H #define _FRR_BGP_EVPN_VTY_H diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 0de2663dd..31fc39fd2 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -1,22 +1,22 @@ /* AS path filter list. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_filter.h b/bgpd/bgp_filter.h index 03447942d..e3ce7a1c1 100644 --- a/bgpd/bgp_filter.h +++ b/bgpd/bgp_filter.h @@ -1,22 +1,22 @@ /* AS path filter list. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_FILTER_H #define _QUAGGA_BGP_FILTER_H diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 2d0349b6a..a25e0be22 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1,23 +1,23 @@ /* BGP-4 Finite State Machine - From RFC1771 [A Border Gateway Protocol 4 (BGP-4)] - Copyright (C) 1996, 97, 98 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * From RFC1771 [A Border Gateway Protocol 4 (BGP-4)] + * Copyright (C) 1996, 97, 98 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -1020,8 +1020,14 @@ bgp_stop (struct peer *peer) /* bgp log-neighbor-changes of neighbor Down */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Down %s", peer->host, - peer_down_str [(int) peer->last_reset]); + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default") : "", + peer_down_str [(int) peer->last_reset]); + } /* graceful restart */ if (peer->t_gr_stale) @@ -1458,8 +1464,13 @@ bgp_establish (struct peer *peer) /* bgp log-neighbor-changes of neighbor Up */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Up", peer->host); - + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + vrf ? ((vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default") : ""); + } /* assign update-group/subgroup */ update_group_adjust_peer_afs(peer); diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index 67ba387eb..33cba868e 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -1,23 +1,23 @@ /* BGP-4 Finite State Machine - From RFC1771 [A Border Gateway Protocol 4 (BGP-4)] - Copyright (C) 1998 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * From RFC1771 [A Border Gateway Protocol 4 (BGP-4)] + * Copyright (C) 1998 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_FSM_H #define _QUAGGA_BGP_FSM_H diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index e4186a573..0798515eb 100644 --- a/bgpd/bgp_label.c +++ b/bgpd/bgp_label.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h index 49a7b945a..dbc675dd4 100644 --- a/bgpd/bgp_label.h +++ b/bgpd/bgp_label.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _BGP_LABEL_H @@ -42,7 +41,8 @@ extern int bgp_nlri_parse_label (struct peer *peer, struct attr *attr, static inline int bgp_labeled_safi (safi_t safi) { - if ((safi == SAFI_LABELED_UNICAST) || (safi == SAFI_MPLS_VPN)) + if ((safi == SAFI_LABELED_UNICAST) || (safi == SAFI_MPLS_VPN) || + (safi == SAFI_EVPN)) return 1; return 0; } diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c index 549a2ebad..4a969c8b9 100644 --- a/bgpd/bgp_lcommunity.c +++ b/bgpd/bgp_lcommunity.c @@ -14,8 +14,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_lcommunity.h b/bgpd/bgp_lcommunity.h index de3697f47..e401c8d8f 100644 --- a/bgpd/bgp_lcommunity.h +++ b/bgpd/bgp_lcommunity.h @@ -14,8 +14,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _QUAGGA_BGP_LCOMMUNITY_H diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 3b844cf70..9fcbff0f5 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -1,22 +1,22 @@ /* Main routine of bgpd. - Copyright (C) 1996, 97, 98, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -194,7 +194,6 @@ bgp_exit (int status) /* reverse bgp_master_init */ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) bgp_delete (bgp); - list_free (bm->bgp); /* reverse bgp_dump_init */ bgp_dump_finish (); @@ -246,6 +245,7 @@ bgp_exit (int status) closezlog (); + list_delete (bm->bgp); memset (bm, 0, sizeof (*bm)); if (bgp_debug_count()) @@ -327,22 +327,15 @@ bgp_vrf_disable (struct vrf *vrf) static void bgp_vrf_init (void) { - vrf_add_hook (VRF_NEW_HOOK, bgp_vrf_new); - vrf_add_hook (VRF_ENABLE_HOOK, bgp_vrf_enable); - vrf_add_hook (VRF_DISABLE_HOOK, bgp_vrf_disable); - vrf_add_hook (VRF_DELETE_HOOK, bgp_vrf_delete); - - vrf_init (); + vrf_init (bgp_vrf_new, + bgp_vrf_enable, + bgp_vrf_disable, + bgp_vrf_delete); } static void bgp_vrf_terminate (void) { - vrf_add_hook (VRF_NEW_HOOK, NULL); - vrf_add_hook (VRF_ENABLE_HOOK, NULL); - vrf_add_hook (VRF_DISABLE_HOOK, NULL); - vrf_add_hook (VRF_DELETE_HOOK, NULL); - vrf_terminate (); } diff --git a/bgpd/bgp_memory.c b/bgpd/bgp_memory.c index 85e32645e..c457f4b3e 100644 --- a/bgpd/bgp_memory.c +++ b/bgpd/bgp_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/bgpd/bgp_memory.h b/bgpd/bgp_memory.h index 341fb235d..454092cef 100644 --- a/bgpd/bgp_memory.h +++ b/bgpd/bgp_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_BGP_MEMORY_H diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index a95c4a008..34690ac77 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 9a38b5943..316dda3ec 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_BGP_MPATH_H diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 421b62fba..73c0389b1 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1,22 +1,22 @@ /* MPLS-VPN - Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -381,31 +381,6 @@ out: return lret; } -int -str2tag (const char *str, u_char *tag) -{ - unsigned long l; - char *endptr; - u_int32_t t; - - if (*str == '-') - return 0; - - errno = 0; - l = strtoul (str, &endptr, 10); - - if (*endptr != '\0' || errno || l > UINT32_MAX) - return 0; - - t = (u_int32_t) l; - - tag[0] = (u_char)(t >> 12); - tag[1] = (u_char)(t >> 4); - tag[2] = (u_char)(t << 4); - - return 1; -} - char * prefix_rd2str (struct prefix_rd *prd, char *buf, size_t size) { @@ -460,99 +435,104 @@ prefix_rd2str (struct prefix_rd *prd, char *buf, size_t size) /* For testing purpose, static route of MPLS-VPN. */ DEFUN (vpnv4_network, vpnv4_network_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", + "network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv4_prefixlen = 1; int idx_ext_community = 3; - int idx_word = 5; - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, - argv[idx_word]->arg, NULL, 0, NULL, NULL, NULL, NULL); + int idx_label = 5; + return bgp_static_set_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, + argv[idx_label]->arg, NULL, 0, NULL, NULL, NULL, NULL); } DEFUN (vpnv4_network_route_map, vpnv4_network_route_map_cmd, - "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD", + "network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575) route-map WORD", "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n" + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n" "route map\n" "route map name\n") { int idx_ipv4_prefixlen = 1; int idx_ext_community = 3; - int idx_word = 5; + int idx_label = 5; int idx_word_2 = 7; - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, + return bgp_static_set_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); } /* For testing purpose, static route of MPLS-VPN. */ DEFUN (no_vpnv4_network, no_vpnv4_network_cmd, - "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD", + "no network A.B.C.D/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", NO_STR "Specify a network to announce via BGP\n" "IPv4 prefix\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv4_prefixlen = 2; int idx_ext_community = 4; - int idx_word = 6; - return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, - argv[idx_ext_community]->arg, argv[idx_word]->arg, + int idx_label = 6; + return bgp_static_unset_safi (AFI_IP, SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, + argv[idx_ext_community]->arg, argv[idx_label]->arg, 0, NULL, NULL, NULL); } DEFUN (vpnv6_network, vpnv6_network_cmd, - "network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD [route-map WORD]", + "network X:X::X:X/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575) [route-map WORD]", "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n" + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n" "route map\n" "route map name\n") { int idx_ipv6_prefix = 1; int idx_ext_community = 3; - int idx_word = 5; + int idx_label = 5; int idx_word_2 = 7; if (argc == 8) - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); + return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, argv[idx_word_2]->arg, 0, NULL, NULL, NULL, NULL); else - return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL, 0, NULL, NULL, NULL, NULL); + return bgp_static_set_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, NULL, 0, NULL, NULL, NULL, NULL); } /* For testing purpose, static route of MPLS-VPN. */ DEFUN (no_vpnv6_network, no_vpnv6_network_cmd, - "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD", + "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn <tag|label> (0-1048575)", NO_STR "Specify a network to announce via BGP\n" "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n" "Specify Route Distinguisher\n" "VPN Route Distinguisher\n" - "BGP tag\n" - "tag value\n") + "VPN NLRI label (tag)\n" + "VPN NLRI label (tag)\n" + "Label value\n") { int idx_ipv6_prefix = 2; int idx_ext_community = 4; - int idx_word = 6; - return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, 0, NULL, NULL, NULL); + int idx_label = 6; + return bgp_static_unset_safi (AFI_IP6, SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_label]->arg, 0, NULL, NULL, NULL); } int @@ -1196,7 +1176,6 @@ bgp_mplsvpn_init (void) install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); #ifdef KEEP_OLD_VPN_COMMANDS install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd); - install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_all_tags_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_tags_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_routes_cmd); diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 518bf6143..faae041e0 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -1,22 +1,22 @@ /* MPLS-VPN - Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org> + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_MPLSVPN_H #define _QUAGGA_BGP_MPLSVPN_H @@ -104,7 +104,6 @@ extern void decode_rd_vnc_eth (u_char *pnt, struct rd_vnc_eth *rd_vnc_eth); #endif extern int str2prefix_rd (const char *, struct prefix_rd *); -extern int str2tag (const char *, u_char *); extern char *prefix_rd2str (struct prefix_rd *, char *, size_t); extern int diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index b64d902d8..70da5e176 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -1,22 +1,22 @@ /* BGP network related fucntions - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_network.h b/bgpd/bgp_network.h index 1148d1978..56938b437 100644 --- a/bgpd/bgp_network.h +++ b/bgpd/bgp_network.h @@ -1,22 +1,22 @@ /* BGP network related header - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_NETWORK_H #define _QUAGGA_BGP_NETWORK_H diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 930034589..132b75410 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -1,22 +1,22 @@ /* BGP nexthop scan - Copyright (C) 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_nexthop.h b/bgpd/bgp_nexthop.h index 652a6813e..c5d9232e3 100644 --- a/bgpd/bgp_nexthop.h +++ b/bgpd/bgp_nexthop.h @@ -1,22 +1,22 @@ /* BGP nexthop scan - Copyright (C) 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_NEXTHOP_H #define _QUAGGA_BGP_NEXTHOP_H diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 1e8dc5d97..341bb0abb 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h index 02a7e5a45..3497dc856 100644 --- a/bgpd/bgp_nht.h +++ b/bgpd/bgp_nht.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _BGP_NHT_H diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 3ad6be1a3..cbec1a832 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -1,22 +1,22 @@ /* BGP open message handling - Copyright (C) 1998, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -266,7 +266,8 @@ static int bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr) { struct stream *s = BGP_INPUT (peer); - struct capability_orf_entry entry; + struct capability_mp_data mpc; + u_char num; iana_afi_t pkt_afi; afi_t afi; safi_t pkt_safi, safi; @@ -277,14 +278,14 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr) int i; /* ORF Entry header */ - bgp_capability_mp_data (s, &entry.mpc); - entry.num = stream_getc (s); - pkt_afi = entry.mpc.afi; - pkt_safi = entry.mpc.safi; + bgp_capability_mp_data (s, &mpc); + num = stream_getc (s); + pkt_afi = mpc.afi; + pkt_safi = mpc.safi; if (bgp_debug_neighbor_events(peer)) zlog_debug ("%s ORF Cap entry for afi/safi: %u/%u", - peer->host, entry.mpc.afi, entry.mpc.safi); + peer->host, mpc.afi, mpc.safi); /* Convert AFI, SAFI to internal values, check. */ if (bgp_map_afi_safi_iana2int (pkt_afi, pkt_safi, &afi, &safi)) @@ -295,20 +296,20 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr) return 0; } - entry.mpc.afi = pkt_afi; - entry.mpc.safi = safi; + mpc.afi = pkt_afi; + mpc.safi = safi; /* validate number field */ - if (CAPABILITY_CODE_ORF_LEN + (entry.num * 2) > hdr->length) + if (CAPABILITY_CODE_ORF_LEN + (num * 2) > hdr->length) { zlog_info ("%s ORF Capability entry length error," " Cap length %u, num %u", - peer->host, hdr->length, entry.num); + peer->host, hdr->length, num); bgp_notify_send (peer, BGP_NOTIFY_OPEN_ERR, BGP_NOTIFY_OPEN_MALFORMED_ATTR); return -1; } - for (i = 0 ; i < entry.num ; i++) + for (i = 0 ; i < num ; i++) { type = stream_getc(s); mode = stream_getc(s); diff --git a/bgpd/bgp_open.h b/bgpd/bgp_open.h index 9275b3a10..0b0d9023e 100644 --- a/bgpd/bgp_open.h +++ b/bgpd/bgp_open.h @@ -1,22 +1,22 @@ /* BGP open message handling - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_OPEN_H #define _QUAGGA_BGP_OPEN_H @@ -36,18 +36,6 @@ struct capability_mp_data safi_t safi; }; -#pragma pack(1) -struct capability_orf_entry -{ - struct capability_mp_data mpc; - u_char num; - struct { - u_char type; - u_char mode; - } orfs[]; -} __attribute__ ((packed)); -#pragma pack() - struct capability_as4 { uint32_t as4; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 0800dd74b..da6bf5c3c 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1,22 +1,22 @@ /* BGP packet management routine. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -50,8 +50,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_network.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_evpn.h" -#include "bgpd/bgp_encap.h" -#include "bgpd/bgp_evpn.h" #include "bgpd/bgp_advertise.h" #include "bgpd/bgp_vty.h" #include "bgpd/bgp_updgrp.h" @@ -1129,7 +1127,10 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) else peer->v_holdtime = send_holdtime; - peer->v_keepalive = peer->v_holdtime / 3; + if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)) + peer->v_keepalive = peer->keepalive; + else + peer->v_keepalive = peer->v_holdtime / 3; /* Open option part parse. */ if (optlen != 0) @@ -1349,8 +1350,6 @@ bgp_nlri_parse (struct peer *peer, struct attr *attr, struct bgp_nlri *packet, i return bgp_nlri_parse_label (peer, mp_withdraw?NULL:attr, packet); case SAFI_MPLS_VPN: return bgp_nlri_parse_vpn (peer, mp_withdraw?NULL:attr, packet); - case SAFI_ENCAP: - return bgp_nlri_parse_encap (peer, mp_withdraw?NULL:attr, packet); case SAFI_EVPN: return bgp_nlri_parse_evpn (peer, attr, packet, mp_withdraw); } @@ -1493,7 +1492,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size) BGP_DEBUG (update, UPDATE_IN) || BGP_DEBUG (update, UPDATE_PREFIX)) { - ret = bgp_dump_attr (peer, &attr, peer->rcvd_attr_str, BUFSIZ); + ret = bgp_dump_attr (&attr, peer->rcvd_attr_str, BUFSIZ); if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW) zlog_err ("%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.", diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index ea5c7a899..f7beaf494 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -1,22 +1,22 @@ /* BGP packet management header. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_PACKET_H #define _QUAGGA_BGP_PACKET_H diff --git a/bgpd/bgp_regex.c b/bgpd/bgp_regex.c index ea87633dc..3674a9b6d 100644 --- a/bgpd/bgp_regex.c +++ b/bgpd/bgp_regex.c @@ -1,22 +1,22 @@ /* AS regular expression routine - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_regex.h b/bgpd/bgp_regex.h index e5d28d1b7..68bff001c 100644 --- a/bgpd/bgp_regex.h +++ b/bgpd/bgp_regex.h @@ -1,22 +1,22 @@ /* AS regular expression routine - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_REGEX_H #define _QUAGGA_BGP_REGEX_H diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 24a68778d..5c18483c9 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1,23 +1,23 @@ /* BGP routing information - Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro - Copyright (C) 2016 Job Snijders <job@instituut.net> - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99 Kunihiro Ishiguro + * Copyright (C) 2016 Job Snijders <job@instituut.net> + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -54,7 +54,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_filter.h" #include "bgpd/bgp_fsm.h" #include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_encap.h" #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_advertise.h" @@ -1270,7 +1269,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri, } /* If it's labeled safi, make sure the route has a valid label. */ - if (bgp_labeled_safi(safi)) + if (safi == SAFI_LABELED_UNICAST) { u_char *tag = bgp_adv_label(rn, ri, peer, afi, safi); if (!bgp_is_valid_label(tag)) @@ -1941,9 +1940,9 @@ bgp_process_main (struct work_queue *wq, void *data) * Right now, since we only deal with per-prefix labels, it is not necessary * to do this upon changes to best path except of the label index changes. */ - bgp_table_lock (bgp_node_table (rn)); - if (bgp_labeled_safi (safi)) + if (safi == SAFI_LABELED_UNICAST) { + bgp_table_lock (bgp_node_table (rn)); if (new_select) { if (!old_select || @@ -2839,7 +2838,7 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, peer->rcvd_attr_printed = 1; } - zlog_debug ("%s rcvd %s%s ", peer->host, + zlog_debug ("%s rcvd %s %s ", peer->host, bgp_debug_rdpfxpath2str (prd, p, addpath_id ? 1 : 0, addpath_id, pfx_buf, sizeof (pfx_buf)), label_buf); } @@ -2848,7 +2847,7 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id, new = info_make(type, sub_type, 0, peer, attr_new, rn); /* Update MPLS tag. */ - if (bgp_labeled_safi(safi) || safi == SAFI_EVPN) + if (bgp_labeled_safi(safi)) memcpy ((bgp_info_extra_get (new))->tag, tag, 3); /* Update Overlay Index */ @@ -3902,10 +3901,9 @@ bgp_static_update (struct bgp *bgp, struct prefix *p, /* Nexthop reachability check. */ if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) && - safi == SAFI_UNICAST) + (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) { - if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0) && - safi == SAFI_UNICAST) + if (bgp_find_or_add_nexthop (bgp, afi, ri, NULL, 0)) bgp_info_set_flag (rn, ri, BGP_INFO_VALID); else { @@ -3943,7 +3941,8 @@ bgp_static_update (struct bgp *bgp, struct prefix *p, new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_STATIC, 0, bgp->peer_self, attr_new, rn); /* Nexthop reachability check. */ - if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) + if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK) && + (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST)) { if (bgp_find_or_add_nexthop (bgp, afi, new, NULL, 0)) bgp_info_set_flag (rn, new, BGP_INFO_VALID); @@ -4086,7 +4085,7 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, if ((safi == SAFI_EVPN) || (safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)) { - if (bgp_static->igpnexthop.s_addr) + if (afi == AFI_IP) { bgp_attr_extra_get (&attr)->mp_nexthop_global_in = bgp_static->igpnexthop; bgp_attr_extra_get (&attr)->mp_nexthop_len = IPV4_MAX_BYTELEN; @@ -4401,7 +4400,7 @@ bgp_static_add (struct bgp *bgp) for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) { - bgp_static = rn->info; + bgp_static = rm->info; bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi); } } @@ -4435,7 +4434,7 @@ bgp_static_delete (struct bgp *bgp) for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) { - bgp_static = rn->info; + bgp_static = rm->info; bgp_static_withdraw_safi (bgp, &rm->p, AFI_IP, safi, (struct prefix_rd *)&rn->p, @@ -4462,6 +4461,8 @@ bgp_static_redo_import_check (struct bgp *bgp) afi_t afi; safi_t safi; struct bgp_node *rn; + struct bgp_node *rm; + struct bgp_table *table; struct bgp_static *bgp_static; /* Use this flag to force reprocessing of the route */ @@ -4471,8 +4472,21 @@ bgp_static_redo_import_check (struct bgp *bgp) for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn)) if (rn->info != NULL) { - bgp_static = rn->info; - bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) || (safi == SAFI_EVPN)) + { + table = rn->info; + + for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) + { + bgp_static = rm->info; + bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi); + } + } + else + { + bgp_static = rn->info; + bgp_static_update (bgp, &rn->p, bgp_static, afi, safi); + } } bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS); } @@ -4525,8 +4539,8 @@ bgp_purge_static_redist_routes (struct bgp *bgp) * I think it can probably be factored with bgp_static_set. */ int -bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, +bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, + const char *rd_str, const char *label_str, const char *rmap_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag, const char *routermac) { @@ -4539,14 +4553,8 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, struct bgp_table *table; struct bgp_static *bgp_static; u_char tag[3]; - afi_t afi; struct prefix gw_ip; - if(safi == SAFI_EVPN) - afi = AFI_L2VPN; - else - afi = AFI_IP; - /* validate ip prefix */ ret = str2prefix (ip_str, &p); if (! ret) @@ -4569,18 +4577,15 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, return CMD_WARNING; } - if (tag_str) + if (label_str) { - ret = str2tag (tag_str, tag); - if (! ret) - { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; - } + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, 16777215); + encode_label (label_val, tag); } else { - encode_label (0, tag); + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } if (safi == SAFI_EVPN) { @@ -4640,8 +4645,8 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, if (rmap_str) { if (bgp_static->rmap.name) - free (bgp_static->rmap.name); - bgp_static->rmap.name = strdup (rmap_str); + XFREE(MTYPE_ROUTE_MAP_NAME, bgp_static->rmap.name); + bgp_static->rmap.name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap_str); bgp_static->rmap.map = route_map_lookup_by_name (rmap_str); } @@ -4671,8 +4676,8 @@ bgp_static_set_safi (safi_t safi, struct vty *vty, const char *ip_str, /* Configure static BGP network. */ int -bgp_static_unset_safi(safi_t safi, struct vty *vty, const char *ip_str, - const char *rd_str, const char *tag_str, +bgp_static_unset_safi(afi_t afi, safi_t safi, struct vty *vty, const char *ip_str, + const char *rd_str, const char *label_str, int evpn_type, const char *esi, const char *gwip, const char *ethtag) { VTY_DECLVAR_CONTEXT(bgp, bgp); @@ -4684,12 +4689,6 @@ bgp_static_unset_safi(safi_t safi, struct vty *vty, const char *ip_str, struct bgp_table *table; struct bgp_static *bgp_static; u_char tag[3]; - afi_t afi; - - if(safi == SAFI_EVPN) - afi = AFI_L2VPN; - else - afi = AFI_IP; /* Convert IP prefix string to struct prefix. */ ret = str2prefix (ip_str, &p); @@ -4712,11 +4711,15 @@ bgp_static_unset_safi(safi_t safi, struct vty *vty, const char *ip_str, return CMD_WARNING; } - ret = str2tag (tag_str, tag); - if (! ret) + if (label_str) { - vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE); - return CMD_WARNING; + unsigned long label_val; + VTY_GET_INTEGER_RANGE("Label/tag", label_val, label_str, 0, MPLS_LABEL_MAX); + encode_label (label_val, tag); + } + else + { + memset (tag, 0, sizeof(tag)); /* empty, not even BoS */ } prn = bgp_node_get (bgp->route[afi][safi], @@ -8055,12 +8058,6 @@ bgp_show (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, return bgp_show_mpls_vpn(vty, afi, NULL, type, output_arg, 0, use_json); } - if (safi == SAFI_ENCAP) - { - return bgp_show_encap(vty, afi, NULL, type, output_arg, - 0); - } - table = bgp->rib[afi][safi]; @@ -8074,7 +8071,6 @@ bgp_show_all_instances_routes_vty (struct vty *vty, afi_t afi, safi_t safi, { struct listnode *node, *nnode; struct bgp *bgp; - struct bgp_table *table; int is_first = 1; if (use_json) @@ -8100,9 +8096,7 @@ bgp_show_all_instances_routes_vty (struct vty *vty, afi_t afi, safi_t safi, ? "Default" : bgp->name, VTY_NEWLINE); } - table = bgp->rib[afi][safi]; - bgp_show_table (vty, bgp, table, - bgp_show_type_normal, NULL, use_json); + bgp_show (vty, bgp, afi, safi, bgp_show_type_normal, NULL, use_json); } @@ -8444,7 +8438,7 @@ bgp_show_lcommunity_list (struct vty *vty, struct bgp *bgp, const char *lcom, DEFUN (show_ip_bgp_large_community_list, show_ip_bgp_large_community_list_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] large-community-list <(1-500)|WORD> [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] large-community-list <(1-500)|WORD> [json]", SHOW_STR IP_STR BGP_STR @@ -8455,7 +8449,6 @@ DEFUN (show_ip_bgp_large_community_list, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-community-list\n" "large-community-list number\n" "large-community-list name\n" @@ -8491,7 +8484,7 @@ DEFUN (show_ip_bgp_large_community_list, } DEFUN (show_ip_bgp_large_community, show_ip_bgp_large_community_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] large-community [AA:BB:CC] [json]", + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] large-community [AA:BB:CC] [json]", SHOW_STR IP_STR BGP_STR @@ -8502,7 +8495,6 @@ DEFUN (show_ip_bgp_large_community, "Address Family modifier\n" "Address Family modifier\n" "Address Family modifier\n" - "Address Family modifier\n" "Display routes matching the large-communities\n" "List of large-community numbers\n" JSON_STR) @@ -8654,12 +8646,10 @@ DEFUN (show_ip_bgp, } /* prefix-longer */ if (argv_find(argv, argc, "A.B.C.D/M", &idx) || argv_find(argv, argc, "X:X::X:X/M", &idx)) - return bgp_show_prefix_longer (vty, bgp, argv[idx + 1]->arg, afi, safi, bgp_show_type_prefix_longer); + return bgp_show_prefix_longer (vty, bgp, argv[idx]->arg, afi, safi, bgp_show_type_prefix_longer); if (safi == SAFI_MPLS_VPN) return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, uj); - else if (safi == SAFI_ENCAP) - return bgp_show_encap (vty, afi, NULL, bgp_show_type_normal, NULL, 0); else return bgp_show (vty, bgp, afi, safi, sh_type, NULL, uj); } @@ -8872,6 +8862,7 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc, int i; char *str; int first = 0; + int ret = 0; b = buffer_new (1024); for (i = 0; i < argc; i++) @@ -8900,9 +8891,12 @@ bgp_show_community (struct vty *vty, struct bgp *bgp, int argc, return CMD_WARNING; } - return bgp_show (vty, bgp, afi, safi, - (exact ? bgp_show_type_community_exact : - bgp_show_type_community), com, 0); + ret = bgp_show (vty, bgp, afi, safi, + (exact ? bgp_show_type_community_exact : + bgp_show_type_community), com, 0); + community_free (com); + + return ret; } static int @@ -9443,7 +9437,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] " + "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] " "neighbors <A.B.C.D|X:X::X:X|WORD> prefix-counts [json]", SHOW_STR IP_STR @@ -10664,10 +10658,19 @@ bgp_config_write_network_vpn (struct vty *vty, struct bgp *bgp, prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN); label = decode_label (bgp_static->tag); - vty_out (vty, " network %s/%d rd %s tag %d", + vty_out (vty, " network %s/%d rd %s", inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), - p->prefixlen, - rdbuf, label); + p->prefixlen, rdbuf); + if (safi == SAFI_MPLS_VPN) + vty_out (vty, " label %u", label); + + if (bgp_static->rmap.name) + vty_out (vty, " route-map %s", bgp_static->rmap.name); + else + { + if (bgp_static->backdoor) + vty_out (vty, " backdoor"); + } vty_out (vty, "%s", VTY_NEWLINE); } return 0; diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h index 9db84b2ca..3d179e07b 100644 --- a/bgpd/bgp_route.h +++ b/bgpd/bgp_route.h @@ -1,22 +1,22 @@ /* BGP routing information base - Copyright (C) 1996, 97, 98, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ROUTE_H #define _QUAGGA_BGP_ROUTE_H @@ -333,11 +333,11 @@ extern void bgp_static_update (struct bgp *, struct prefix *, struct bgp_static afi_t, safi_t); extern void bgp_static_withdraw (struct bgp *, struct prefix *, afi_t, safi_t); -extern int bgp_static_set_safi (safi_t safi, struct vty *vty, const char *, +extern int bgp_static_set_safi (afi_t afi, safi_t safi, struct vty *vty, const char *, const char *, const char *, const char *, int, const char *, const char *, const char *, const char *); -extern int bgp_static_unset_safi (safi_t safi, struct vty *, const char *, +extern int bgp_static_unset_safi (afi_t afi, safi_t safi, struct vty *, const char *, const char *, const char *, int, const char *, const char *, const char *); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 4563ec85f..570fcc1a3 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1,22 +1,22 @@ /* Route map function of bgpd. - Copyright (C) 1998, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index f45d68384..db69400a6 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -1,22 +1,22 @@ /* BGP4 SNMP support - Copyright (C) 1999, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 06e443b25..ff0cfdd65 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -1,22 +1,22 @@ /* BGP routing table - Copyright (C) 1998, 2001 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 2001 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index a6b99a53d..cff270ebb 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -1,22 +1,22 @@ /* BGP routing table - Copyright (C) 1998, 2001 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 2001 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_TABLE_H #define _QUAGGA_BGP_TABLE_H diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 09089a3b3..04d262050 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -19,10 +19,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index 8f3e27bc8..87b85adae 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -19,10 +19,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_BGP_UPDGRP_H diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 3ed295825..c6a160632 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -21,10 +21,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 459cf707d..7a45cddca 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -19,10 +19,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -429,21 +428,33 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) nhafi = BGP_NEXTHOP_AFI_FROM_NHLEN(nhlen); if (peer_cap_enhe(peer, paf->afi, paf->safi)) nhafi = AFI_IP6; - if (paf->safi == SAFI_MPLS_VPN && /* if VPN && not global */ - nhlen != BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) - nhafi = AFI_MAX; /* no change allowed */ } if (nhafi == AFI_IP) { struct in_addr v4nh, *mod_v4nh; int nh_modified = 0; + size_t offset_nh = vec->offset + 1; route_map_sets_nh = (CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_IPV4_NH_CHANGED) || CHECK_FLAG (vec->flags, BPKT_ATTRVEC_FLAGS_RMAP_NH_PEER_ADDRESS)); - stream_get_from (&v4nh, s, vec->offset + 1, 4); + switch (nhlen) + { + case BGP_ATTR_NHLEN_IPV4: + break; + case BGP_ATTR_NHLEN_VPNV4: + offset_nh += 8; + break; + default: + /* TODO: handle IPv6 nexthops */ + zlog_warn ("%s: %s: invalid MP nexthop length (AFI IP): %u", + __func__, peer->host, nhlen); + return NULL; + } + + stream_get_from (&v4nh, s, offset_nh, IPV4_MAX_BYTELEN); mod_v4nh = &v4nh; /* @@ -484,7 +495,7 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } if (nh_modified) /* allow for VPN RD */ - stream_put_in_addr_at (s, vec->offset + 1 + nhlen - 4, mod_v4nh); + stream_put_in_addr_at (s, offset_nh, mod_v4nh); if (bgp_debug_update(peer, NULL, NULL, 0)) zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s%s", @@ -497,6 +508,8 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) struct in6_addr v6nhglobal, *mod_v6nhg; struct in6_addr v6nhlocal, *mod_v6nhl; int gnh_modified, lnh_modified; + size_t offset_nhglobal = vec->offset + 1; + size_t offset_nhlocal = vec->offset + 1; gnh_modified = lnh_modified = 0; mod_v6nhg = &v6nhglobal; @@ -511,7 +524,28 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) * additional work being to handle 1 or 2 nexthops. Also, 3rd * party nexthop is not propagated for EBGP right now. */ - stream_get_from (&v6nhglobal, s, vec->offset + 1, 16); + switch (nhlen) + { + case BGP_ATTR_NHLEN_IPV6_GLOBAL: + break; + case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL: + offset_nhlocal += IPV6_MAX_BYTELEN; + break; + case BGP_ATTR_NHLEN_VPNV6_GLOBAL: + offset_nhglobal += 8; + break; + case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL: + offset_nhglobal += 8; + offset_nhlocal += 8 * 2 + IPV6_MAX_BYTELEN; + break; + default: + /* TODO: handle IPv4 nexthops */ + zlog_warn ("%s: %s: invalid MP nexthop length (AFI IP6): %u", + __func__, peer->host, nhlen); + return NULL; + } + + stream_get_from (&v6nhglobal, s, offset_nhglobal, IPV6_MAX_BYTELEN); if (route_map_sets_nh) { if (CHECK_FLAG(vec->flags, @@ -538,9 +572,10 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } - if (nhlen == 32 || nhlen == 48) /* 48 == VPN */ + if (nhlen == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL || + nhlen == BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) { - stream_get_from (&v6nhlocal, s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), IPV6_MAX_BYTELEN); + stream_get_from (&v6nhlocal, s, offset_nhlocal, IPV6_MAX_BYTELEN); if (IN6_IS_ADDR_UNSPECIFIED (&v6nhlocal)) { mod_v6nhl = &peer->nexthop.v6_local; @@ -549,9 +584,9 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) } if (gnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1, mod_v6nhg); + stream_put_in6_addr_at (s, offset_nhglobal, mod_v6nhg); if (lnh_modified) - stream_put_in6_addr_at (s, vec->offset + 1 + (nhlen-IPV6_MAX_BYTELEN), mod_v6nhl); + stream_put_in6_addr_at (s, offset_nhlocal, mod_v6nhl); if (bgp_debug_update(peer, NULL, NULL, 0)) { @@ -749,7 +784,7 @@ subgroup_update_packet (struct update_subgroup *subgrp) { memset (send_attr_str, 0, BUFSIZ); send_attr_printed = 0; - bgp_dump_attr (peer, adv->baa->attr, send_attr_str, BUFSIZ); + bgp_dump_attr (adv->baa->attr, send_attr_str, BUFSIZ); } } @@ -763,14 +798,18 @@ subgroup_update_packet (struct update_subgroup *subgrp) if (rn->prn) prd = (struct prefix_rd *) &rn->prn->p; - tag = bgp_adv_label(rn, binfo, peer, afi, safi); + + if (safi == SAFI_LABELED_UNICAST) + tag = bgp_adv_label(rn, binfo, peer, afi, safi); + else + if (binfo && binfo->extra) + tag = binfo->extra->tag; + if (bgp_labeled_safi(safi)) sprintf (label_buf, "label %u", label_pton(tag)); if (stream_empty (snlri)) - mpattrlen_pos = bgp_packet_mpattr_start (snlri, afi, safi, - (peer_cap_enhe(peer, afi, safi) ? AFI_IP6 : - AFI_MAX), /* get from NH */ + mpattrlen_pos = bgp_packet_mpattr_start (snlri, peer, afi, safi, &vecarr, adv->baa->attr); bgp_packet_mpattr_prefix (snlri, afi, safi, &rn->p, prd, @@ -1043,7 +1082,7 @@ subgroup_default_update_packet (struct update_subgroup *subgrp, char tx_id_buf[30]; attrstr[0] = '\0'; - bgp_dump_attr (peer, attr, attrstr, BUFSIZ); + bgp_dump_attr (attr, attrstr, BUFSIZ); bgp_info_addpath_tx_str (addpath_encode, BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE, tx_id_buf); zlog_debug ("u%" PRIu64 ":s%" PRIu64 " send UPDATE %s%s %s", (SUBGRP_UPDGRP (subgrp))->id, subgrp->id, diff --git a/bgpd/bgp_vnc_types.h b/bgpd/bgp_vnc_types.h index 8bc9cb640..e97a47e1a 100644 --- a/bgpd/bgp_vnc_types.h +++ b/bgpd/bgp_vnc_types.h @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_VNC_TYPES_H diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c index 5b1b1b85b..e99161d40 100644 --- a/bgpd/bgp_vpn.c +++ b/bgpd/bgp_vpn.c @@ -1,22 +1,22 @@ /* VPN Related functions - Copyright (C) 2017 6WIND - -This file is part of FRRouting - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2017 6WIND + * + * This file is part of FRRouting + * + * FRRouting 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. + * + * FRRouting 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 + */ #include <zebra.h> #include "command.h" diff --git a/bgpd/bgp_vpn.h b/bgpd/bgp_vpn.h index dd53503bf..fcccd45c7 100644 --- a/bgpd/bgp_vpn.h +++ b/bgpd/bgp_vpn.h @@ -1,22 +1,22 @@ /* VPN common functions to MP-BGP - Copyright (C) 2017 6WIND - -This file is part of FRRouting. - -FRRouting 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. - -FRRouting 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 FRRouting; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2017 6WIND + * + * This file is part of FRRouting. + * + * FRRouting 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. + * + * FRRouting 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_BGP_VPN_H #define _FRR_BGP_VPN_H diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4d983c387..c2942b50d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1,22 +1,22 @@ /* BGP VTY interface. - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -60,16 +60,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA static struct peer_group * listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); -#if 0 -#define INSTALL_CMD_ON_AF_NODES(cmd) \ - install_element(BGP_IPV4_NODE, cmd); \ - install_element(BGP_IPV4M_NODE, cmd); \ - install_element(BGP_IPV4L_NODE, cmd); \ - install_element(BGP_IPV6_NODE, cmd); \ - install_element(BGP_IPV6M_NODE, cmd); \ - install_element(BGP_IPV6L_NODE, cmd); \ - install_element(BGP_VPNV4_NODE, cmd); -#endif + static enum node_type bgp_node_type (afi_t afi, safi_t safi) { @@ -90,9 +81,6 @@ bgp_node_type (afi_t afi, safi_t safi) case SAFI_MPLS_VPN: return BGP_VPNV4_NODE; break; - case SAFI_ENCAP: - return BGP_ENCAP_NODE; - break; } break; case AFI_IP6: @@ -110,9 +98,6 @@ bgp_node_type (afi_t afi, safi_t safi) case SAFI_MPLS_VPN: return BGP_VPNV6_NODE; break; - case SAFI_ENCAP: - return BGP_ENCAP_NODE; - break; } break; case AFI_L2VPN: @@ -139,7 +124,6 @@ bgp_node_afi (struct vty *vty) case BGP_IPV6M_NODE: case BGP_IPV6L_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAPV6_NODE: afi = AFI_IP6; break; case BGP_EVPN_NODE: @@ -160,10 +144,6 @@ bgp_node_safi (struct vty *vty) safi_t safi; switch (vty->node) { - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: - safi = SAFI_ENCAP; - break; case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: safi = SAFI_MPLS_VPN; @@ -232,7 +212,7 @@ argv_find_and_parse_afi(struct cmd_token **argv, int argc, int *index, afi_t *af return ret; } -/* supports <unicast|multicast|vpn|encap|labeled-unicast> */ +/* supports <unicast|multicast|vpn|labeled-unicast> */ safi_t bgp_vty_safi_from_arg(const char *safi_str) { @@ -241,8 +221,6 @@ bgp_vty_safi_from_arg(const char *safi_str) safi = SAFI_MULTICAST; else if (strncmp (safi_str, "u", 1) == 0) safi = SAFI_UNICAST; - else if (strncmp (safi_str, "e", 1) == 0) - safi = SAFI_ENCAP; else if (strncmp (safi_str, "v", 1) == 0) safi = SAFI_MPLS_VPN; else if (strncmp (safi_str, "l", 1) == 0) @@ -278,12 +256,6 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t if (safi) *safi = SAFI_MPLS_VPN; } - else if (argv_find (argv, argc, "encap", index)) - { - ret = 1; - if (safi) - *safi = SAFI_ENCAP; - } else if (argv_find (argv, argc, "evpn", index)) { ret = 1; @@ -303,12 +275,12 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t * that is being parsed. * * The show commands are generally of the form: - * "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] ..." + * "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] ..." * * Since we use argv_find if the show command in particular doesn't have: * [ip] * [<view|vrf> WORD] - * [<ipv4|ipv6> [<unicast|multicast|vpn|encap|labeled-unicast>]] + * [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] * The command parsing should still be ok. * * vty -> The vty for the command so we can output some useful data in @@ -2821,7 +2793,12 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, } peer = peer_lookup_by_conf_if (bgp, conf_if); - if (!peer) + if (peer) + { + if (as_str) + ret = peer_remote_as (bgp, &su, conf_if, &as, as_type, afi, safi); + } + else { if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) && afi == AFI_IP && safi == SAFI_UNICAST) @@ -2831,7 +2808,10 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, NULL); - if (peer && v6only) + if (!peer) + return CMD_WARNING; + + if (v6only) SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); /* Request zebra to initiate IPv6 RAs on this interface. We do this @@ -2840,13 +2820,11 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, * gets deleted later etc.) */ if (peer->ifp) - { - bgp_zebra_initiate_radv (bgp, peer); - } - peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); + bgp_zebra_initiate_radv (bgp, peer); } - else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || - (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) + + if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || + (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) { if (v6only) SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); @@ -2864,8 +2842,8 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, bgp_session_reset(peer); } - if (!peer) - return CMD_WARNING; + if (!CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); if (peer_group_name) { @@ -6348,7 +6326,7 @@ ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as, DEFUN_NOSH (address_family_ipv4_safi, address_family_ipv4_safi_cmd, - "address-family ipv4 [<unicast|multicast|vpn|encap|labeled-unicast>]", + "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast>]", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -6367,7 +6345,7 @@ DEFUN_NOSH (address_family_ipv4_safi, DEFUN_NOSH (address_family_ipv6_safi, address_family_ipv6_safi_cmd, - "address-family ipv6 [<unicast|multicast|vpn|encap|labeled-unicast>]", + "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast>]", "Enter Address Family command mode\n" "Address Family\n" BGP_SAFI_HELP_STR) @@ -6407,28 +6385,6 @@ DEFUN_NOSH (address_family_vpnv6, } #endif -DEFUN_NOSH (address_family_encap, - address_family_encap_cmd, - "address-family <encap|encapv4>", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAP_NODE; - return CMD_SUCCESS; -} - - -DEFUN_NOSH (address_family_encapv6, - address_family_encapv6_cmd, - "address-family encapv6", - "Enter Address Family command mode\n" - "Address Family\n") -{ - vty->node = BGP_ENCAPV6_NODE; - return CMD_SUCCESS; -} - DEFUN_NOSH (address_family_evpn, address_family_evpn_cmd, "address-family <l2vpn evpn>", @@ -6454,8 +6410,6 @@ DEFUN_NOSH (exit_address_family, || vty->node == BGP_IPV6M_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_VPNV6_NODE - || vty->node == BGP_ENCAP_NODE - || vty->node == BGP_ENCAPV6_NODE || vty->node == BGP_EVPN_NODE) vty->node = BGP_NODE; return CMD_SUCCESS; @@ -8115,6 +8069,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js u_int16_t i; u_char *msg; json_object *json_neigh = NULL; + time_t epoch_tbuf; bgp = p->bgp; @@ -8304,8 +8259,11 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js uptime = bgp_clock(); uptime -= p->uptime; tm = gmtime(&uptime); + epoch_tbuf = time(NULL) - uptime; json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); + json_object_string_add(json_neigh, "bgpTimerUpString", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); + json_object_int_add(json_neigh, "bgpTimerUpEstablishedEpoch", epoch_tbuf); } else if (p->status == Active) @@ -9236,6 +9194,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); } + if (p->password) + json_object_int_add(json_neigh, "authenticationEnabled", 1); if (p->t_read) json_object_string_add(json_neigh, "readThread", "on"); @@ -9263,6 +9223,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", p->v_routeadv, thread_timer_remain_second (p->t_routeadv), VTY_NEWLINE); + if (p->password) + vty_out (vty, "Peer Authentication Enabled%s", VTY_NEWLINE); vty_out (vty, "Read thread: %s Write thread: %s%s", p->t_read ? "on" : "off", @@ -10898,20 +10860,6 @@ static struct cmd_node bgp_vpnv6_node = 1 }; -static struct cmd_node bgp_encap_node = -{ - BGP_ENCAP_NODE, - "%s(config-router-af-encap)# ", - 1 -}; - -static struct cmd_node bgp_encapv6_node = -{ - BGP_ENCAPV6_NODE, - "%s(config-router-af-encapv6)# ", - 1 -}; - static struct cmd_node bgp_evpn_node = { BGP_EVPN_NODE, @@ -10921,9 +10869,62 @@ static struct cmd_node bgp_evpn_node = static void community_list_vty (void); +static void +bgp_ac_neighbor (vector comps, struct cmd_token *token) +{ + struct bgp *bgp; + struct peer *peer; + struct peer_group *group; + struct listnode *lnbgp, *lnpeer; + + for (ALL_LIST_ELEMENTS_RO (bm->bgp, lnbgp, bgp)) + { + for (ALL_LIST_ELEMENTS_RO (bgp->peer, lnpeer, peer)) + { + /* only provide suggestions on the appropriate input token type, + * they'll otherwise show up multiple times */ + enum cmd_token_type match_type; + char *name = peer->host; + + if (peer->conf_if) + { + match_type = VARIABLE_TKN; + name = peer->conf_if; + } + else if (strchr(peer->host, ':')) + match_type = IPV6_TKN; + else + match_type = IPV4_TKN; + + if (token->type != match_type) + continue; + + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, name)); + } + + if (token->type == VARIABLE_TKN) + for (ALL_LIST_ELEMENTS_RO (bgp->group, lnpeer, group)) + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, group->name)); + } +} + +static const struct cmd_variable_handler bgp_var_neighbor[] = { + { + .varname = "neighbor", + .completions = bgp_ac_neighbor + }, { + .varname = "neighbors", + .completions = bgp_ac_neighbor + }, { + .completions = NULL + } +}; + void bgp_vty_init (void) { + cmd_variable_handler_register(bgp_var_neighbor); + /* Install bgp top node. */ install_node (&bgp_node, bgp_config_write); install_node (&bgp_ipv4_unicast_node, NULL); @@ -10934,8 +10935,6 @@ bgp_vty_init (void) install_node (&bgp_ipv6_labeled_unicast_node, NULL); install_node (&bgp_vpnv4_node, NULL); install_node (&bgp_vpnv6_node, NULL); - install_node (&bgp_encap_node, NULL); - install_node (&bgp_encapv6_node, NULL); install_node (&bgp_evpn_node, NULL); /* Install default VTY commands to new nodes. */ @@ -10948,8 +10947,6 @@ bgp_vty_init (void) install_default (BGP_IPV6L_NODE); install_default (BGP_VPNV4_NODE); install_default (BGP_VPNV6_NODE); - install_default (BGP_ENCAP_NODE); - install_default (BGP_ENCAPV6_NODE); install_default (BGP_EVPN_NODE); /* "bgp multiple-instance" commands. */ @@ -11176,8 +11173,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &neighbor_activate_cmd); install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); install_element (BGP_EVPN_NODE, &neighbor_activate_cmd); /* "no neighbor activate" commands. */ @@ -11190,8 +11185,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &no_neighbor_activate_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); install_element (BGP_EVPN_NODE, &no_neighbor_activate_cmd); /* "neighbor peer-group" set commands. */ @@ -11204,8 +11197,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_hidden_cmd); /* "no neighbor peer-group unset" commands. */ install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); @@ -11217,8 +11208,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &no_neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_hidden_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_hidden_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_hidden_cmd); /* "neighbor softreconfiguration inbound" commands.*/ install_element (BGP_NODE, &neighbor_soft_reconfiguration_hidden_cmd); @@ -11239,10 +11228,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); /* "neighbor attribute-unchanged" commands. */ install_element (BGP_NODE, &neighbor_attr_unchanged_hidden_cmd); @@ -11264,12 +11249,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); - - install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); - install_element (BGP_EVPN_NODE, &neighbor_attr_unchanged_cmd); install_element (BGP_EVPN_NODE, &no_neighbor_attr_unchanged_cmd); @@ -11296,10 +11275,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); /* "neighbor next-hop-self force" commands. */ install_element (BGP_NODE, &neighbor_nexthop_self_force_hidden_cmd); @@ -11414,10 +11389,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); /* "neighbor send-community" commands.*/ install_element (BGP_NODE, &neighbor_send_community_hidden_cmd); @@ -11456,14 +11427,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); /* "neighbor route-reflector" commands.*/ install_element (BGP_NODE, &neighbor_route_reflector_client_hidden_cmd); @@ -11484,10 +11447,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); /* "neighbor route-server" commands.*/ install_element (BGP_NODE, &neighbor_route_server_client_hidden_cmd); @@ -11508,10 +11467,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); /* "neighbor addpath-tx-all-paths" commands.*/ install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_hidden_cmd); @@ -11656,10 +11611,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_weight_cmd); install_element (BGP_VPNV6_NODE, &neighbor_weight_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_weight_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_weight_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_weight_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_weight_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_weight_cmd); /* "neighbor override-capability" commands. */ install_element (BGP_NODE, &neighbor_override_capability_cmd); @@ -11704,10 +11655,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); /* "neighbor prefix-list" commands. */ install_element (BGP_NODE, &neighbor_prefix_list_hidden_cmd); @@ -11728,10 +11675,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); /* "neighbor filter-list" commands. */ install_element (BGP_NODE, &neighbor_filter_list_hidden_cmd); @@ -11752,10 +11695,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); /* "neighbor route-map" commands. */ install_element (BGP_NODE, &neighbor_route_map_hidden_cmd); @@ -11776,10 +11715,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); /* "neighbor unsuppress-map" commands. */ install_element (BGP_NODE, &neighbor_unsuppress_map_hidden_cmd); @@ -11800,10 +11735,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); /* "neighbor maximum-prefix" commands. */ install_element (BGP_NODE, &neighbor_maximum_prefix_hidden_cmd); @@ -11870,22 +11801,6 @@ bgp_vty_init (void) install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); - - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); - /* "neighbor allowas-in" */ install_element (BGP_NODE, &neighbor_allowas_in_hidden_cmd); install_element (BGP_NODE, &no_neighbor_allowas_in_hidden_cmd); @@ -11905,10 +11820,6 @@ bgp_vty_init (void) install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); - install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); - install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); /* address-family commands. */ install_element (BGP_NODE, &address_family_ipv4_safi_cmd); @@ -11918,9 +11829,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &address_family_vpnv6_cmd); #endif /* KEEP_OLD_VPN_COMMANDS */ - install_element (BGP_NODE, &address_family_encap_cmd); - install_element (BGP_NODE, &address_family_encapv6_cmd); - install_element (BGP_NODE, &address_family_evpn_cmd); /* "exit-address-family" command. */ @@ -11932,8 +11840,6 @@ bgp_vty_init (void) install_element (BGP_IPV6L_NODE, &exit_address_family_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); install_element (BGP_EVPN_NODE, &exit_address_family_cmd); /* "clear ip bgp commands" */ diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index a0aabcbd2..1bb9cfb71 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -1,22 +1,22 @@ /* BGP VTY interface. - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_VTY_H #define _QUAGGA_BGP_VTY_H @@ -28,13 +28,11 @@ struct bgp; #define BGP_AFI_CMD_STR "<ipv4|ipv6>" #define BGP_AFI_HELP_STR "Address Family\nAddress Family\n" -#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn|encap|labeled-unicast>" +#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn|labeled-unicast>" #define BGP_SAFI_HELP_STR \ "Address Family modifier\n" \ "Address Family modifier\n" \ "Address Family modifier\n" \ - "Address Family modifier\n" \ - "Address Family modifier\n" \ "Address Family modifier\n" #define BGP_AFI_SAFI_CMD_STR BGP_AFI_CMD_STR" "BGP_SAFI_CMD_STR #define BGP_AFI_SAFI_HELP_STR BGP_AFI_HELP_STR BGP_SAFI_HELP_STR diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index d76eb951d..4fff339b8 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1,22 +1,22 @@ /* zebra client - Copyright (C) 1997, 98, 99 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h index bc4e36352..6a36fb84f 100644 --- a/bgpd/bgp_zebra.h +++ b/bgpd/bgp_zebra.h @@ -1,22 +1,22 @@ /* zebra connection and redistribute fucntions. - Copyright (C) 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGP_ZEBRA_H #define _QUAGGA_BGP_ZEBRA_H diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 2c04f7947..92a0cd6ac 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1,22 +1,22 @@ /* BGP-4, BGP-4+ daemon program - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -61,7 +61,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_mplsvpn.h" -#include "bgpd/bgp_encap.h" #if ENABLE_BGP_VNC #include "bgpd/rfapi/bgp_rfapi_cfg.h" #include "bgpd/rfapi/rfapi_backend.h" @@ -94,7 +93,6 @@ struct community_list_handler *bgp_clist; unsigned int multipath_num = MULTIPATH_NUM; -static void bgp_if_init (struct bgp *bgp); static void bgp_if_finish (struct bgp *bgp); extern struct zclient *zclient; @@ -2701,7 +2699,7 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, struct peer *peer, * Capability extended-nexthop is enabled for an interface neighbor by * default. So, fix that up here. */ - if (peer->ifp && cap_enhe_preset) + if (peer->conf_if && cap_enhe_preset) peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); for (afi = AFI_IP; afi < AFI_MAX; afi++) @@ -3115,10 +3113,7 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name, vrf = bgp_vrf_lookup_by_instance_type (bgp); if (vrf) - { - bgp_vrf_link (bgp, vrf); - bgp_if_init (bgp); - } + bgp_vrf_link (bgp, vrf); } /* Register with Zebra, if needed */ @@ -6354,7 +6349,7 @@ peer_clear_soft (struct peer *peer, afi_t afi, safi_t safi, char * peer_uptime (time_t uptime2, char *buf, size_t len, u_char use_json, json_object *json) { - time_t uptime1; + time_t uptime1, epoch_tbuf; struct tm *tm; /* Check buffer length. */ @@ -6408,8 +6403,10 @@ peer_uptime (time_t uptime2, char *buf, size_t len, u_char use_json, json_object if (use_json) { + epoch_tbuf = time(NULL) - uptime1; json_object_string_add(json, "peerUptime", buf); json_object_long_add(json, "peerUptimeMsec", uptime1 * 1000); + json_object_int_add(json, "peerUptimeEstablishedEpoch", epoch_tbuf); } return buf; @@ -7655,19 +7652,6 @@ bgp_master_init (struct thread_master *master) } /* - * Initialize interface list for instance, if needed. Invoked upon - * instance create. - */ -static void -bgp_if_init (struct bgp *bgp) -{ - if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) - return; - - vrf_iflist_create (bgp->vrf_id); -} - -/* * Free up connected routes and interfaces for a BGP instance. Invoked upon * instance delete (non-default only) or BGP exit. */ @@ -7716,7 +7700,6 @@ bgp_init (void) bgp_route_map_init (); bgp_scan_vty_init(); bgp_mplsvpn_init (); - bgp_encap_init (); #if ENABLE_BGP_VNC rfapi_init (); #endif diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 66ec8ccc8..84dcb7e1d 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1,22 +1,22 @@ /* BGP message definition header. - Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _QUAGGA_BGPD_H #define _QUAGGA_BGPD_H diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 4f4656590..6002046bc 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ #include "lib/zebra.h" @@ -291,10 +290,9 @@ bgp_rfapi_is_vnc_configured (struct bgp *bgp) DEFUN (vnc_advertise_un_method, vnc_advertise_un_method_cmd, - "vnc advertise-un-method <encap-safi|encap-attr>", + "vnc advertise-un-method encap-attr", VNC_CONFIG_STR "Method of advertising UN addresses\n" - "Via Encapsulation SAFI\n" "Via Tunnel Encap attribute (in VPN SAFI)\n") { VTY_DECLVAR_CONTEXT(bgp, bgp); diff --git a/bgpd/rfapi/bgp_rfapi_cfg.h b/bgpd/rfapi/bgp_rfapi_cfg.h index 8f93d69f6..44abbe222 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.h +++ b/bgpd/rfapi/bgp_rfapi_cfg.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_CFG_H diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 99d26cf13..69fae2ae4 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ @@ -1198,6 +1197,7 @@ add_vnc_route ( bgp, prd, table, p, new); } bgp_unlock_node (prn); + encode_label (label_val, bn->local_label); } bgp_unlock_node (bn); diff --git a/bgpd/rfapi/rfapi.h b/bgpd/rfapi/rfapi.h index 420c6e0d7..11d41c9d1 100644 --- a/bgpd/rfapi/rfapi.h +++ b/bgpd/rfapi/rfapi.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_H diff --git a/bgpd/rfapi/rfapi_ap.c b/bgpd/rfapi/rfapi_ap.c index 68292c26b..fac28cd74 100644 --- a/bgpd/rfapi/rfapi_ap.c +++ b/bgpd/rfapi/rfapi_ap.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ #include <errno.h> diff --git a/bgpd/rfapi/rfapi_ap.h b/bgpd/rfapi/rfapi_ap.h index 8a59f0527..c875a52e5 100644 --- a/bgpd/rfapi/rfapi_ap.h +++ b/bgpd/rfapi/rfapi_ap.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_AP_H #define _QUAGGA_BGP_RFAPI_AP_H diff --git a/bgpd/rfapi/rfapi_backend.h b/bgpd/rfapi/rfapi_backend.h index 9e5b0dc5c..a2537bd91 100644 --- a/bgpd/rfapi/rfapi_backend.h +++ b/bgpd/rfapi/rfapi_backend.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_BACKEND_H diff --git a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c index 8106186d9..d05b27128 100644 --- a/bgpd/rfapi/rfapi_descriptor_rfp_utils.c +++ b/bgpd/rfapi/rfapi_descriptor_rfp_utils.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfapi/rfapi_descriptor_rfp_utils.h b/bgpd/rfapi/rfapi_descriptor_rfp_utils.h index 9067cdf54..04fbfbcec 100644 --- a/bgpd/rfapi/rfapi_descriptor_rfp_utils.h +++ b/bgpd/rfapi/rfapi_descriptor_rfp_utils.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfapi/rfapi_encap_tlv.c b/bgpd/rfapi/rfapi_encap_tlv.c index 171ea8f24..04f8b249f 100644 --- a/bgpd/rfapi/rfapi_encap_tlv.c +++ b/bgpd/rfapi/rfapi_encap_tlv.c @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ #include "lib/zebra.h" diff --git a/bgpd/rfapi/rfapi_encap_tlv.h b/bgpd/rfapi/rfapi_encap_tlv.h index 9678655a6..19e16a41a 100644 --- a/bgpd/rfapi/rfapi_encap_tlv.h +++ b/bgpd/rfapi/rfapi_encap_tlv.h @@ -11,10 +11,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_ENCAP_TLV_H diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index bef4b64d2..741ad7d70 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index 3ba76539d..1888d5f25 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index 8eeed0216..275e44896 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_monitor.h b/bgpd/rfapi/rfapi_monitor.h index c42e57c56..667d61ec1 100644 --- a/bgpd/rfapi/rfapi_monitor.h +++ b/bgpd/rfapi/rfapi_monitor.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 QUAGGA_HGP_RFAPI_MONITOR_H diff --git a/bgpd/rfapi/rfapi_nve_addr.c b/bgpd/rfapi/rfapi_nve_addr.c index e00ff3031..f80455bbe 100644 --- a/bgpd/rfapi/rfapi_nve_addr.c +++ b/bgpd/rfapi/rfapi_nve_addr.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfapi/rfapi_nve_addr.h b/bgpd/rfapi/rfapi_nve_addr.h index 2b2d2b50d..f2159d106 100644 --- a/bgpd/rfapi/rfapi_nve_addr.h +++ b/bgpd/rfapi/rfapi_nve_addr.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_RFAPI_NVE_ADDR_H diff --git a/bgpd/rfapi/rfapi_private.h b/bgpd/rfapi/rfapi_private.h index a5e397054..5a6936fcc 100644 --- a/bgpd/rfapi/rfapi_private.h +++ b/bgpd/rfapi/rfapi_private.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 85ac93681..04c69d58a 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_rib.h b/bgpd/rfapi/rfapi_rib.h index 43a5d43ff..40e4c0c2f 100644 --- a/bgpd/rfapi/rfapi_rib.h +++ b/bgpd/rfapi/rfapi_rib.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 3de79dac0..7c5d6ce3f 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfapi/rfapi_vty.h b/bgpd/rfapi/rfapi_vty.h index c1aeda953..46b77b55e 100644 --- a/bgpd/rfapi/rfapi_vty.h +++ b/bgpd/rfapi/rfapi_vty.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 RFAPI_VTY_H diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c index b5ff5bbc8..cc27277a7 100644 --- a/bgpd/rfapi/vnc_debug.c +++ b/bgpd/rfapi/vnc_debug.c @@ -12,10 +12,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ #include "lib/zebra.h" diff --git a/bgpd/rfapi/vnc_debug.h b/bgpd/rfapi/vnc_debug.h index d16bceed9..c1d81f5c1 100644 --- a/bgpd/rfapi/vnc_debug.h +++ b/bgpd/rfapi/vnc_debug.h @@ -12,10 +12,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_BGP_VNC_DEBUG_H diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index 55eda907c..bca95e47c 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/vnc_export_bgp.h b/bgpd/rfapi/vnc_export_bgp.h index ae113fdcb..7dbbb40e0 100644 --- a/bgpd/rfapi/vnc_export_bgp.h +++ b/bgpd/rfapi/vnc_export_bgp.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_RFAPI_VNC_EXPORT_BGP_H_ diff --git a/bgpd/rfapi/vnc_export_bgp_p.h b/bgpd/rfapi/vnc_export_bgp_p.h index fceab02e0..31830a3c1 100644 --- a/bgpd/rfapi/vnc_export_bgp_p.h +++ b/bgpd/rfapi/vnc_export_bgp_p.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_RFAPI_VNC_EXPORT_BGP_P_H_ diff --git a/bgpd/rfapi/vnc_export_table.c b/bgpd/rfapi/vnc_export_table.c index 7c8035cf8..5c7a64d3b 100644 --- a/bgpd/rfapi/vnc_export_table.c +++ b/bgpd/rfapi/vnc_export_table.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfapi/vnc_export_table.h b/bgpd/rfapi/vnc_export_table.h index 77829ca38..234520670 100644 --- a/bgpd/rfapi/vnc_export_table.h +++ b/bgpd/rfapi/vnc_export_table.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_VNC_VNC_EXPORT_TABLE_H_ diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c index 10246758f..cb9c474d9 100644 --- a/bgpd/rfapi/vnc_import_bgp.c +++ b/bgpd/rfapi/vnc_import_bgp.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/vnc_import_bgp.h b/bgpd/rfapi/vnc_import_bgp.h index db739e332..9a7261067 100644 --- a/bgpd/rfapi/vnc_import_bgp.h +++ b/bgpd/rfapi/vnc_import_bgp.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_RFAPI_VNC_IMPORT_BGP_H_ diff --git a/bgpd/rfapi/vnc_import_bgp_p.h b/bgpd/rfapi/vnc_import_bgp_p.h index 85800c1ca..19bcd1925 100644 --- a/bgpd/rfapi/vnc_import_bgp_p.h +++ b/bgpd/rfapi/vnc_import_bgp_p.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 _QUAGGA_RFAPI_VNC_IMPORT_BGP_P_H_ diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 84b299ce1..6a8b4a83f 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfapi/vnc_zebra.h b/bgpd/rfapi/vnc_zebra.h index ad2484442..68e567ec3 100644 --- a/bgpd/rfapi/vnc_zebra.h +++ b/bgpd/rfapi/vnc_zebra.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* diff --git a/bgpd/rfp-example/librfp/rfp.h b/bgpd/rfp-example/librfp/rfp.h index 91dbf5e71..a8df87f82 100644 --- a/bgpd/rfp-example/librfp/rfp.h +++ b/bgpd/rfp-example/librfp/rfp.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* Sample header file */ diff --git a/bgpd/rfp-example/librfp/rfp_example.c b/bgpd/rfp-example/librfp/rfp_example.c index d4100c096..dad81c6dd 100644 --- a/bgpd/rfp-example/librfp/rfp_example.c +++ b/bgpd/rfp-example/librfp/rfp_example.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* stub rfp */ diff --git a/bgpd/rfp-example/librfp/rfp_internal.h b/bgpd/rfp-example/librfp/rfp_internal.h index 64452d239..b8cfeb049 100644 --- a/bgpd/rfp-example/librfp/rfp_internal.h +++ b/bgpd/rfp-example/librfp/rfp_internal.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* Sample header file */ diff --git a/bgpd/rfp-example/rfptest/rfptest.c b/bgpd/rfp-example/rfptest/rfptest.c index 39b798e51..2141933d1 100644 --- a/bgpd/rfp-example/rfptest/rfptest.c +++ b/bgpd/rfp-example/rfptest/rfptest.c @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ diff --git a/bgpd/rfp-example/rfptest/rfptest.h b/bgpd/rfp-example/rfptest/rfptest.h index 00effb867..2ebd7d12b 100644 --- a/bgpd/rfp-example/rfptest/rfptest.h +++ b/bgpd/rfp-example/rfptest/rfptest.h @@ -13,10 +13,9 @@ * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * 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 */ /* Sample header file */ diff --git a/configure.ac b/configure.ac index 1e414d094..8095f86f0 100755 --- a/configure.ac +++ b/configure.ac @@ -376,11 +376,11 @@ dnl ---------- AC_MSG_CHECKING(whether this OS has MPLS stack) case "$host" in *-linux*) - MPLS_METHOD="zebra_mpls_netlink.o zebra_mpls.o" + MPLS_METHOD="zebra_mpls_netlink.o" AC_MSG_RESULT(Linux MPLS) ;; *-openbsd*) - MPLS_METHOD="zebra_mpls_openbsd.o zebra_mpls.o" + MPLS_METHOD="zebra_mpls_openbsd.o" AC_MSG_RESULT(OpenBSD MPLS) ;; *) diff --git a/defaults.h b/defaults.h index 4a5cc8252..d9fd44e14 100644 --- a/defaults.h +++ b/defaults.h @@ -14,8 +14,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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_DEFAULTS_H diff --git a/doc/Building_FRR_on_Debian8.md b/doc/Building_FRR_on_Debian8.md index a42ca6d78..1a961f752 100644 --- a/doc/Building_FRR_on_Debian8.md +++ b/doc/Building_FRR_on_Debian8.md @@ -4,8 +4,8 @@ Building FRR on Debian 8 from Git Source Debian 8 restrictions: ---------------------- -- MPLS is not supported on `Debian 8` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use +- MPLS is not supported on `Debian 8` with default kernel. MPLS requires + Linux Kernel 4.5 or higher (LDP can be built, but may have limited use without MPLS) Install required packages @@ -24,7 +24,7 @@ Install newer pytest (>3.0) from pip Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using +**This assumes you want to build and install FRR from source and not using any packages** ### Add frr groups and user @@ -87,7 +87,7 @@ an example.) ### Enable IP & IPv6 forwarding -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit `/etc/sysctl.conf` and uncomment the following values (ignore the other settings) # Uncomment the next line to enable packet forwarding for IPv4 @@ -99,3 +99,34 @@ other settings) net.ipv6.conf.all.forwarding=1 **Reboot** or use `sysctl -p` to apply the same config to the running system + +### Troubleshooting + +**Local state directory** + +The local state directory must exist and have the correct permissions applied +for the frrouting daemons to start. In the above ./configure example the +local state directory is set to /var/run/frr (--localstatedir=/var/run/frr) +Debian considers /var/run/frr to be temporary and this is removed after a +reboot. + +When using a different local state directory you need to create the new +directory and change the ownership to the frr user, for example: + + mkdir /var/opt/frr + chown frr /var/opt/frr + +**Shared library error** + +If you try and start any of the frrouting daemons you may see the below error +due to the frrouting shared library directory not being found: + + ./zebra: error while loading shared libraries: libfrr.so.0: cannot open shared object file: No such file or directory + +The fix is to add the following line to /etc/ld.so.conf which will continue to +reference the library directory after the system reboots. To load the library +directory path immediately run the ldconfig command after adding the line to +the file eg: + + echo include /usr/local/lib >> /etc/ld.so.conf + ldconfig diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/Building_FRR_on_Ubuntu1604.md index 09b5aa8b7..9aa3206fe 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/Building_FRR_on_Ubuntu1604.md @@ -119,8 +119,8 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: sudo install -m 644 tools/frr.service /etc/systemd/system/frr.service sudo install -m 644 cumulus/etc/default/frr /etc/default/frr sudo install -m 644 cumulus/etc/frr/daemons /etc/frr/daemons - sudo install -m 644 cumulus/etc/frr/daemons.conf /etc/frr/daemons.conf - sudo install -m 644 cumulus/etc/frr/Frr.conf /etc/frr/Frr.conf + sudo install -m 644 tools/etc/frr/daemons.conf /etc/frr/daemons.conf + sudo install -m 644 tools/etc/frr/frr.conf /etc/frr/frr.conf sudo install -m 644 -o frr -g frr cumulus/etc/frr/vtysh.conf /etc/frr/vtysh.conf ### Enable daemons diff --git a/doc/cli.md b/doc/cli.md index 559f75a74..ffd34dd30 100644 --- a/doc/cli.md +++ b/doc/cli.md @@ -7,10 +7,12 @@ Definition Grammar This is a reference for the syntax used when defining new CLI commands. An example definition is: +``` DEFUN (command_name, command_name_cmd, --> "example <command|line [interface]> DEFINITION...", <..doc strings..>) +``` The arrowed part is the definition string. @@ -27,34 +29,36 @@ Characters allowed in each token type: Tokens ------ -* WORD -- A token that begins with +, -, or a lowercase letter. It is - an unchanging part of the command and will only match itself. - Example: "show ip bgp", every token is a WORD. -* IPV4 -- 'A.B.C.D', matches an IPv4 address. -* IPV6 -- 'X:X::X:X', matches an IPv6 address. -* IPV4_PREFIX -- 'A.B.C.D/M', matches an IPv4 prefix in CIDR notation. -* IPV6_PREFIX -- 'X:X::X:X/M', matches an IPv6 prefix in CIDR notation. -* VARIABLE -- Begins with a capital letter. Matches any input. -* RANGE -- Numeric range delimited by parentheses, e.g. (-100 - 100) or - (10-20). Will only match numbers in the range. +* `WORD` -- A token that begins with +, -, or a lowercase letter. It is + an unchanging part of the command and will only match itself. + Example: "show ip bgp", every token is a WORD. +* `IPV4` -- 'A.B.C.D', matches an IPv4 address. +* `IPV6` -- 'X:X::X:X', matches an IPv6 address. +* `IPV4_PREFIX` -- 'A.B.C.D/M', matches an IPv4 prefix in CIDR notation. +* `IPV6_PREFIX` -- 'X:X::X:X/M', matches an IPv6 prefix in CIDR notation. +* `VARIABLE` -- Begins with a capital letter. Matches any input. +* `RANGE` -- Numeric range delimited by parentheses, e.g. (-100 - 100) or + (10-20). Will only match numbers in the range. Rules ----- -* <angle|brackets> -- Contain sequences of tokens separated by pipes and +* `<angle|brackets>` -- Contain sequences of tokens separated by pipes and provide mutual exclusion. Sequences may contain - <mutual|exclusion> but not as the first token. - Disallowed: "example <<a|b> c|d>" - Allowed: "example <a c|b c|d> -* [square brackets] -- Contains sequences of tokens that are optional (can be - omitted). -* {curly|braces} -- similar to angle brackets, but instead of mutual + `<mutual|exclusion>` but not as the first token. + Disallowed: `"example <<a|b> c|d>"` + Allowed: `"example <a c|b c|d>"` +* `[square brackets]` -- Contains sequences of tokens that are optional (can be + omitted). `[<a|b>]` can be shortened to `[a|b]`. +* `{curly|braces}` -- similar to angle brackets, but instead of mutual exclusion, curly braces indicate that one or more of the pipe-separated sequences may be provided in any order. -* VARIADICS... -- Any token which accepts input (so anything except WORD) +* `VARIADICS...` -- Any token which accepts input (so anything except WORD) and that occurs as the last token of a line may be followed by an ellipsis, which indicates that input matching the token may be repeated an unlimited number of times. +* `$name` -- Specify a variable name for the preceding token. See + "Variable Names" below. Some general notes: @@ -69,6 +73,40 @@ Some general notes: configuration items should be defined in separate commands. Clarity is preferred over LOC (within reason). +Variable Names +-------------- +The parser tries to fill the "varname" field on each token. This can happen +either manually or automatically. Manual specifications work by appending +`"$name"` after the input specifier: + +``` +foo bar$cmd WORD$name A.B.C.D$ip +``` + +Note that you can also assign variable names to fixed input tokens, this can +be useful if multiple commands share code. You can also use "$name" after a +multiple-choice option: + +``` +foo bar <A.B.C.D|X:X::X:X>$addr [optionA|optionB]$mode +``` + +The variable name is in this case assigned to the last token in each of the +branches. + +Automatic assignment of variable names works by applying the following rules: + +- manual names always have priority +- a "[no]" at the beginning receives "no" as varname on the "no" token +- VARIABLE tokens whose text is not "WORD" or "NAME" receive a cleaned lowercase + version of the token text as varname, e.g. "ROUTE-MAP" becomes "route_map". +- other variable tokens (i.e. everything except "fixed") receive the text of + the preceding fixed token as varname, if one can be found. E.g.: + "ip route A.B.C.D/M INTERFACE" assigns "route" to the "A.B.C.D/M" token. + +These rules should make it possible to avoid manual varname assignment in 90% +of the cases. + Doc Strings ----------- Each token in a command definition should be documented with a brief doc @@ -77,11 +115,13 @@ command tree. These strings are provided as the last parameter to DEFUN macros, concatenated together and separated by an escaped newline ('\n'). These are best explained by example. +``` DEFUN (config_terminal, config_terminal_cmd, "configure terminal", "Configuration from vty interface\n" "Configuration terminal\n") +``` The last parameter is split into two lines for readability. Two newline delimited doc strings are present, one for each token in the command. The @@ -110,11 +150,13 @@ constructs. In the examples below, each arrowed token needs a doc string. +``` "show ip bgp" ^ ^ ^ "command <foo|bar> [example]" ^ ^ ^ ^ +``` Data Structures --------------- @@ -216,22 +258,32 @@ it is generally _incorrect_ to assume consistent indices in this array. As a simple example: Command definition: +``` command [foo] <bar|baz> +``` User enters: +``` command foo bar +``` Array: +``` [0] -> command [1] -> foo [2] -> bar +``` User enters: +``` command baz +``` Array: +``` [0] -> command [1] -> baz +``` @@ -242,24 +294,32 @@ tokens when the CLI matcher does not need them to make an unambiguous match. This is best explained by example. Command definitions: +``` command dog cow command dog crow +``` User input: +``` c d c -> ambiguous command c d co -> match "command dog cow" +``` In the new implementation, this functionality has improved. Where previously the parser would stop at the first ambiguous token, it will now look ahead and attempt to disambiguate based on tokens later on in the input string. Command definitions: +``` show ip bgp A.B.C.D show ipv6 bgp X:X::X:X +``` User enters: +``` s i b 4.3.2.1 -> match "show ip bgp A.B.C.D" s i b ::e0 -> match "show ipv6 bgp X:X::X:X" +``` Previously both of these commands would be ambiguous since 'i' does not explicitly select either 'ip' or 'ipv6'. However, since the user later provides @@ -268,17 +328,23 @@ parser is able to look ahead and select the appropriate command. This has some implications for parsing the argv*[] that is passed to the command handler. Now consider a command definition such as: +``` command <foo|VAR> +``` 'foo' only matches the string 'foo', but 'VAR' matches any input, including 'foo'. Who wins? In situations like this the matcher will always choose the 'better' match, so 'foo' will win. Consider also: +``` show <ip|ipv6> foo +``` User input: +``` show ip foo +``` 'ip' partially matches 'ipv6' but exactly matches 'ip', so 'ip' will win. @@ -286,6 +352,7 @@ User input: struct cmd_token ---------------- +``` /* Command token struct. */ struct cmd_token { @@ -297,7 +364,9 @@ struct cmd_token char *desc; // token description long long min, max; // for ranges char *arg; // user input that matches this token + char *varname; // variable name }; +``` This struct is used in the CLI graph to match input against. It is also used to pass user input to command handler functions, as it is frequently useful for @@ -316,7 +385,9 @@ has the full text of the corresponding token in the definition string and using it makes for much more readable code. An example is helpful. Command definition: +``` command <(1-10)|foo|BAR> +``` In this example, the user may enter any one of: * an integer between 1 and 10 @@ -325,9 +396,11 @@ In this example, the user may enter any one of: If the user enters "command f", then: +``` argv[1]->type == WORD_TKN argv[1]->arg == "f" argv[1]->text == "foo" +``` Range tokens have some special treatment; a token with ->type == RANGE_TKN will have the ->min and ->max fields set to the bounding values of the range. @@ -342,6 +415,7 @@ all matching input permutations. It also dumps a text representation of the graph, which is more useful for debugging than anything else. It looks like this: +``` $ ./permutations "show [ip] bgp [<view|vrf> WORD]" show ip bgp view WORD @@ -350,6 +424,7 @@ show ip bgp show bgp view WORD show bgp vrf WORD show bgp +``` This functionality is also built into VTY/VTYSH; the 'list permutations' command will list all possible matching input permutations in the current CLI diff --git a/doc/main.texi b/doc/main.texi index 706baa25f..265d6295e 100644 --- a/doc/main.texi +++ b/doc/main.texi @@ -498,6 +498,11 @@ If so, the box can't work as a router. Display whether the host's IP v6 forwarding is enabled or not. @end deffn +@deffn Command {show zebra} {} +Display various statistics related to the installation and deletion +of routes, neighbor updates, and LSP's into the kernel. +@end deffn + @deffn Command {show zebra fpm stats} {} Display statistics related to the zebra code that interacts with the optional Forwarding Plane Manager (FPM) component. diff --git a/doc/ospf6d.texi b/doc/ospf6d.texi index 31f4db0cc..3ea71fbd2 100644 --- a/doc/ospf6d.texi +++ b/doc/ospf6d.texi @@ -151,6 +151,10 @@ Shows requestlist of neighbor. This command shows internal routing table. @end deffn +@deffn {Command} {show ipv6 ospf6 zebra} {} +Shows state about what is being redistributed between zebra and OSPF6 +@end deffn + @node OSPF6 Configuration Examples @section OSPF6 Configuration Examples diff --git a/eigrpd/eigrp_const.h b/eigrpd/eigrp_const.h index 9397717be..6673b3a33 100644 --- a/eigrpd/eigrp_const.h +++ b/eigrpd/eigrp_const.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_CONST_H_ @@ -89,8 +88,8 @@ #define EIGRP_HELLO_INTERVAL_DEFAULT 5 #define EIGRP_HOLD_INTERVAL_DEFAULT 15 -#define EIGRP_BANDWIDTH_DEFAULT 10000000 -#define EIGRP_DELAY_DEFAULT 1000 +#define EIGRP_BANDWIDTH_DEFAULT 100000 +#define EIGRP_DELAY_DEFAULT 10 #define EIGRP_RELIABILITY_DEFAULT 255 #define EIGRP_LOAD_DEFAULT 1 @@ -103,6 +102,7 @@ #define INTERFACE_DOWN_BY_ZEBRA 1 #define INTERFACE_DOWN_BY_VTY 2 +#define INTERFACE_DOWN_BY_FINAL 3 #define EIGRP_HELLO_NORMAL 0x00 #define EIGRP_HELLO_GRACEFUL_SHUTDOWN 0x01 diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c index 21bef48ec..c2fbe29cf 100644 --- a/eigrpd/eigrp_dump.c +++ b/eigrpd/eigrp_dump.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -310,15 +309,31 @@ show_ip_eigrp_topology_header (struct vty *vty, struct eigrp *eigrp) void show_ip_eigrp_prefix_entry (struct vty *vty, struct eigrp_prefix_entry *tn) { + struct list *successors = eigrp_topology_get_successor(tn); + vty_out (vty, "%-3c",(tn->state > 0) ? 'A' : 'P'); - vty_out (vty, "%s/%u, ",inet_ntoa (tn->destination_ipv4->prefix),tn->destination_ipv4->prefixlen); - vty_out (vty, "%u successors, ",eigrp_topology_get_successor(tn)->count); - vty_out (vty, "FD is %u, serno: %lu %s",tn->fdistance, tn->serno, VTY_NEWLINE); + + vty_out (vty, "%s/%u, ", + inet_ntoa (tn->destination_ipv4->prefix), tn->destination_ipv4->prefixlen); + vty_out (vty, "%u successors, ", successors->count); + vty_out (vty, "FD is %u, serno: %" PRIu64 " %s", tn->fdistance, tn->serno, VTY_NEWLINE); + + list_delete(successors); } void -show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, struct eigrp_neighbor_entry *te) +show_ip_eigrp_neighbor_entry (struct vty *vty, struct eigrp *eigrp, + struct eigrp_neighbor_entry *te, int *first) { + if (te->reported_distance == EIGRP_MAX_METRIC) + return; + + if (*first) + { + show_ip_eigrp_prefix_entry (vty, te->prefix); + *first = 0; + } + if (te->adv_router == eigrp->neighbor_self) vty_out (vty, "%-7s%s, %s%s", " ", "via Connected", eigrp_if_name_string (te->ei), VTY_NEWLINE); diff --git a/eigrpd/eigrp_dump.h b/eigrpd/eigrp_dump.h index 54e6338a3..e18efd453 100644 --- a/eigrpd/eigrp_dump.h +++ b/eigrpd/eigrp_dump.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRPD_DUMP_H_ @@ -158,7 +157,7 @@ extern void show_ip_eigrp_interface_sub (struct vty *, struct eigrp *, struct eigrp_interface *); extern void show_ip_eigrp_neighbor_sub (struct vty *, struct eigrp_neighbor *, int); extern void show_ip_eigrp_prefix_entry (struct vty *, struct eigrp_prefix_entry *); -extern void show_ip_eigrp_neighbor_entry (struct vty *, struct eigrp *, struct eigrp_neighbor_entry *); +extern void show_ip_eigrp_neighbor_entry (struct vty *, struct eigrp *, struct eigrp_neighbor_entry *, int *); extern void eigrp_debug_init (void); diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index bfe51ae88..df5933217 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -25,10 +25,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -83,7 +82,6 @@ eigrp_distribute_update (struct distribute *dist) if (dist->list[DISTRIBUTE_V4_IN]) { alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]); - zlog_info("<DEBUG DISTRIBUTE ACL IN FOUND: %s",alist->name); if (alist) e->list[EIGRP_FILTER_IN] = alist; else @@ -97,7 +95,6 @@ eigrp_distribute_update (struct distribute *dist) /* access list OUT for whole process */ if (dist->list[DISTRIBUTE_V4_OUT]) { - zlog_info("<DEBUG DISTRIBUTE ACL OUT FOUND: %s",dist->list[DISTRIBUTE_V4_OUT]); alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]); if (alist) e->list[EIGRP_FILTER_OUT] = alist; @@ -112,7 +109,6 @@ eigrp_distribute_update (struct distribute *dist) /* PREFIX_LIST IN for process */ if (dist->prefix[DISTRIBUTE_V4_IN]) { - zlog_info("<DEBUG DISTRIBUTE PREFIX IN FOUND: %s",dist->prefix[DISTRIBUTE_V4_IN]); plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]); if (plist) { @@ -126,7 +122,6 @@ eigrp_distribute_update (struct distribute *dist) /* PREFIX_LIST OUT for process */ if (dist->prefix[DISTRIBUTE_V4_OUT]) { - zlog_info("<DEBUG DISTRIBUTE PREFIX OUT FOUND: %s",dist->prefix[DISTRIBUTE_V4_OUT]); plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]); if (plist) { @@ -192,8 +187,6 @@ eigrp_distribute_update (struct distribute *dist) if (ifp == NULL) return; - zlog_info("<DEBUG ACL 2"); - /*struct eigrp_if_info * info = ifp->info; ei = info->eigrp_interface;*/ struct listnode *node, *nnode; @@ -207,15 +200,9 @@ eigrp_distribute_update (struct distribute *dist) } } - if(ei == NULL) - { - zlog_info("Not Found eigrp interface %s",ifp->name); - } - /* Access-list for interface in */ if (dist->list[DISTRIBUTE_V4_IN]) { - zlog_info("<DEBUG ACL in"); alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]); if (alist){ ei->list[EIGRP_FILTER_IN] = alist; @@ -239,10 +226,7 @@ eigrp_distribute_update (struct distribute *dist) } else - { - ei->list[EIGRP_FILTER_OUT] = NULL; - zlog_info("<DEBUG ACL out else"); - } + ei->list[EIGRP_FILTER_OUT] = NULL; /* Prefix-list for interface in */ if (dist->prefix[DISTRIBUTE_V4_IN]) diff --git a/eigrpd/eigrp_filter.h b/eigrpd/eigrp_filter.h index 01c776b17..117cf3c49 100644 --- a/eigrpd/eigrp_filter.h +++ b/eigrpd/eigrp_filter.h @@ -25,10 +25,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 EIGRPD_EIGRP_FILTER_H_ diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index dc62edb68..44a474758 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -20,11 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * + * 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 * * This file contains functions for executing logic of finite state machine * @@ -65,7 +63,6 @@ * 5- query from successor while in active state * 6- last reply, FC not satisfied with current value of FDij * 7- state not changed, usually by receiving not last reply - * */ #include <thread.h> @@ -437,8 +434,8 @@ int eigrp_fsm_event_keep_state(struct eigrp_fsm_action_message *msg) if (prefix->state == EIGRP_FSM_STATE_PASSIVE) { - if (!eigrp_metrics_is_same(&prefix->reported_metric, - &((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric)) + if (!eigrp_metrics_is_same(prefix->reported_metric, + ((struct eigrp_neighbor_entry *) prefix->entries->head->data)->total_metric)) { prefix->rdistance = prefix->fdistance = diff --git a/eigrpd/eigrp_fsm.h b/eigrpd/eigrp_fsm.h index 0677c09d7..4ba0d8873 100644 --- a/eigrpd/eigrp_fsm.h +++ b/eigrpd/eigrp_fsm.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_FSM_H diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index 051836d7e..0b370219b 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -252,7 +251,8 @@ eigrp_peer_termination_decode (struct eigrp_neighbor *nbr, if(my_ip == received_ip) { zlog_info ("Neighbor %s (%s) is down: Peer Termination received", - inet_ntoa (nbr->src),ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); + inet_ntoa (nbr->src), + ifindex2ifname (nbr->ei->ifp->ifindex, VRF_DEFAULT)); /* set neighbor to DOWN */ nbr->state = EIGRP_NEIGHBOR_DOWN; /* delete neighbor */ @@ -364,14 +364,15 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e case EIGRP_TLV_SW_VERSION: eigrp_sw_version_decode(nbr, tlv_header); break; - case EIGRP_TLV_NEXT_MCAST_SEQ: - break; + case EIGRP_TLV_NEXT_MCAST_SEQ: + break; case EIGRP_TLV_PEER_TERMINATION: eigrp_peer_termination_decode(nbr, tlv_header); + return; break; case EIGRP_TLV_PEER_MTRLIST: - case EIGRP_TLV_PEER_TIDLIST: - break; + case EIGRP_TLV_PEER_TIDLIST: + break; default: break; } @@ -388,7 +389,8 @@ eigrp_hello_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e { /* increment statistics. */ ei->hello_in++; - eigrp_nbr_state_update(nbr); + if (nbr) + eigrp_nbr_state_update(nbr); } diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 1ad5e88c2..26643452c 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -304,12 +303,14 @@ eigrp_if_up (struct eigrp_interface *ei) { pe = eigrp_prefix_entry_new (); pe->serno = eigrp->serno; - pe->destination_ipv4 = dest_addr; + pe->destination_ipv4 = prefix_ipv4_new (); + prefix_copy ((struct prefix *)pe->destination_ipv4, + (struct prefix *)dest_addr); pe->af = AF_INET; pe->nt = EIGRP_TOPOLOGY_TYPE_CONNECTED; pe->state = EIGRP_FSM_STATE_PASSIVE; - pe->fdistance = eigrp_calculate_metrics (eigrp, &metric); + pe->fdistance = eigrp_calculate_metrics (eigrp, metric); pe->req_action |= EIGRP_FSM_NEED_UPDATE; eigrp_prefix_entry_add (eigrp->topology_table, pe); listnode_add(eigrp->topology_changes_internalIPV4, pe); @@ -318,7 +319,7 @@ eigrp_if_up (struct eigrp_interface *ei) ne->ei = ei; ne->reported_metric = metric; ne->total_metric = metric; - ne->distance = eigrp_calculate_metrics (eigrp, &metric); + ne->distance = eigrp_calculate_metrics (eigrp, metric); ne->reported_distance = 0; ne->prefix = pe; ne->adv_router = eigrp->neighbor_self; diff --git a/eigrpd/eigrp_interface.h b/eigrpd/eigrp_interface.h index c7de3b75b..0c57f0cbd 100644 --- a/eigrpd/eigrp_interface.h +++ b/eigrpd/eigrp_interface.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_INTERFACE_H_ diff --git a/eigrpd/eigrp_macros.h b/eigrpd/eigrp_macros.h index dd22829e8..08c2fc34c 100644 --- a/eigrpd/eigrp_macros.h +++ b/eigrpd/eigrp_macros.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_MACROS_H_ diff --git a/eigrpd/eigrp_main.c b/eigrpd/eigrp_main.c index 6a5e3b1a0..08a1cb659 100644 --- a/eigrpd/eigrp_main.c +++ b/eigrpd/eigrp_main.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -182,7 +181,7 @@ main (int argc, char **argv, char **envp) eigrp_om->master = frr_init(); master = eigrp_om->master; - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); /*EIGRPd init*/ eigrp_if_init (); diff --git a/eigrpd/eigrp_memory.c b/eigrpd/eigrp_memory.c index dabc0774e..4aa76018a 100644 --- a/eigrpd/eigrp_memory.c +++ b/eigrpd/eigrp_memory.c @@ -14,10 +14,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/eigrpd/eigrp_memory.h b/eigrpd/eigrp_memory.h index 0cafdfb1b..cd29f1725 100644 --- a/eigrpd/eigrp_memory.h +++ b/eigrpd/eigrp_memory.h @@ -14,10 +14,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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_EIGRP_MEMORY_H diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index f200351c1..ea39d6e90 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -187,7 +186,8 @@ void eigrp_nbr_delete (struct eigrp_neighbor *nbr) { eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); - eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr); + if (nbr->ei) + eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr); /* Cancel all events. *//* Thread lookup cost would be negligible. */ thread_cancel_event (master, nbr); @@ -195,7 +195,8 @@ eigrp_nbr_delete (struct eigrp_neighbor *nbr) eigrp_fifo_free (nbr->retrans_queue); THREAD_OFF (nbr->t_holddown); - listnode_delete (nbr->ei->nbrs,nbr); + if (nbr->ei) + listnode_delete (nbr->ei->nbrs,nbr); XFREE (MTYPE_EIGRP_NEIGHBOR, nbr); } diff --git a/eigrpd/eigrp_neighbor.h b/eigrpd/eigrp_neighbor.h index e9ddc22f9..66fa0e71b 100644 --- a/eigrpd/eigrp_neighbor.h +++ b/eigrpd/eigrp_neighbor.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_NEIGHBOR_H diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index dff7f2727..cfed11a9e 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -388,29 +387,29 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p) } u_int32_t -eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric) +eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics metric) { uint64_t temp_metric; temp_metric = 0; - if(metric->delay == EIGRP_MAX_METRIC) + if(metric.delay == EIGRP_MAX_METRIC) return EIGRP_MAX_METRIC; // EIGRP Metric = {K1*BW+[(K2*BW)/(256-load)]+(K3*delay)}*{K5/(reliability+K4)} if (eigrp->k_values[0]) - temp_metric += (eigrp->k_values[0] * metric->bandwith); + temp_metric += (eigrp->k_values[0] * metric.bandwith); if (eigrp->k_values[1]) - temp_metric += ((eigrp->k_values[1] * metric->bandwith) - / (256 - metric->load)); + temp_metric += ((eigrp->k_values[1] * metric.bandwith) + / (256 - metric.load)); if (eigrp->k_values[2]) - temp_metric += (eigrp->k_values[2] * metric->delay); + temp_metric += (eigrp->k_values[2] * metric.delay); if (eigrp->k_values[3] && !eigrp->k_values[4]) temp_metric *= eigrp->k_values[3]; if (!eigrp->k_values[3] && eigrp->k_values[4]) - temp_metric *= (eigrp->k_values[4] / metric->reliability); + temp_metric *= (eigrp->k_values[4] / metric.reliability); if (eigrp->k_values[3] && eigrp->k_values[4]) - temp_metric *= ((eigrp->k_values[4] / metric->reliability) + temp_metric *= ((eigrp->k_values[4] / metric.reliability) + eigrp->k_values[3]); if (temp_metric <= EIGRP_MAX_METRIC) @@ -425,29 +424,29 @@ eigrp_calculate_total_metrics(struct eigrp *eigrp, { entry->total_metric = entry->reported_metric; uint64_t temp_delay = (uint64_t) entry->total_metric.delay - + (uint64_t) EIGRP_IF_PARAM (entry->ei, delay); + + (uint64_t) eigrp_delay_to_scaled (EIGRP_IF_PARAM (entry->ei, delay)); entry->total_metric.delay = temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC : (u_int32_t) temp_delay; - u_int32_t bw = EIGRP_IF_PARAM (entry->ei,bandwidth); + u_int32_t bw = eigrp_bandwidth_to_scaled (EIGRP_IF_PARAM (entry->ei,bandwidth)); entry->total_metric.bandwith = entry->total_metric.bandwith > bw ? bw : entry->total_metric.bandwith; - return eigrp_calculate_metrics(eigrp, &entry->total_metric); + return eigrp_calculate_metrics(eigrp, entry->total_metric); } u_char -eigrp_metrics_is_same(struct eigrp_metrics *metric1, - struct eigrp_metrics *metric2) +eigrp_metrics_is_same(struct eigrp_metrics metric1, + struct eigrp_metrics metric2) { - if ((metric1->bandwith == metric2->bandwith) - && (metric1->delay == metric2->delay) - && (metric1->hop_count == metric2->hop_count) - && (metric1->load == metric2->load) - && (metric1->reliability == metric2->reliability) - && (metric1->mtu[0] == metric2->mtu[0]) - && (metric1->mtu[1] == metric2->mtu[1]) - && (metric1->mtu[2] == metric2->mtu[2])) + if ((metric1.bandwith == metric2.bandwith) + && (metric1.delay == metric2.delay) + && (metric1.hop_count == metric2.hop_count) + && (metric1.load == metric2.load) + && (metric1.reliability == metric2.reliability) + && (metric1.mtu[0] == metric2.mtu[0]) + && (metric1.mtu[1] == metric2.mtu[1]) + && (metric1.mtu[2] == metric2.mtu[2])) return 1; return 0; // if different diff --git a/eigrpd/eigrp_network.h b/eigrpd/eigrp_network.h index 87d128062..82ac455c9 100644 --- a/eigrpd/eigrp_network.h +++ b/eigrpd/eigrp_network.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_NETWORK_H @@ -44,9 +43,9 @@ extern int eigrp_if_drop_allspfrouters (struct eigrp *top, struct prefix *p, unsigned int ifindex); extern void eigrp_adjust_sndbuflen (struct eigrp *, unsigned int); -extern u_int32_t eigrp_calculate_metrics (struct eigrp *, struct eigrp_metrics *); +extern u_int32_t eigrp_calculate_metrics (struct eigrp *, struct eigrp_metrics); extern u_int32_t eigrp_calculate_total_metrics (struct eigrp *, struct eigrp_neighbor_entry *); -extern u_char eigrp_metrics_is_same(struct eigrp_metrics *,struct eigrp_metrics *); +extern u_char eigrp_metrics_is_same(struct eigrp_metrics, struct eigrp_metrics); extern void eigrp_external_routes_refresh (struct eigrp *, int); #endif /* EIGRP_NETWORK_H_ */ diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 635c1cf66..2d02acc00 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -114,7 +113,10 @@ eigrp_make_md5_digest (struct eigrp_interface *ei, struct stream *s, u_char flag if(keychain) key = key_lookup_for_send(keychain); else - return EIGRP_AUTH_TYPE_NONE; + { + eigrp_authTLV_MD5_free(auth_TLV); + return EIGRP_AUTH_TYPE_NONE; + } memset(&ctx, 0, sizeof(ctx)); MD5Init(&ctx); @@ -235,8 +237,7 @@ eigrp_check_md5_digest (struct stream *s, } /* save neighbor's crypt_seqnum */ - if (nbr) - nbr->crypt_seqnum = authTLV->key_sequence; + nbr->crypt_seqnum = authTLV->key_sequence; return 1; } @@ -628,7 +629,7 @@ eigrp_read (struct thread *thread) struct eigrp_packet *ep; ep = eigrp_fifo_tail(nbr->retrans_queue); - if (ep != NULL) + if (ep) { if (ntohl(eigrph->ack) == ep->sequence_number) { @@ -642,7 +643,7 @@ eigrp_read (struct thread *thread) eigrp_update_send_EOT(nbr); } ep = eigrp_fifo_pop_tail(nbr->retrans_queue); - /*eigrp_packet_free(ep);*/ + eigrp_packet_free(ep); if (nbr->retrans_queue->count > 0) { eigrp_send_packet_reliably(nbr); @@ -650,7 +651,7 @@ eigrp_read (struct thread *thread) } } ep = eigrp_fifo_tail(nbr->multicast_queue); - if (ep != NULL) + if (ep) { if (ntohl(eigrph->ack) == ep->sequence_number) { diff --git a/eigrpd/eigrp_packet.h b/eigrpd/eigrp_packet.h index b8b281516..0996eb2ff 100644 --- a/eigrpd/eigrp_packet.h +++ b/eigrpd/eigrp_packet.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_PACKET_H diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c index 4488054e0..774461a09 100644 --- a/eigrpd/eigrp_query.c +++ b/eigrpd/eigrp_query.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -114,16 +113,17 @@ eigrp_query_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e type = stream_getw(s); if (type == EIGRP_TLV_IPv4_INT) { + struct prefix_ipv4 dest_addr; + stream_set_getp(s, s->getp - sizeof(u_int16_t)); tlv = eigrp_read_ipv4_tlv(s); - struct prefix_ipv4 *dest_addr; - dest_addr = prefix_ipv4_new(); - dest_addr->prefix = tlv->destination; - dest_addr->prefixlen = tlv->prefix_length; + dest_addr.family = AFI_IP; + dest_addr.prefix = tlv->destination; + dest_addr.prefixlen = tlv->prefix_length; struct eigrp_prefix_entry *dest = - eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr); + eigrp_topology_table_lookup_ipv4(eigrp->topology_table, &dest_addr); /* If the destination exists (it should, but one never know)*/ if (dest != NULL) diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c index 0c5d9dd92..e64a3d022 100644 --- a/eigrpd/eigrp_reply.c +++ b/eigrpd/eigrp_reply.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -146,6 +145,8 @@ eigrp_send_reply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) { eigrp_send_packet_reliably(nbr); } + + XFREE(MTYPE_EIGRP_PREFIX_ENTRY, pe2); } /*EIGRP REPLY read function*/ @@ -180,16 +181,17 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e type = stream_getw(s); if (type == EIGRP_TLV_IPv4_INT) { + struct prefix_ipv4 dest_addr; + stream_set_getp(s, s->getp - sizeof(u_int16_t)); tlv = eigrp_read_ipv4_tlv(s); - struct prefix_ipv4 *dest_addr; - dest_addr = prefix_ipv4_new(); - dest_addr->prefix = tlv->destination; - dest_addr->prefixlen = tlv->prefix_length; + dest_addr.family = AFI_IP; + dest_addr.prefix = tlv->destination; + dest_addr.prefixlen = tlv->prefix_length; struct eigrp_prefix_entry *dest = - eigrp_topology_table_lookup_ipv4 (eigrp->topology_table, dest_addr); + eigrp_topology_table_lookup_ipv4 (eigrp->topology_table, &dest_addr); /* * Destination must exists */ @@ -212,24 +214,18 @@ eigrp_reply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header *e plist = e->prefix[EIGRP_FILTER_IN]; alist_i = ei->list[EIGRP_FILTER_IN]; plist_i = ei->prefix[EIGRP_FILTER_IN]; - zlog_info("REPLY Receive: Filtering"); - zlog_info("REPLY RECEIVE Prefix: %s", inet_ntoa(dest_addr->prefix)); /* Check if any list fits */ - if ((alist && access_list_apply (alist, - (struct prefix *) dest_addr) == FILTER_DENY)|| - (plist && prefix_list_apply (plist, - (struct prefix *) dest_addr) == PREFIX_DENY)|| - (alist_i && access_list_apply (alist_i, - (struct prefix *) dest_addr) == FILTER_DENY)|| - (plist_i && prefix_list_apply (plist_i, - (struct prefix *) dest_addr) == PREFIX_DENY)) + if ((alist && + access_list_apply (alist, (struct prefix *)&dest_addr) == FILTER_DENY) || + (plist && + prefix_list_apply (plist, (struct prefix *)&dest_addr) == PREFIX_DENY) || + (alist_i && + access_list_apply (alist_i, (struct prefix *)&dest_addr) == FILTER_DENY) || + (plist_i && + prefix_list_apply (plist_i, (struct prefix *)&dest_addr) == PREFIX_DENY)) { - zlog_info("REPLY RECEIVE: Setting metric to max"); tlv->metric.delay = EIGRP_MAX_METRIC; - zlog_info("REPLY RECEIVE Prefix: %s", inet_ntoa(dest_addr->prefix)); - } else { - zlog_info("REPLY RECEIVE: Not setting metric"); - } + } /* * End of filtering */ diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c index c4a33d5b0..6a6168e4f 100644 --- a/eigrpd/eigrp_routemap.c +++ b/eigrpd/eigrp_routemap.c @@ -31,10 +31,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c index b04130076..d521a57ba 100644 --- a/eigrpd/eigrp_siaquery.c +++ b/eigrpd/eigrp_siaquery.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -81,16 +80,17 @@ eigrp_siaquery_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header type = stream_getw(s); if (type == EIGRP_TLV_IPv4_INT) { + struct prefix_ipv4 dest_addr; + stream_set_getp(s, s->getp - sizeof(u_int16_t)); tlv = eigrp_read_ipv4_tlv(s); - struct prefix_ipv4 *dest_addr; - dest_addr = prefix_ipv4_new(); - dest_addr->prefix = tlv->destination; - dest_addr->prefixlen = tlv->prefix_length; + dest_addr.family = AFI_IP; + dest_addr.prefix = tlv->destination; + dest_addr.prefixlen = tlv->prefix_length; struct eigrp_prefix_entry *dest = - eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr); + eigrp_topology_table_lookup_ipv4(eigrp->topology_table, &dest_addr); /* If the destination exists (it should, but one never know)*/ if (dest != NULL) @@ -162,4 +162,6 @@ eigrp_send_siaquery (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) eigrp_send_packet_reliably(nbr); } } + else + eigrp_packet_free(ep); } diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c index 4c4793f86..dbf451800 100644 --- a/eigrpd/eigrp_siareply.c +++ b/eigrpd/eigrp_siareply.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -80,16 +79,17 @@ eigrp_siareply_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header type = stream_getw(s); if (type == EIGRP_TLV_IPv4_INT) { + struct prefix_ipv4 dest_addr; + stream_set_getp(s, s->getp - sizeof(u_int16_t)); tlv = eigrp_read_ipv4_tlv(s); - struct prefix_ipv4 *dest_addr; - dest_addr = prefix_ipv4_new(); - dest_addr->prefix = tlv->destination; - dest_addr->prefixlen = tlv->prefix_length; + dest_addr.family = AFI_IP; + dest_addr.prefix = tlv->destination; + dest_addr.prefixlen = tlv->prefix_length; struct eigrp_prefix_entry *dest = - eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr); + eigrp_topology_table_lookup_ipv4(eigrp->topology_table, &dest_addr); /* If the destination exists (it should, but one never know)*/ if (dest != NULL) @@ -161,6 +161,8 @@ eigrp_send_siareply (struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe) eigrp_send_packet_reliably(nbr); } } + else + eigrp_packet_free(ep); } diff --git a/eigrpd/eigrp_snmp.c b/eigrpd/eigrp_snmp.c index f18894bb8..4b8d1bb39 100644 --- a/eigrpd/eigrp_snmp.c +++ b/eigrpd/eigrp_snmp.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/eigrpd/eigrp_snmp.h b/eigrpd/eigrp_snmp.h index ab14912c4..559852d58 100644 --- a/eigrpd/eigrp_snmp.h +++ b/eigrpd/eigrp_snmp.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h index b891475c2..4d307005c 100644 --- a/eigrpd/eigrp_structs.h +++ b/eigrpd/eigrp_structs.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_STRUCTS_H_ diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index 25beb63e8..245b6adce 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -216,11 +215,19 @@ void eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node, struct eigrp_neighbor_entry *entry) { - if (listnode_lookup(node->entries, entry) == NULL) + struct list *l = list_new (); + + listnode_add (l, entry); + + if (listnode_lookup (node->entries, entry) == NULL) { - listnode_add_sort(node->entries, entry); + listnode_add_sort (node->entries, entry); entry->prefix = node; + + eigrp_zebra_route_add (node->destination_ipv4, l); } + + list_delete (l); } /* @@ -236,15 +243,16 @@ eigrp_prefix_entry_delete(struct list *topology, * Emergency removal of the node from this list. * Whatever it is. */ - listnode_delete(eigrp->topology_changes_internalIPV4, node); + listnode_delete (eigrp->topology_changes_internalIPV4, node); - if (listnode_lookup(topology, node) != NULL) + if (listnode_lookup (topology, node) != NULL) { - list_delete_all_node(node->entries); - list_free(node->entries); - list_free(node->rij); - listnode_delete(topology, node); - XFREE(MTYPE_EIGRP_PREFIX_ENTRY,node); + list_delete_all_node (node->entries); + list_free (node->entries); + list_free (node->rij); + listnode_delete (topology, node); + eigrp_zebra_route_delete (node->destination_ipv4); + XFREE (MTYPE_EIGRP_PREFIX_ENTRY,node); } } @@ -258,6 +266,7 @@ eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node, if (listnode_lookup(node->entries, entry) != NULL) { listnode_delete(node->entries, entry); + eigrp_zebra_route_delete (node->destination_ipv4); XFREE(MTYPE_EIGRP_NEIGHBOR_ENTRY,entry); } } @@ -414,24 +423,24 @@ eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg) if (msg->data_type == EIGRP_TLV_IPv4_INT) { int_data = msg->data.ipv4_int_type; - if (eigrp_metrics_is_same(&int_data->metric,&entry->reported_metric)) + if (eigrp_metrics_is_same(int_data->metric, entry->reported_metric)) { return 0; // No change } change = entry->reported_distance - < eigrp_calculate_metrics(eigrp, &int_data->metric) ? 1 : + < eigrp_calculate_metrics(eigrp, int_data->metric) ? 1 : entry->reported_distance - > eigrp_calculate_metrics(eigrp, &int_data->metric) ? 2 : 3; // Increase : Decrease : No change + > eigrp_calculate_metrics(eigrp, int_data->metric) ? 2 : 3; // Increase : Decrease : No change entry->reported_metric = int_data->metric; entry->reported_distance = - eigrp_calculate_metrics(eigrp, &int_data->metric); + eigrp_calculate_metrics(eigrp, int_data->metric); entry->distance = eigrp_calculate_total_metrics(eigrp, entry); } else { ext_data = msg->data.ipv4_ext_data; - if (eigrp_metrics_is_same (&ext_data->metric, &entry->reported_metric)) + if (eigrp_metrics_is_same (ext_data->metric, entry->reported_metric)) return 0; } /* diff --git a/eigrpd/eigrp_topology.h b/eigrpd/eigrp_topology.h index cb1ac793f..4ddc71f6f 100644 --- a/eigrpd/eigrp_topology.h +++ b/eigrpd/eigrp_topology.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_TOPOLOGY_H diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 5c942bd4d..164907885 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -291,17 +290,18 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header * type = stream_getw(s); if (type == EIGRP_TLV_IPv4_INT) { + struct prefix_ipv4 dest_addr; + stream_set_getp(s, s->getp - sizeof(u_int16_t)); tlv = eigrp_read_ipv4_tlv(s); /*searching if destination exists */ - struct prefix_ipv4 *dest_addr; - dest_addr = prefix_ipv4_new(); - dest_addr->prefix = tlv->destination; - dest_addr->prefixlen = tlv->prefix_length; + dest_addr.family = AFI_IP; + dest_addr.prefix = tlv->destination; + dest_addr.prefixlen = tlv->prefix_length; struct eigrp_prefix_entry *dest = - eigrp_topology_table_lookup_ipv4(eigrp->topology_table, dest_addr); + eigrp_topology_table_lookup_ipv4(eigrp->topology_table, &dest_addr); /*if exists it comes to DUAL*/ if (dest != NULL) @@ -331,7 +331,9 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header * /*Here comes topology information save*/ pe = eigrp_prefix_entry_new(); pe->serno = eigrp->serno; - pe->destination_ipv4 = dest_addr; + pe->destination_ipv4 = prefix_ipv4_new(); + prefix_copy((struct prefix *)pe->destination_ipv4, + (struct prefix *)&dest_addr); pe->af = AF_INET; pe->state = EIGRP_FSM_STATE_PASSIVE; pe->nt = EIGRP_TOPOLOGY_TYPE_REMOTE; @@ -342,7 +344,7 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header * ne->reported_metric = tlv->metric; ne->reported_distance = eigrp_calculate_metrics(eigrp, - &tlv->metric); + tlv->metric); /* * Filtering */ @@ -353,93 +355,52 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header * */ alist = ei->list[EIGRP_FILTER_IN]; - if (alist) { - zlog_info ("ALIST PROC IN: %s", alist->name); - } else { - zlog_info("ALIST je prazdny"); - } - /* Check if access-list fits */ - if (alist && access_list_apply (alist, - (struct prefix *) dest_addr) == FILTER_DENY) + if (alist && + access_list_apply (alist, (struct prefix *)&dest_addr) == FILTER_DENY) { /* If yes, set reported metric to Max */ - zlog_info("PROC IN: Nastavujem metriku na MAX"); ne->reported_metric.delay = EIGRP_MAX_METRIC; - zlog_info("PROC IN Prefix: %s", inet_ntoa(dest_addr->prefix)); } else { - zlog_info("PROC IN: NENastavujem metriku "); ne->distance = eigrp_calculate_total_metrics(eigrp, ne); } plist = e->prefix[EIGRP_FILTER_IN]; - if (plist) { - zlog_info ("PLIST PROC IN: %s", plist->name); - } else { - zlog_info("PLIST PROC IN je prazdny"); - } - /* Check if prefix-list fits */ - if (plist && prefix_list_apply (plist, - (struct prefix *) dest_addr) == PREFIX_DENY) + if (plist && + prefix_list_apply (plist, (struct prefix *)&dest_addr) == PREFIX_DENY) { /* If yes, set reported metric to Max */ - zlog_info("PLIST PROC IN: Nastavujem metriku na MAX"); ne->reported_metric.delay = EIGRP_MAX_METRIC; - zlog_info("PLIST PROC IN Prefix: %s", inet_ntoa(dest_addr->prefix)); - } else { - zlog_info("PLIST PROC IN: NENastavujem metriku "); - } + } /*Get access-list from current interface */ - zlog_info("Checking access_list on interface: %s",ei->ifp->name); alist = ei->list[EIGRP_FILTER_IN]; - if (alist) { - zlog_info ("ALIST INT IN: %s", alist->name); - } else { - zlog_info("ALIST INT IN je prazdny"); - } /* Check if access-list fits */ - if (alist && access_list_apply (alist, (struct prefix *) dest_addr) == FILTER_DENY) + if (alist && + access_list_apply (alist, (struct prefix *)&dest_addr) == FILTER_DENY) { /* If yes, set reported metric to Max */ - zlog_info("INT IN: Nastavujem metriku na MAX"); ne->reported_metric.delay = EIGRP_MAX_METRIC; - zlog_info("INT IN Prefix: %s", inet_ntoa(dest_addr->prefix)); - } else { - zlog_info("INT IN: NENastavujem metriku "); - } + } plist = ei->prefix[EIGRP_FILTER_IN]; - if (plist) { - zlog_info ("PLIST INT IN: %s", plist->name); - } else { - zlog_info("PLIST INT IN je prazdny"); - } - /* Check if prefix-list fits */ - if (plist && prefix_list_apply (plist, - (struct prefix *) dest_addr) == PREFIX_DENY) + if (plist && + prefix_list_apply (plist, (struct prefix *)&dest_addr) == PREFIX_DENY) { /* If yes, set reported metric to Max */ - zlog_info("PLIST INT IN: Nastavujem metriku na MAX"); ne->reported_metric.delay = EIGRP_MAX_METRIC; - zlog_info("PLIST INT IN Prefix: %s", inet_ntoa(dest_addr->prefix)); - } else { - zlog_info("PLIST INT IN: NENastavujem metriku "); - } + } /* * End of filtering */ ne->distance = eigrp_calculate_total_metrics(eigrp, ne); - zlog_info("<DEBUG PROC IN Distance: %x", ne->distance); - zlog_info("<DEBUG PROC IN Delay: %x", ne->total_metric.delay); - pe->fdistance = pe->distance = pe->rdistance = ne->distance; ne->prefix = pe; @@ -454,26 +415,6 @@ eigrp_update_receive (struct eigrp *eigrp, struct ip *iph, struct eigrp_header * pe->req_action |= EIGRP_FSM_NEED_UPDATE; listnode_add(eigrp->topology_changes_internalIPV4, pe); - - /* - * This code is a guess. I am not actually - * sure that we should be doing this here. - * But for the moment it installs routes - * into the rib. Which is good? - */ - struct eigrp_fsm_action_message *msg; - msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, - sizeof(struct eigrp_fsm_action_message)); - - msg->packet_type = EIGRP_OPC_UPDATE; - msg->eigrp = eigrp; - msg->data_type =EIGRP_TLV_IPv4_INT; - msg->adv_router = nbr; - msg->data.ipv4_int_type = tlv; - msg->entry = ne; - msg->prefix = pe; - int event = eigrp_get_fsm_event(msg); - eigrp_fsm_event(msg, event); } eigrp_IPv4_InternalTLV_free (tlv); } @@ -669,6 +610,7 @@ eigrp_update_send (struct eigrp_interface *ei) struct prefix_list *plist_i; struct eigrp *e; struct prefix_ipv4 *dest_addr; + bool packet_sent = false; u_int16_t length = EIGRP_HEADER_LEN; @@ -740,7 +682,8 @@ eigrp_update_send (struct eigrp_interface *ei) return; } - if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) + if((IF_DEF_PARAMS (ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5) + && (IF_DEF_PARAMS (ei->ifp)->auth_keychain != NULL)) { eigrp_make_md5_digest(ei,ep->s, EIGRP_AUTH_UPDATE_FLAG); } @@ -762,6 +705,7 @@ eigrp_update_send (struct eigrp_interface *ei) { if (nbr->state == EIGRP_NEIGHBOR_UP) { + packet_sent = true; /*Put packet to retransmission queue*/ eigrp_fifo_push_head(nbr->retrans_queue, ep); @@ -771,6 +715,9 @@ eigrp_update_send (struct eigrp_interface *ei) } } } + + if (!packet_sent) + eigrp_packet_free(ep); } void diff --git a/eigrpd/eigrp_vty.c b/eigrpd/eigrp_vty.c index cc346405a..c6ff7b5a8 100644 --- a/eigrpd/eigrp_vty.c +++ b/eigrpd/eigrp_vty.c @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -127,9 +126,33 @@ config_write_interfaces (struct vty *vty, struct eigrp *eigrp) static int eigrp_write_interface (struct vty *vty) { - int write=0; + struct listnode *node; + struct interface *ifp; + + for (ALL_LIST_ELEMENTS_RO (vrf_iflist(VRF_DEFAULT), node, ifp)) { + vty_out (vty, "interface %s%s", ifp->name, + VTY_NEWLINE); + + if (ifp->desc) + vty_out (vty, " description %s%s", ifp->desc, + VTY_NEWLINE); + + if (IF_DEF_PARAMS (ifp)->bandwidth != EIGRP_BANDWIDTH_DEFAULT) + vty_out (vty, " bandwidth %u%s", IF_DEF_PARAMS (ifp)->bandwidth, + VTY_NEWLINE); + if (IF_DEF_PARAMS (ifp)->delay != EIGRP_DELAY_DEFAULT) + vty_out (vty, " delay %u%s", IF_DEF_PARAMS (ifp)->delay, VTY_NEWLINE); + if (IF_DEF_PARAMS (ifp)->v_hello != EIGRP_HELLO_INTERVAL_DEFAULT) + vty_out (vty, " ip hello-interval eigrp %u%s", + IF_DEF_PARAMS (ifp)->v_hello, VTY_NEWLINE); + if (IF_DEF_PARAMS (ifp)->v_wait != EIGRP_HOLD_INTERVAL_DEFAULT) + vty_out (vty, " ip hold-time eigrp %u%s", + IF_DEF_PARAMS (ifp)->v_wait, VTY_NEWLINE); + + vty_out (vty, "!%s", VTY_NEWLINE); + } - return write; + return 0; } /** @@ -206,7 +229,17 @@ DEFUN (no_router_eigrp, { vty->node = CONFIG_NODE; - /*TODO: */ + struct eigrp *eigrp; + + eigrp = eigrp_lookup (); + if (eigrp->AS != atoi (argv[3]->arg)) + { + vty_out (vty, "%% Attempting to deconfigure non-existent AS%s", + VTY_NEWLINE); + return CMD_WARNING; + } + + eigrp_finish_final (eigrp); return CMD_SUCCESS; } @@ -416,43 +449,7 @@ DEFUN (no_eigrp_neighbor, DEFUN (show_ip_eigrp_topology, show_ip_eigrp_topology_cmd, - "show ip eigrp topology", - SHOW_STR - IP_STR - "IP-EIGRP show commands\n" - "IP-EIGRP topology\n") -{ - struct eigrp *eigrp; - struct listnode *node, *nnode, *node2, *nnode2; - struct eigrp_prefix_entry *tn; - struct eigrp_neighbor_entry *te; - - eigrp = eigrp_lookup (); - if (eigrp == NULL) - { - vty_out (vty, " EIGRP Routing Process not enabled%s", VTY_NEWLINE); - return CMD_SUCCESS; - } - - show_ip_eigrp_topology_header (vty, eigrp); - - for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn)) - { - show_ip_eigrp_prefix_entry (vty,tn); - for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te)) - { - if (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)|| - ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG)) - show_ip_eigrp_neighbor_entry (vty, eigrp, te); - } - } - - return CMD_SUCCESS; -} - -DEFUN (show_ip_eigrp_topology_all_links, - show_ip_eigrp_topology_all_links_cmd, - "show ip eigrp topology all-links", + "show ip eigrp topology [all-links]", SHOW_STR IP_STR "IP-EIGRP show commands\n" @@ -460,9 +457,10 @@ DEFUN (show_ip_eigrp_topology_all_links, "Show all links in topology table\n") { struct eigrp *eigrp; - struct listnode *node, *nnode, *node2, *nnode2; + struct listnode *node, *node2; struct eigrp_prefix_entry *tn; struct eigrp_neighbor_entry *te; + int first; eigrp = eigrp_lookup (); if (eigrp == NULL) @@ -473,12 +471,18 @@ DEFUN (show_ip_eigrp_topology_all_links, show_ip_eigrp_topology_header (vty, eigrp); - for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, tn)) + for (ALL_LIST_ELEMENTS_RO (eigrp->topology_table, node, tn)) { - show_ip_eigrp_prefix_entry (vty,tn); - for (ALL_LIST_ELEMENTS (tn->entries, node2, nnode2, te)) + first = 1; + for (ALL_LIST_ELEMENTS_RO (tn->entries, node2, te)) { - show_ip_eigrp_neighbor_entry (vty, eigrp, te); + if (argc == 5 || + (((te->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)|| + ((te->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))) + { + show_ip_eigrp_neighbor_entry (vty, eigrp, te, &first); + first = 0; + } } } @@ -611,6 +615,7 @@ DEFUN (eigrp_if_delay, delay = atoi (argv[1]->arg); IF_DEF_PARAMS (ifp)->delay = delay; + eigrp_if_reset (ifp); return CMD_SUCCESS; } @@ -634,13 +639,15 @@ DEFUN (no_eigrp_if_delay, } IF_DEF_PARAMS (ifp)->delay = EIGRP_DELAY_DEFAULT; + eigrp_if_reset (ifp); return CMD_SUCCESS; } DEFUN (eigrp_if_bandwidth, eigrp_if_bandwidth_cmd, - "bandwidth (1-10000000)", + "eigrp bandwidth (1-10000000)", + "EIGRP specific commands\n" "Set bandwidth informational parameter\n" "Bandwidth in kilobits\n") { @@ -658,23 +665,21 @@ DEFUN (eigrp_if_bandwidth, bandwidth = atoi (argv[1]->arg); IF_DEF_PARAMS (ifp)->bandwidth = bandwidth; + eigrp_if_reset (ifp); return CMD_SUCCESS; } DEFUN (no_eigrp_if_bandwidth, no_eigrp_if_bandwidth_cmd, - "bandwidth (1-10000000)", + "no eigrp bandwidth [(1-10000000)]", + NO_STR + "EIGRP specific commands\n" "Set bandwidth informational parameter\n" "Bandwidth in kilobits\n") { VTY_DECLVAR_CONTEXT(interface, ifp); - u_int32_t bandwidth; struct eigrp *eigrp; - struct eigrp_interface *ei; - struct listnode *node, *nnode, *node2, *nnode2; - struct eigrp_prefix_entry *pe; - struct eigrp_neighbor_entry *ne; eigrp = eigrp_lookup (); if (eigrp == NULL) @@ -683,25 +688,8 @@ DEFUN (no_eigrp_if_bandwidth, return CMD_SUCCESS; } - bandwidth = atoi (argv[1]->arg); - - IF_DEF_PARAMS (ifp)->bandwidth = bandwidth; - - for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei)) - { - if (ei->ifp == ifp) - break; - } - - for (ALL_LIST_ELEMENTS (eigrp->topology_table, node, nnode, pe)) - { - for (ALL_LIST_ELEMENTS (pe->entries, node2, nnode2, ne)) - { - if (ne->ei == ei) - break; - /*TODO: */ - } - } + IF_DEF_PARAMS (ifp)->bandwidth = EIGRP_BANDWIDTH_DEFAULT; + eigrp_if_reset (ifp); return CMD_SUCCESS; } @@ -734,7 +722,7 @@ DEFUN (eigrp_if_ip_hellointerval, DEFUN (no_eigrp_if_ip_hellointerval, no_eigrp_if_ip_hellointerval_cmd, - "no ip hello-interval eigrp (1-65535)", + "no ip hello-interval eigrp [(1-65535)]", NO_STR "Interface Internet Protocol config commands\n" "Configures EIGRP hello interval\n" @@ -743,6 +731,8 @@ DEFUN (no_eigrp_if_ip_hellointerval, { VTY_DECLVAR_CONTEXT(interface, ifp); struct eigrp *eigrp; + struct eigrp_interface *ei; + struct listnode *node, *nnode; eigrp = eigrp_lookup (); if (eigrp == NULL) @@ -753,6 +743,16 @@ DEFUN (no_eigrp_if_ip_hellointerval, IF_DEF_PARAMS (ifp)->v_hello = EIGRP_HELLO_INTERVAL_DEFAULT; + for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei)) + { + if (ei->ifp == ifp) + { + THREAD_TIMER_OFF (ei->t_hello); + thread_add_timer (master, eigrp_hello_timer, ei, 1, &ei->t_hello); + break; + } + } + return CMD_SUCCESS; } @@ -760,7 +760,7 @@ DEFUN (eigrp_if_ip_holdinterval, eigrp_if_ip_holdinterval_cmd, "ip hold-time eigrp (1-65535)", "Interface Internet Protocol config commands\n" - "Configures EIGRP hello interval\n" + "Configures EIGRP IPv4 hold time\n" "Enhanced Interior Gateway Routing Protocol (EIGRP)\n" "Seconds before neighbor is considered down\n") { @@ -837,8 +837,6 @@ DEFUN (no_eigrp_ip_summary_address, return CMD_SUCCESS; } - - DEFUN (no_eigrp_if_ip_holdinterval, no_eigrp_if_ip_holdinterval_cmd, "no ip hold-time eigrp", @@ -1014,7 +1012,7 @@ DEFUN (no_eigrp_authentication_keychain, DEFUN (eigrp_redistribute_source_metric, eigrp_redistribute_source_metric_cmd, "redistribute " FRR_REDIST_STR_EIGRPD - " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)", + " [metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)]", REDIST_STR FRR_REDIST_HELP_STR_EIGRPD "Metric for redistributed routes\n" @@ -1482,8 +1480,6 @@ eigrp_vty_show_init (void) install_element (VIEW_NODE, &show_ip_eigrp_topology_cmd); - install_element (VIEW_NODE, &show_ip_eigrp_topology_all_links_cmd); - install_element (VIEW_NODE, &show_ip_eigrp_topology_detail_cmd); } diff --git a/eigrpd/eigrp_vty.h b/eigrpd/eigrp_vty.h index 56a40263f..f78a46f62 100644 --- a/eigrpd/eigrp_vty.h +++ b/eigrpd/eigrp_vty.h @@ -24,10 +24,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_EIGRP_VTY_H diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 627d564a7..2baad7526 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -444,8 +443,13 @@ eigrp_zebra_route_add (struct prefix_ipv4 *p, struct list *successors) /* Nexthop, ifindex, distance and metric information. */ for (ALL_LIST_ELEMENTS_RO (successors, node, te)) { - stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX); - stream_put_in_addr (s, &te->adv_router->src); + if (te->adv_router->src.s_addr) + { + stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX); + stream_put_in_addr (s, &te->adv_router->src); + } + else + stream_putc (s, NEXTHOP_TYPE_IFINDEX); stream_putl (s, te->ei->ifp->ifindex); } @@ -505,7 +509,7 @@ eigrp_redistribute_set (struct eigrp *eigrp, int type, struct eigrp_metrics metr if (eigrp_is_type_redistributed (type)) { - if (eigrp_metrics_is_same(&metric, &eigrp->dmetric[type])) + if (eigrp_metrics_is_same(metric, eigrp->dmetric[type])) { eigrp->dmetric[type] = metric; } diff --git a/eigrpd/eigrp_zebra.h b/eigrpd/eigrp_zebra.h index 4cd6b1e95..0991d35ab 100644 --- a/eigrpd/eigrp_zebra.h +++ b/eigrpd/eigrp_zebra.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRP_ZEBRA_H_ diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index 40885c8a4..93a69b776 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -61,7 +60,6 @@ static struct eigrp_master eigrp_master; struct eigrp_master *eigrp_om; -static void eigrp_finish_final(struct eigrp *); static void eigrp_delete(struct eigrp *); static struct eigrp *eigrp_new(const char *); static void eigrp_add(struct eigrp *); @@ -188,7 +186,7 @@ eigrp_new (const char *AS) eigrp->topology_table = eigrp_topology_new(); eigrp->neighbor_self = eigrp_nbr_new(NULL); - inet_aton("127.0.0.1", &eigrp->neighbor_self->src); + inet_aton("0.0.0.0", &eigrp->neighbor_self->src); eigrp->variance = EIGRP_VARIANCE_DEFAULT; eigrp->max_paths = EIGRP_MAX_PATHS_DEFAULT; @@ -262,26 +260,39 @@ eigrp_terminate (void) void eigrp_finish (struct eigrp *eigrp) { - eigrp_finish_final(eigrp); /* eigrp being shut-down? If so, was this the last eigrp instance? */ if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN) && (listcount(eigrp_om->eigrp) == 0)) - exit(0); + { + if (zclient) + zclient_free (zclient); + + exit(0); + } return; } /* Final cleanup of eigrp instance */ -static void +void eigrp_finish_final (struct eigrp *eigrp) { + struct eigrp_interface *ei; + struct eigrp_neighbor *nbr; + struct listnode *node, *nnode, *node2, *nnode2; - close(eigrp->fd); + for (ALL_LIST_ELEMENTS (eigrp->eiflist, node, nnode, ei)) + { + for (ALL_LIST_ELEMENTS (ei->nbrs, node2, nnode2, nbr)) + eigrp_nbr_delete (nbr); + eigrp_if_free (ei, INTERFACE_DOWN_BY_FINAL); + } - if (zclient) - zclient_free(zclient); + THREAD_OFF (eigrp->t_write); + THREAD_OFF (eigrp->t_read); + close (eigrp->fd); list_delete(eigrp->eiflist); list_delete(eigrp->oi_write_q); diff --git a/eigrpd/eigrpd.h b/eigrpd/eigrpd.h index 61d4ba752..b3f233c58 100644 --- a/eigrpd/eigrpd.h +++ b/eigrpd/eigrpd.h @@ -20,10 +20,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_EIGRPD_H @@ -46,6 +45,7 @@ extern struct eigrp_master *eigrp_om; /* Prototypes */ extern void eigrp_master_init (void); extern void eigrp_terminate (void); + extern void eigrp_finish_final (struct eigrp *); extern void eigrp_finish (struct eigrp *); extern struct eigrp *eigrp_get (const char *); extern struct eigrp *eigrp_lookup (void); diff --git a/fpm/fpm_pb.c b/fpm/fpm_pb.c index ba18627ea..5cd03a4d5 100644 --- a/fpm/fpm_pb.c +++ b/fpm/fpm_pb.c @@ -17,10 +17,9 @@ * 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. + * 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 */ /* diff --git a/fpm/fpm_pb.h b/fpm/fpm_pb.h index 8f74ac06e..2e5f3d052 100644 --- a/fpm/fpm_pb.h +++ b/fpm/fpm_pb.h @@ -17,10 +17,9 @@ * 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. + * 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 */ /* diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index e3643868d..1869346f8 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index 4f89e3096..a81797bb1 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -16,10 +16,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_ADJACENCY_H diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 0a1610b6f..4ebaa4a1e 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 190811bac..bafc37a75 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> #ifdef GNU_LINUX diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 16dfa6304..82ca7ca0d 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISIS_CIRCUIT_H diff --git a/isisd/isis_common.h b/isisd/isis_common.h index d158961b9..6c827115b 100644 --- a/isisd/isis_common.h +++ b/isisd/isis_common.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISIS_COMMON_H diff --git a/isisd/isis_constants.h b/isisd/isis_constants.h index ec0f6fb62..b59d77bf3 100644 --- a/isisd/isis_constants.h +++ b/isisd/isis_constants.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISIS_CONSTANTS_H diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c index 0fbf47aea..90272d68b 100644 --- a/isisd/isis_csm.c +++ b/isisd/isis_csm.c @@ -15,9 +15,9 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/isisd/isis_csm.h b/isisd/isis_csm.h index d6b13ac69..a1e0f234f 100644 --- a/isisd/isis_csm.h +++ b/isisd/isis_csm.h @@ -16,10 +16,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_CSM_H #define _ZEBRA_ISIS_CSM_H diff --git a/isisd/isis_dlpi.c b/isisd/isis_dlpi.c index 98b18ac38..afd8a14f9 100644 --- a/isisd/isis_dlpi.c +++ b/isisd/isis_dlpi.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index def6e3860..96cf8488d 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ diff --git a/isisd/isis_dr.h b/isisd/isis_dr.h index bad683614..801cd0e47 100644 --- a/isisd/isis_dr.h +++ b/isisd/isis_dr.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_DR_H diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index 541bfe4a5..0c702e672 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -15,9 +15,9 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/isisd/isis_dynhn.h b/isisd/isis_dynhn.h index f06a067be..c36d9a009 100644 --- a/isisd/isis_dynhn.h +++ b/isisd/isis_dynhn.h @@ -16,9 +16,9 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _ZEBRA_ISIS_DYNHN_H #define _ZEBRA_ISIS_DYNHN_H diff --git a/isisd/isis_events.c b/isisd/isis_events.c index 32415092a..8011d2db9 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_events.h b/isisd/isis_events.h index e7cfa3509..e9aa05db7 100644 --- a/isisd/isis_events.h +++ b/isisd/isis_events.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_EVENTS_H #define _ZEBRA_ISIS_EVENTS_H diff --git a/isisd/isis_flags.c b/isisd/isis_flags.c index ec0eaa4f8..6c88cfeda 100644 --- a/isisd/isis_flags.c +++ b/isisd/isis_flags.c @@ -16,9 +16,9 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/isisd/isis_flags.h b/isisd/isis_flags.h index e2e42adcc..ba11cf42b 100644 --- a/isisd/isis_flags.h +++ b/isisd/isis_flags.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_FLAGS_H diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index b7e66d13a..29e5280ce 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -16,10 +16,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h index 6f697df62..0d1dd6740 100644 --- a/isisd/isis_lsp.h +++ b/isisd/isis_lsp.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_LSP_H diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 644b652d4..58070c7f2 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> @@ -206,7 +206,7 @@ main (int argc, char **argv, char **envp) * initializations */ access_list_init(); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); prefix_list_init(); isis_init (); isis_circuit_init (); diff --git a/isisd/isis_memory.c b/isisd/isis_memory.c index f3ecc6cd7..101fdcc69 100644 --- a/isisd/isis_memory.c +++ b/isisd/isis_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/isisd/isis_memory.h b/isisd/isis_memory.h index 9345229da..7729ebac3 100644 --- a/isisd/isis_memory.h +++ b/isisd/isis_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_ISIS_MEMORY_H diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index f19b44155..3869159a0 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h index 37eaea154..a71edd8e6 100644 --- a/isisd/isis_misc.h +++ b/isisd/isis_misc.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_MISC_H diff --git a/isisd/isis_mt.c b/isisd/isis_mt.c index d15da1d27..269802e9f 100644 --- a/isisd/isis_mt.c +++ b/isisd/isis_mt.c @@ -15,10 +15,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> #include "isisd/isisd.h" diff --git a/isisd/isis_mt.h b/isisd/isis_mt.h index d4dc4c6f2..e90f1756f 100644 --- a/isisd/isis_mt.h +++ b/isisd/isis_mt.h @@ -15,10 +15,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 ISIS_MT_H #define ISIS_MT_H diff --git a/isisd/isis_network.h b/isisd/isis_network.h index e1e10dfdb..41788e69f 100644 --- a/isisd/isis_network.h +++ b/isisd/isis_network.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index bca3f91d4..d62682b10 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> @@ -1315,7 +1315,8 @@ process_lsp (int level, struct isis_circuit *circuit, const u_char *ssnpa) /* Checksum sanity check - FIXME: move to correct place */ /* 12 = sysid+pdu+remtime */ if (iso_csum_verify (STREAM_PNT (circuit->rcv_stream) + 4, - pdu_len - 12, &hdr->checksum)) + pdu_len - 12, hdr->checksum, + offsetof(struct isis_link_state_hdr, checksum) - 4)) { zlog_debug ("ISIS-Upd (%s): LSP %s invalid LSP checksum 0x%04x", circuit->area->area_tag, diff --git a/isisd/isis_pdu.h b/isisd/isis_pdu.h index 3eca73193..e512b6b1b 100644 --- a/isisd/isis_pdu.h +++ b/isisd/isis_pdu.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_PDU_H diff --git a/isisd/isis_pfpacket.c b/isisd/isis_pfpacket.c index 5c434b90d..c5985dcd8 100644 --- a/isisd/isis_pfpacket.c +++ b/isisd/isis_pfpacket.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index bdf90aaa1..b0c065bdf 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -12,10 +12,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_redist.h b/isisd/isis_redist.h index cc9c2e634..11b3c31e2 100644 --- a/isisd/isis_redist.h +++ b/isisd/isis_redist.h @@ -12,10 +12,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISIS_REDIST_H diff --git a/isisd/isis_route.c b/isisd/isis_route.c index e3256f2d0..bceb70ce0 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -16,10 +16,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_route.h b/isisd/isis_route.h index de23070aa..24bd786fa 100644 --- a/isisd/isis_route.h +++ b/isisd/isis_route.h @@ -17,10 +17,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_ROUTE_H #define _ZEBRA_ISIS_ROUTE_H diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c index 61f3315f0..cf4562dbc 100644 --- a/isisd/isis_routemap.c +++ b/isisd/isis_routemap.c @@ -12,10 +12,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_routemap.h b/isisd/isis_routemap.h index 1cb063fee..b0ff559ac 100644 --- a/isisd/isis_routemap.h +++ b/isisd/isis_routemap.h @@ -12,10 +12,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISIS_ROUTEMAP_H #define ISIS_ROUTEMAP_H diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 1eb258614..ca268cec7 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -16,10 +16,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index 9f06dbb60..8c72f45c5 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_SPF_H diff --git a/isisd/isis_te.c b/isisd/isis_te.c index b04d0db3c..1f9c2b963 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -18,10 +18,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/isisd/isis_te.h b/isisd/isis_te.h index 1578d3770..3c99c9085 100644 --- a/isisd/isis_te.h +++ b/isisd/isis_te.h @@ -18,10 +18,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_ISIS_MPLS_TE_H diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index b033e35a2..7ffa7509c 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h index 2135f5071..e55e81bce 100644 --- a/isisd/isis_tlv.h +++ b/isisd/isis_tlv.h @@ -16,9 +16,9 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _ZEBRA_ISIS_TLV_H diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 9cae5f9a5..4d758315e 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 3b128a689..4dd7ec5c3 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h index 217e3d48c..aeead3c3b 100644 --- a/isisd/isis_zebra.h +++ b/isisd/isis_zebra.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ISIS_ZEBRA_H #define _ZEBRA_ISIS_ZEBRA_H diff --git a/isisd/isisd.c b/isisd/isisd.c index fedac084e..c1968918e 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> diff --git a/isisd/isisd.h b/isisd/isisd.h index a8cf3673f..9b6281866 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -14,10 +14,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 ISISD_H diff --git a/isisd/iso_checksum.c b/isisd/iso_checksum.c index 294fe9942..70b6b91ed 100644 --- a/isisd/iso_checksum.c +++ b/isisd/iso_checksum.c @@ -15,10 +15,10 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * 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 */ #include <zebra.h> @@ -46,14 +46,14 @@ */ int -iso_csum_verify (u_char * buffer, int len, uint16_t * csum) +iso_csum_verify (u_char * buffer, int len, uint16_t csum, int offset) { u_int16_t checksum; u_int32_t c0; u_int32_t c1; - c0 = *csum & 0xff00; - c1 = *csum & 0x00ff; + c0 = csum & 0xff00; + c1 = csum & 0x00ff; /* * If both are zero return correct @@ -67,11 +67,8 @@ iso_csum_verify (u_char * buffer, int len, uint16_t * csum) if (c0 == 0 || c1 == 0) return 1; - /* Offset of checksum from the start of the buffer */ - int offset = (u_char *) csum - buffer; - checksum = fletcher_checksum(buffer, len, offset); - if (checksum == *csum) + if (checksum == csum) return 0; return 1; } diff --git a/isisd/iso_checksum.h b/isisd/iso_checksum.h index 5f8d41f9e..50f6a7d56 100644 --- a/isisd/iso_checksum.h +++ b/isisd/iso_checksum.h @@ -16,13 +16,13 @@ * 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _ZEBRA_ISO_CSUM_H #define _ZEBRA_ISO_CSUM_H -int iso_csum_verify (u_char * buffer, int len, uint16_t * csum); +int iso_csum_verify (u_char * buffer, int len, uint16_t csum, int offset); #endif /* _ZEBRA_ISO_CSUM_H */ diff --git a/ldpd/lde.c b/ldpd/lde.c index bef35f319..8d2a9dd9d 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -1623,6 +1623,8 @@ zclient_sync_init(u_short instance) log_warnx("Error connecting synchronous zclient!"); sleep(1); } + /* make socket non-blocking */ + sock_set_nonblock(zclient_sync->sock); /* Connect to label manager */ while (lm_label_manager_connect(zclient_sync) != 0) { @@ -1647,8 +1649,6 @@ lde_get_label_chunk(void) ret = lm_get_label_chunk(zclient_sync, 0, CHUNK_SIZE, &start, &end); if (ret < 0) { log_warnx("Error getting label chunk!"); - close(zclient_sync->sock); - zclient_sync->sock = -1; return -1; } diff --git a/ldpd/ldp_debug.c b/ldpd/ldp_debug.c index 86b679d8a..4419f853b 100644 --- a/ldpd/ldp_debug.c +++ b/ldpd/ldp_debug.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ldpd/ldp_debug.h b/ldpd/ldp_debug.h index f944851b6..6366d3f6a 100644 --- a/ldpd/ldp_debug.h +++ b/ldpd/ldp_debug.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _LDP_DEBUG_H_ diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h index 8510a394e..21a486ff6 100644 --- a/ldpd/ldp_vty.h +++ b/ldpd/ldp_vty.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _LDP_VTY_H_ diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c index 6943e8edc..37288f4c0 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index ffd20abb4..3463fb6c6 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index 3320238a0..1a93f5a86 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index a0b021dfd..61e8e8268 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -277,9 +277,9 @@ main(int argc, char *argv[]) exit(1); } - openzlog(ldpd_di.progname, "LDP", 0, - LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); - + if (lflag || eflag) + openzlog(ldpd_di.progname, "LDP", 0, + LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); if (lflag) lde(); else if (eflag) @@ -316,20 +316,10 @@ main(int argc, char *argv[]) ldpe_pid = start_child(PROC_LDP_ENGINE, saved_argv0, pipe_parent2ldpe[1], pipe_parent2ldpe_sync[1]); - /* drop privileges */ - zprivs_init(&ldpd_privs); - - /* setup signal handler */ - signal_init(master, array_size(ldp_signals), ldp_signals); - - /* thread master */ - master = thread_master_create(); + master = frr_init(); - /* library inits */ - cmd_init(1); vty_config_lockless(); - vty_init(master); - vrf_init(); + vrf_init(NULL, NULL, NULL, NULL); access_list_init(); ldp_vty_init(); ldp_zebra_init(master); diff --git a/lib/Makefile.am b/lib/Makefile.am index 6e3c6d680..a1b78d3c4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -17,6 +17,7 @@ libfrr_la_SOURCES = \ network.c pid_output.c getopt.c getopt1.c \ checksum.c vector.c linklist.c vty.c \ graph.c command_parse.y command_lex.l command_match.c \ + command_graph.c \ command.c \ sockunion.c prefix.c thread.c if.c buffer.c table.c hash.c \ filter.c routemap.c distribute.c stream.c log.c plist.c \ @@ -60,6 +61,7 @@ pkginclude_HEADERS = \ buffer.h checksum.h filter.h getopt.h hash.h \ if.h linklist.h log.h \ graph.h command_match.h \ + command_graph.h \ command.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ stream.h table.h thread.h vector.h version.h vty.h zebra.h \ @@ -78,6 +80,7 @@ pkginclude_HEADERS = \ libfrr.h \ sha256.h \ frr_pthread.h \ + vrf_int.h \ # end noinst_HEADERS = \ diff --git a/lib/agentx.c b/lib/agentx.c index 5deb8f1e0..fda634bb8 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_BFD_H diff --git a/lib/bitfield.h b/lib/bitfield.h index 7062796a9..4ff9c7fb2 100644 --- a/lib/bitfield.h +++ b/lib/bitfield.h @@ -13,10 +13,9 @@ * 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. + * 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 */ /** * A simple bit array implementation to allocate and free IDs. An example diff --git a/lib/buffer.c b/lib/buffer.c index 1dfcdb473..649677fc9 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -8,16 +8,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/buffer.h b/lib/buffer.h index 6c3dc76a1..67ac71cad 100644 --- a/lib/buffer.h +++ b/lib/buffer.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_BUFFER_H diff --git a/lib/command.c b/lib/command.c index 661629325..835c27cdd 100644 --- a/lib/command.c +++ b/lib/command.c @@ -19,10 +19,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -40,15 +39,13 @@ #include "workqueue.h" #include "vrf.h" #include "command_match.h" +#include "command_graph.h" #include "qobj.h" #include "defaults.h" DEFINE_MTYPE( LIB, HOST, "Host config") DEFINE_MTYPE( LIB, STRVEC, "String vector") -DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command Tokens") -DEFINE_MTYPE_STATIC(LIB, CMD_DESC, "Command Token Text") -DEFINE_MTYPE_STATIC(LIB, CMD_TEXT, "Command Token Help") -DEFINE_MTYPE( LIB, CMD_ARG, "Command Argument") +DEFINE_MTYPE( LIB, COMPLETION, "Completion item") /* Command vector which includes some level of command lists. Normally each daemon maintains each own cmdvec. */ @@ -234,8 +231,8 @@ install_node (struct cmd_node *node, node->cmdgraph = graph_new (); node->cmd_vector = vector_init (VECTOR_MIN_SIZE); // add start node - struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); - graph_new_node (node->cmdgraph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); + graph_new_node (node->cmdgraph, token, (void (*)(void *)) &cmd_token_del); node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp); } @@ -306,272 +303,6 @@ cmd_prompt (enum node_type node) return cnode->prompt; } -static bool -cmd_nodes_link (struct graph_node *from, struct graph_node *to) -{ - for (size_t i = 0; i < vector_active (from->to); i++) - if (vector_slot (from->to, i) == to) - return true; - return false; -} - -static bool cmd_nodes_equal (struct graph_node *ga, struct graph_node *gb); - -/* returns a single node to be excluded as "next" from iteration - * - for JOIN_TKN, never continue back to the FORK_TKN - * - in all other cases, don't try the node itself (in case of "...") - */ -static inline struct graph_node * -cmd_loopstop(struct graph_node *gn) -{ - struct cmd_token *tok = gn->data; - if (tok->type == JOIN_TKN) - return tok->forkjoin; - else - return gn; -} - -static bool -cmd_subgraph_equal (struct graph_node *ga, struct graph_node *gb, - struct graph_node *a_join) -{ - size_t i, j; - struct graph_node *a_fork, *b_fork; - a_fork = cmd_loopstop (ga); - b_fork = cmd_loopstop (gb); - - if (vector_active (ga->to) != vector_active (gb->to)) - return false; - for (i = 0; i < vector_active (ga->to); i++) - { - struct graph_node *cga = vector_slot (ga->to, i); - - for (j = 0; j < vector_active (gb->to); j++) - { - struct graph_node *cgb = vector_slot (gb->to, i); - - if (cga == a_fork && cgb != b_fork) - continue; - if (cga == a_fork && cgb == b_fork) - break; - - if (cmd_nodes_equal (cga, cgb)) - { - if (cga == a_join) - break; - if (cmd_subgraph_equal (cga, cgb, a_join)) - break; - } - } - if (j == vector_active (gb->to)) - return false; - } - return true; -} - -/* deep compare -- for FORK_TKN, the entire subgraph is compared. - * this is what's needed since we're not currently trying to partially - * merge subgraphs */ -static bool -cmd_nodes_equal (struct graph_node *ga, struct graph_node *gb) -{ - struct cmd_token *a = ga->data, *b = gb->data; - - if (a->type != b->type || a->allowrepeat != b->allowrepeat) - return false; - if (a->type < SPECIAL_TKN && strcmp (a->text, b->text)) - return false; - /* one a ..., the other not. */ - if (cmd_nodes_link (ga, ga) != cmd_nodes_link (gb, gb)) - return false; - - switch (a->type) - { - case RANGE_TKN: - return a->min == b->min && a->max == b->max; - - case FORK_TKN: - /* one is keywords, the other just option or selector ... */ - if (cmd_nodes_link (a->forkjoin, ga) != cmd_nodes_link (b->forkjoin, gb)) - return false; - if (cmd_nodes_link (ga, a->forkjoin) != cmd_nodes_link (gb, b->forkjoin)) - return false; - return cmd_subgraph_equal (ga, gb, a->forkjoin); - - default: - return true; - } -} - -static void -cmd_fork_bump_attr (struct graph_node *gn, struct graph_node *join, - u_char attr) -{ - size_t i; - struct cmd_token *tok = gn->data; - struct graph_node *stop = cmd_loopstop (gn); - - tok->attr = attr; - for (i = 0; i < vector_active (gn->to); i++) - { - struct graph_node *next = vector_slot (gn->to, i); - if (next == stop || next == join) - continue; - cmd_fork_bump_attr (next, join, attr); - } -} - -/* move an entire subtree from the temporary graph resulting from - * parse() into the permanent graph for the command node. - * - * this touches rather deeply into the graph code unfortunately. - */ -static void -cmd_reparent_tree (struct graph *fromgraph, struct graph *tograph, - struct graph_node *node) -{ - struct graph_node *stop = cmd_loopstop (node); - size_t i; - - for (i = 0; i < vector_active (fromgraph->nodes); i++) - if (vector_slot (fromgraph->nodes, i) == node) - { - /* agressive iteration punching through subgraphs - may hit some - * nodes twice. reparent only if found on old graph */ - vector_unset (fromgraph->nodes, i); - vector_set (tograph->nodes, node); - break; - } - - for (i = 0; i < vector_active (node->to); i++) - { - struct graph_node *next = vector_slot (node->to, i); - if (next != stop) - cmd_reparent_tree (fromgraph, tograph, next); - } -} - -static void -cmd_free_recur (struct graph *graph, struct graph_node *node, - struct graph_node *stop) -{ - struct graph_node *next, *nstop; - - for (size_t i = vector_active (node->to); i; i--) - { - next = vector_slot (node->to, i - 1); - if (next == stop) - continue; - nstop = cmd_loopstop (next); - if (nstop != next) - cmd_free_recur (graph, next, nstop); - cmd_free_recur (graph, nstop, stop); - } - graph_delete_node (graph, node); -} - -static void -cmd_free_node (struct graph *graph, struct graph_node *node) -{ - struct cmd_token *tok = node->data; - if (tok->type == JOIN_TKN) - cmd_free_recur (graph, tok->forkjoin, node); - graph_delete_node (graph, node); -} - -/* recursive graph merge. call with - * old ~= new - * (which holds true for old == START_TKN, new == START_TKN) - */ -static void -cmd_merge_nodes (struct graph *oldgraph, struct graph *newgraph, - struct graph_node *old, struct graph_node *new, - int direction) -{ - struct cmd_token *tok; - struct graph_node *old_skip, *new_skip; - old_skip = cmd_loopstop (old); - new_skip = cmd_loopstop (new); - - assert (direction == 1 || direction == -1); - - tok = old->data; - tok->refcnt += direction; - - size_t j, i; - for (j = 0; j < vector_active (new->to); j++) - { - struct graph_node *cnew = vector_slot (new->to, j); - if (cnew == new_skip) - continue; - - for (i = 0; i < vector_active (old->to); i++) - { - struct graph_node *cold = vector_slot (old->to, i); - if (cold == old_skip) - continue; - - if (cmd_nodes_equal (cold, cnew)) - { - struct cmd_token *told = cold->data, *tnew = cnew->data; - - if (told->type == END_TKN) - { - if (direction < 0) - { - graph_delete_node (oldgraph, vector_slot (cold->to, 0)); - graph_delete_node (oldgraph, cold); - } - else - /* force no-match handling to install END_TKN */ - i = vector_active (old->to); - break; - } - - /* the entire fork compared as equal, we continue after it. */ - if (told->type == FORK_TKN) - { - if (tnew->attr < told->attr && direction > 0) - cmd_fork_bump_attr (cold, told->forkjoin, tnew->attr); - /* XXX: no reverse bump on uninstall */ - told = (cold = told->forkjoin)->data; - tnew = (cnew = tnew->forkjoin)->data; - } - if (tnew->attr < told->attr) - told->attr = tnew->attr; - - cmd_merge_nodes (oldgraph, newgraph, cold, cnew, direction); - break; - } - } - /* nothing found => add new to old */ - if (i == vector_active (old->to) && direction > 0) - { - assert (vector_count (cnew->from) == - cmd_nodes_link (cnew, cnew) ? 2 : 1); - graph_remove_edge (new, cnew); - - cmd_reparent_tree (newgraph, oldgraph, cnew); - - graph_add_edge (old, cnew); - } - } - - if (!tok->refcnt) - cmd_free_node (oldgraph, old); -} - -void -cmd_merge_graphs (struct graph *old, struct graph *new, int direction) -{ - assert (vector_active (old->nodes) >= 1); - assert (vector_active (new->nodes) >= 1); - - cmd_merge_nodes (old, new, - vector_slot (old->nodes, 0), vector_slot (new->nodes, 0), - direction); -} - /* Install a command into a node. */ void install_element (enum node_type ntype, struct cmd_element *cmd) @@ -592,6 +323,7 @@ install_element (enum node_type ntype, struct cmd_element *cmd) { fprintf (stderr, "Command node %d doesn't exist, please check it\n", ntype); + fprintf (stderr, "Have you called install_node before this install_element?\n"); exit (EXIT_FAILURE); } @@ -606,11 +338,12 @@ install_element (enum node_type ntype, struct cmd_element *cmd) assert (hash_get (cnode->cmd_hash, cmd, hash_alloc_intern)); struct graph *graph = graph_new(); - struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); - graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); + graph_new_node (graph, token, (void (*)(void *)) &cmd_token_del); - command_parse_format (graph, cmd); - cmd_merge_graphs (cnode->cmdgraph, graph, +1); + cmd_graph_parse (graph, cmd); + cmd_graph_names (graph); + cmd_graph_merge (cnode->cmdgraph, graph, +1); graph_delete_graph (graph); vector_set (cnode->cmd_vector, cmd); @@ -638,6 +371,7 @@ uninstall_element (enum node_type ntype, struct cmd_element *cmd) { fprintf (stderr, "Command node %d doesn't exist, please check it\n", ntype); + fprintf (stderr, "Have you called install_node before this install_element?\n"); exit (EXIT_FAILURE); } @@ -652,11 +386,12 @@ uninstall_element (enum node_type ntype, struct cmd_element *cmd) vector_unset_value (cnode->cmd_vector, cmd); struct graph *graph = graph_new(); - struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); - graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); + graph_new_node (graph, token, (void (*)(void *)) &cmd_token_del); - command_parse_format (graph, cmd); - cmd_merge_graphs (cnode->cmdgraph, graph, -1); + cmd_graph_parse (graph, cmd); + cmd_graph_names (graph); + cmd_graph_merge (cnode->cmdgraph, graph, -1); graph_delete_graph (graph); if (ntype == VIEW_NODE) @@ -945,6 +680,86 @@ cmd_describe_command (vector vline, struct vty *vty, int *status) return cmd_complete_command_real (vline, vty, status); } +static struct list *varhandlers = NULL; + +void +cmd_variable_complete (struct cmd_token *token, const char *arg, vector comps) +{ + struct listnode *ln; + const struct cmd_variable_handler *cvh; + size_t i, argsz; + vector tmpcomps; + + tmpcomps = arg ? vector_init (VECTOR_MIN_SIZE) : comps; + + for (ALL_LIST_ELEMENTS_RO(varhandlers, ln, cvh)) + { + if (cvh->tokenname && strcmp(cvh->tokenname, token->text)) + continue; + if (cvh->varname && (!token->varname || strcmp(cvh->varname, token->varname))) + continue; + cvh->completions(tmpcomps, token); + break; + } + + if (!arg) + return; + + argsz = strlen(arg); + for (i = vector_active(tmpcomps); i; i--) + { + char *item = vector_slot(tmpcomps, i - 1); + if (strlen(item) >= argsz + && !strncmp(item, arg, argsz)) + vector_set(comps, item); + else + XFREE(MTYPE_COMPLETION, item); + } + vector_free(tmpcomps); +} + +void +cmd_variable_handler_register (const struct cmd_variable_handler *cvh) +{ + if (!varhandlers) + return; + + for (; cvh->completions; cvh++) + listnode_add(varhandlers, (void *)cvh); +} + +DEFUN_HIDDEN (autocomplete, + autocomplete_cmd, + "autocomplete TYPE TEXT VARNAME", + "Autocompletion handler (internal, for vtysh)\n" + "cmd_token->type\n" + "cmd_token->text\n" + "cmd_token->varname\n") +{ + struct cmd_token tok; + vector comps = vector_init(32); + size_t i; + + memset(&tok, 0, sizeof(tok)); + tok.type = atoi(argv[1]->arg); + tok.text = argv[2]->arg; + tok.varname = argv[3]->arg; + if (!strcmp(tok.varname, "-")) + tok.varname = NULL; + + cmd_variable_complete(&tok, NULL, comps); + + for (i = 0; i < vector_active(comps); i++) + { + char *text = vector_slot(comps, i); + vty_out(vty, "%s\n", text); + XFREE(MTYPE_COMPLETION, text); + } + + vector_free(comps); + return CMD_SUCCESS; +} + /** * Generate possible tab-completions for the given input. This function only * returns results that would result in a valid command if used as Readline @@ -986,7 +801,12 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) { struct cmd_token *token = vector_slot (initial_comps, i); if (token->type == WORD_TKN) - vector_set (comps, token); + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, token->text)); + else if (IS_VARYING_TOKEN(token->type)) + { + const char *ref = vector_lookup(vline, vector_active (vline) - 1); + cmd_variable_complete (token, ref, comps); + } } vector_free (initial_comps); @@ -1008,9 +828,7 @@ cmd_complete_command (vector vline, struct vty *vty, int *status) unsigned int i; for (i = 0; i < vector_active (comps); i++) { - struct cmd_token *token = vector_slot (comps, i); - ret[i] = XSTRDUP (MTYPE_TMP, token->text); - vector_unset (comps, i); + ret[i] = vector_slot (comps, i); } // set the last element to NULL, because this array is used in // a Readline completion_generator function which expects NULL @@ -1047,8 +865,6 @@ node_parent ( enum node_type node ) { case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -1421,8 +1237,6 @@ cmd_exit (struct vty *vty) case BGP_IPV4L_NODE: case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -1489,8 +1303,6 @@ DEFUN (config_end, case EIGRP_NODE: case BABEL_NODE: case BGP_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -1556,11 +1368,6 @@ DEFUN (frr_version_defaults, "set of configuration defaults used\n" "version string\n") { - if (vty->type == VTY_TERM || vty->type == VTY_SHELL) - /* only print this when the user tries to do run it */ - vty_out (vty, "%% NOTE: This command currently does nothing.%s" - "%% It is written to the configuration for future reference.%s", - VTY_NEWLINE, VTY_NEWLINE); return CMD_SUCCESS; } @@ -2119,16 +1926,8 @@ DEFUN (config_terminal_length, "Number of lines on screen (0 for no pausing)\n") { int idx_number = 2; - int lines; - char *endptr = NULL; - lines = strtol (argv[idx_number]->arg, &endptr, 10); - if (lines < 0 || lines > 512 || *endptr != '\0') - { - vty_out (vty, "length is malformed%s", VTY_NEWLINE); - return CMD_WARNING; - } - vty->lines = lines; + vty->lines = atoi (argv[idx_number]->arg); return CMD_SUCCESS; } @@ -2152,16 +1951,8 @@ DEFUN (service_terminal_length, "Number of lines of VTY (0 means no line control)\n") { int idx_number = 2; - int lines; - char *endptr = NULL; - lines = strtol (argv[idx_number]->arg, &endptr, 10); - if (lines < 0 || lines > 512 || *endptr != '\0') - { - vty_out (vty, "length is malformed%s", VTY_NEWLINE); - return CMD_WARNING; - } - host.lines = lines; + host.lines = atoi (argv[idx_number]->arg); return CMD_SUCCESS; } @@ -2667,6 +2458,8 @@ install_default (enum node_type node) install_element (node, &config_write_cmd); install_element (node, &show_running_config_cmd); + + install_element (node, &autocomplete_cmd); } /* Initialize command interface. Install basic nodes and commands. @@ -2679,6 +2472,8 @@ cmd_init (int terminal) { qobj_init (); + varhandlers = list_new (); + /* Allocate initial top vector of commands. */ cmdvec = vector_init (VECTOR_MIN_SIZE); @@ -2714,6 +2509,7 @@ cmd_init (int terminal) install_element (VIEW_NODE, &show_logging_cmd); install_element (VIEW_NODE, &show_commandtree_cmd); install_element (VIEW_NODE, &echo_cmd); + install_element (VIEW_NODE, &autocomplete_cmd); } if (terminal) @@ -2778,50 +2574,6 @@ cmd_init (int terminal) #endif } -struct cmd_token * -new_cmd_token (enum cmd_token_type type, u_char attr, - const char *text, const char *desc) -{ - struct cmd_token *token = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token)); - token->type = type; - token->attr = attr; - token->text = text ? XSTRDUP (MTYPE_CMD_TEXT, text) : NULL; - token->desc = desc ? XSTRDUP (MTYPE_CMD_DESC, desc) : NULL; - token->refcnt = 1; - token->arg = NULL; - token->allowrepeat = false; - - return token; -} - -void -del_cmd_token (struct cmd_token *token) -{ - if (!token) return; - - if (token->text) - XFREE (MTYPE_CMD_TEXT, token->text); - if (token->desc) - XFREE (MTYPE_CMD_DESC, token->desc); - if (token->arg) - XFREE (MTYPE_CMD_ARG, token->arg); - - XFREE (MTYPE_CMD_TOKENS, token); -} - -struct cmd_token * -copy_cmd_token (struct cmd_token *token) -{ - struct cmd_token *copy = new_cmd_token (token->type, token->attr, NULL, NULL); - copy->max = token->max; - copy->min = token->min; - copy->text = token->text ? XSTRDUP (MTYPE_CMD_TEXT, token->text) : NULL; - copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_DESC, token->desc) : NULL; - copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_ARG, token->arg) : NULL; - - return copy; -} - void cmd_terminate () { diff --git a/lib/command.h b/lib/command.h index 00ae8621d..ada9003cc 100644 --- a/lib/command.h +++ b/lib/command.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_COMMAND_H @@ -29,9 +28,10 @@ #include "graph.h" #include "memory.h" #include "hash.h" +#include "command_graph.h" DECLARE_MTYPE(HOST) -DECLARE_MTYPE(CMD_ARG) +DECLARE_MTYPE(COMPLETION) /* for test-commands.c */ DECLARE_MTYPE(STRVEC) @@ -102,8 +102,6 @@ enum node_type BGP_IPV6_NODE, /* BGP IPv6 address family */ BGP_IPV6M_NODE, /* BGP IPv6 multicast address family. */ BGP_IPV6L_NODE, /* BGP IPv6 labeled unicast address family. */ - BGP_ENCAP_NODE, /* BGP ENCAP SAFI */ - BGP_ENCAPV6_NODE, /* BGP ENCAP SAFI */ BGP_VRF_POLICY_NODE, /* BGP VRF policy */ BGP_VNC_DEFAULTS_NODE, /* BGP VNC nve defaults */ BGP_VNC_NVE_GROUP_NODE, /* BGP VNC nve group */ @@ -166,69 +164,6 @@ struct cmd_node struct hash *cmd_hash; }; -/** - * Types for tokens. - * - * The type determines what kind of data the token can match (in the - * matching use case) or hold (in the argv use case). - */ -enum cmd_token_type -{ - WORD_TKN, // words - VARIABLE_TKN, // almost anything - RANGE_TKN, // integer range - IPV4_TKN, // IPV4 addresses - IPV4_PREFIX_TKN, // IPV4 network prefixes - IPV6_TKN, // IPV6 prefixes - IPV6_PREFIX_TKN, // IPV6 network prefixes - - /* plumbing types */ - FORK_TKN, // marks subgraph beginning - JOIN_TKN, // marks subgraph end - START_TKN, // first token in line - END_TKN, // last token in line - - SPECIAL_TKN = FORK_TKN, -}; - -/* Command attributes */ -enum -{ - CMD_ATTR_NORMAL, - CMD_ATTR_DEPRECATED, - CMD_ATTR_HIDDEN, -}; - -/* Comamand token struct. */ -struct cmd_token -{ - enum cmd_token_type type; // token type - u_char attr; // token attributes - bool allowrepeat; // matcher allowed to match token repetively? - uint32_t refcnt; - - char *text; // token text - char *desc; // token description - long long min, max; // for ranges - char *arg; // user input that matches this token - - struct graph_node *forkjoin; // paired FORK/JOIN for JOIN/FORK -}; - -/* Structure of command element. */ -struct cmd_element -{ - const char *string; /* Command specification by string. */ - const char *doc; /* Documentation of this command. */ - int daemon; /* Daemon to which this command belong. */ - u_char attr; /* Command attributes */ - - /* handler function for command */ - int (*func) (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); - - const char *name; /* symbol name for debugging */ -}; - /* Return value of the commands. */ #define CMD_SUCCESS 0 #define CMD_WARNING 1 @@ -442,15 +377,7 @@ extern int cmd_hostname_set (const char *hostname); /* NOT safe for general use; call this only if DEV_BUILD! */ extern void grammar_sandbox_init (void); -/* memory management for cmd_token */ -extern struct cmd_token *new_cmd_token (enum cmd_token_type, u_char attr, - const char *text, const char *desc); -extern void del_cmd_token (struct cmd_token *); -extern struct cmd_token *copy_cmd_token (struct cmd_token *); - extern vector completions_to_vec (struct list *completions); -extern void cmd_merge_graphs (struct graph *old, struct graph *new, int direction); -extern void command_parse_format (struct graph *graph, struct cmd_element *cmd); /* Export typical functions. */ extern const char *host_config_get (void); @@ -463,7 +390,12 @@ extern int cmd_banner_motd_file (const char *); /* struct host global, ick */ extern struct host host; -/* text for <cr> command */ -#define CMD_CR_TEXT "<cr>" +struct cmd_variable_handler { + const char *tokenname, *varname; + void (*completions)(vector out, struct cmd_token *token); +}; + +extern void cmd_variable_complete (struct cmd_token *token, const char *arg, vector comps); +extern void cmd_variable_handler_register (const struct cmd_variable_handler *cvh); #endif /* _ZEBRA_COMMAND_H */ diff --git a/lib/command_graph.c b/lib/command_graph.c new file mode 100644 index 000000000..8cfb33357 --- /dev/null +++ b/lib/command_graph.c @@ -0,0 +1,478 @@ +/* + * CLI graph handling + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * Copyright (C) 2013 by Open Source Routing. + * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") + * + * 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 + */ + +#include <zebra.h> + +#include "command_graph.h" + +DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command Tokens") +DEFINE_MTYPE_STATIC(LIB, CMD_DESC, "Command Token Text") +DEFINE_MTYPE_STATIC(LIB, CMD_TEXT, "Command Token Help") +DEFINE_MTYPE( LIB, CMD_ARG, "Command Argument") +DEFINE_MTYPE_STATIC(LIB, CMD_VAR, "Command Argument Name") + +struct cmd_token * +cmd_token_new (enum cmd_token_type type, u_char attr, + const char *text, const char *desc) +{ + struct cmd_token *token = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token)); + token->type = type; + token->attr = attr; + token->text = text ? XSTRDUP (MTYPE_CMD_TEXT, text) : NULL; + token->desc = desc ? XSTRDUP (MTYPE_CMD_DESC, desc) : NULL; + token->refcnt = 1; + token->arg = NULL; + token->allowrepeat = false; + token->varname = NULL; + + return token; +} + +void +cmd_token_del (struct cmd_token *token) +{ + if (!token) return; + + XFREE (MTYPE_CMD_TEXT, token->text); + XFREE (MTYPE_CMD_DESC, token->desc); + XFREE (MTYPE_CMD_ARG, token->arg); + XFREE (MTYPE_CMD_VAR, token->varname); + + XFREE (MTYPE_CMD_TOKENS, token); +} + +struct cmd_token * +cmd_token_dup (struct cmd_token *token) +{ + struct cmd_token *copy = cmd_token_new (token->type, token->attr, NULL, NULL); + copy->max = token->max; + copy->min = token->min; + copy->text = token->text ? XSTRDUP (MTYPE_CMD_TEXT, token->text) : NULL; + copy->desc = token->desc ? XSTRDUP (MTYPE_CMD_DESC, token->desc) : NULL; + copy->arg = token->arg ? XSTRDUP (MTYPE_CMD_ARG, token->arg) : NULL; + copy->varname = token->varname ? XSTRDUP (MTYPE_CMD_VAR, token->varname) : NULL; + + return copy; +} + +void cmd_token_varname_set(struct cmd_token *token, const char *varname) +{ + XFREE (MTYPE_CMD_VAR, token->varname); + if (!varname) + { + token->varname = NULL; + return; + } + + size_t len = strlen (varname), i; + token->varname = XMALLOC (MTYPE_CMD_VAR, len + 1); + + for (i = 0; i < len; i++) + switch (varname[i]) + { + case '-': + case '+': + case '*': + case ':': + token->varname[i] = '_'; + break; + default: + token->varname[i] = tolower (varname[i]); + } + token->varname[len] = '\0'; +} + +static bool +cmd_nodes_link (struct graph_node *from, struct graph_node *to) +{ + for (size_t i = 0; i < vector_active (from->to); i++) + if (vector_slot (from->to, i) == to) + return true; + return false; +} + +static bool cmd_nodes_equal (struct graph_node *ga, struct graph_node *gb); + +/* returns a single node to be excluded as "next" from iteration + * - for JOIN_TKN, never continue back to the FORK_TKN + * - in all other cases, don't try the node itself (in case of "...") + */ +static inline struct graph_node * +cmd_loopstop(struct graph_node *gn) +{ + struct cmd_token *tok = gn->data; + if (tok->type == JOIN_TKN) + return tok->forkjoin; + else + return gn; +} + +static bool +cmd_subgraph_equal (struct graph_node *ga, struct graph_node *gb, + struct graph_node *a_join) +{ + size_t i, j; + struct graph_node *a_fork, *b_fork; + a_fork = cmd_loopstop (ga); + b_fork = cmd_loopstop (gb); + + if (vector_active (ga->to) != vector_active (gb->to)) + return false; + for (i = 0; i < vector_active (ga->to); i++) + { + struct graph_node *cga = vector_slot (ga->to, i); + + for (j = 0; j < vector_active (gb->to); j++) + { + struct graph_node *cgb = vector_slot (gb->to, i); + + if (cga == a_fork && cgb != b_fork) + continue; + if (cga == a_fork && cgb == b_fork) + break; + + if (cmd_nodes_equal (cga, cgb)) + { + if (cga == a_join) + break; + if (cmd_subgraph_equal (cga, cgb, a_join)) + break; + } + } + if (j == vector_active (gb->to)) + return false; + } + return true; +} + +/* deep compare -- for FORK_TKN, the entire subgraph is compared. + * this is what's needed since we're not currently trying to partially + * merge subgraphs */ +static bool +cmd_nodes_equal (struct graph_node *ga, struct graph_node *gb) +{ + struct cmd_token *a = ga->data, *b = gb->data; + + if (a->type != b->type || a->allowrepeat != b->allowrepeat) + return false; + if (a->type < SPECIAL_TKN && strcmp (a->text, b->text)) + return false; + /* one a ..., the other not. */ + if (cmd_nodes_link (ga, ga) != cmd_nodes_link (gb, gb)) + return false; + if (!a->varname != !b->varname) + return false; + if (a->varname && strcmp (a->varname, b->varname)) + return false; + + switch (a->type) + { + case RANGE_TKN: + return a->min == b->min && a->max == b->max; + + case FORK_TKN: + /* one is keywords, the other just option or selector ... */ + if (cmd_nodes_link (a->forkjoin, ga) != cmd_nodes_link (b->forkjoin, gb)) + return false; + if (cmd_nodes_link (ga, a->forkjoin) != cmd_nodes_link (gb, b->forkjoin)) + return false; + return cmd_subgraph_equal (ga, gb, a->forkjoin); + + default: + return true; + } +} + +static void +cmd_fork_bump_attr (struct graph_node *gn, struct graph_node *join, + u_char attr) +{ + size_t i; + struct cmd_token *tok = gn->data; + struct graph_node *stop = cmd_loopstop (gn); + + tok->attr = attr; + for (i = 0; i < vector_active (gn->to); i++) + { + struct graph_node *next = vector_slot (gn->to, i); + if (next == stop || next == join) + continue; + cmd_fork_bump_attr (next, join, attr); + } +} + +/* move an entire subtree from the temporary graph resulting from + * parse() into the permanent graph for the command node. + * + * this touches rather deeply into the graph code unfortunately. + */ +static void +cmd_reparent_tree (struct graph *fromgraph, struct graph *tograph, + struct graph_node *node) +{ + struct graph_node *stop = cmd_loopstop (node); + size_t i; + + for (i = 0; i < vector_active (fromgraph->nodes); i++) + if (vector_slot (fromgraph->nodes, i) == node) + { + /* agressive iteration punching through subgraphs - may hit some + * nodes twice. reparent only if found on old graph */ + vector_unset (fromgraph->nodes, i); + vector_set (tograph->nodes, node); + break; + } + + for (i = 0; i < vector_active (node->to); i++) + { + struct graph_node *next = vector_slot (node->to, i); + if (next != stop) + cmd_reparent_tree (fromgraph, tograph, next); + } +} + +static void +cmd_free_recur (struct graph *graph, struct graph_node *node, + struct graph_node *stop) +{ + struct graph_node *next, *nstop; + + for (size_t i = vector_active (node->to); i; i--) + { + next = vector_slot (node->to, i - 1); + if (next == stop) + continue; + nstop = cmd_loopstop (next); + if (nstop != next) + cmd_free_recur (graph, next, nstop); + cmd_free_recur (graph, nstop, stop); + } + graph_delete_node (graph, node); +} + +static void +cmd_free_node (struct graph *graph, struct graph_node *node) +{ + struct cmd_token *tok = node->data; + if (tok->type == JOIN_TKN) + cmd_free_recur (graph, tok->forkjoin, node); + graph_delete_node (graph, node); +} + +/* recursive graph merge. call with + * old ~= new + * (which holds true for old == START_TKN, new == START_TKN) + */ +static void +cmd_merge_nodes (struct graph *oldgraph, struct graph *newgraph, + struct graph_node *old, struct graph_node *new, + int direction) +{ + struct cmd_token *tok; + struct graph_node *old_skip, *new_skip; + old_skip = cmd_loopstop (old); + new_skip = cmd_loopstop (new); + + assert (direction == 1 || direction == -1); + + tok = old->data; + tok->refcnt += direction; + + size_t j, i; + for (j = 0; j < vector_active (new->to); j++) + { + struct graph_node *cnew = vector_slot (new->to, j); + if (cnew == new_skip) + continue; + + for (i = 0; i < vector_active (old->to); i++) + { + struct graph_node *cold = vector_slot (old->to, i); + if (cold == old_skip) + continue; + + if (cmd_nodes_equal (cold, cnew)) + { + struct cmd_token *told = cold->data, *tnew = cnew->data; + + if (told->type == END_TKN) + { + if (direction < 0) + { + graph_delete_node (oldgraph, vector_slot (cold->to, 0)); + graph_delete_node (oldgraph, cold); + } + else + /* force no-match handling to install END_TKN */ + i = vector_active (old->to); + break; + } + + /* the entire fork compared as equal, we continue after it. */ + if (told->type == FORK_TKN) + { + if (tnew->attr < told->attr && direction > 0) + cmd_fork_bump_attr (cold, told->forkjoin, tnew->attr); + /* XXX: no reverse bump on uninstall */ + told = (cold = told->forkjoin)->data; + tnew = (cnew = tnew->forkjoin)->data; + } + if (tnew->attr < told->attr) + told->attr = tnew->attr; + + cmd_merge_nodes (oldgraph, newgraph, cold, cnew, direction); + break; + } + } + /* nothing found => add new to old */ + if (i == vector_active (old->to) && direction > 0) + { + assert (vector_count (cnew->from) == + cmd_nodes_link (cnew, cnew) ? 2 : 1); + graph_remove_edge (new, cnew); + + cmd_reparent_tree (newgraph, oldgraph, cnew); + + graph_add_edge (old, cnew); + } + } + + if (!tok->refcnt) + cmd_free_node (oldgraph, old); +} + +void +cmd_graph_merge (struct graph *old, struct graph *new, int direction) +{ + assert (vector_active (old->nodes) >= 1); + assert (vector_active (new->nodes) >= 1); + + cmd_merge_nodes (old, new, + vector_slot (old->nodes, 0), vector_slot (new->nodes, 0), + direction); +} + +static void +cmd_node_names (struct graph_node *gn, struct graph_node *join, + const char *prevname) +{ + size_t i; + struct cmd_token *tok = gn->data, *jointok; + struct graph_node *stop = cmd_loopstop (gn); + + switch (tok->type) + { + case WORD_TKN: + prevname = tok->text; + break; + + case VARIABLE_TKN: + if (!tok->varname + && strcmp (tok->text, "WORD") + && strcmp (tok->text, "NAME")) + cmd_token_varname_set (tok, tok->text); + /* fallthrough */ + case RANGE_TKN: + case IPV4_TKN: + case IPV4_PREFIX_TKN: + case IPV6_TKN: + case IPV6_PREFIX_TKN: + if (!tok->varname && prevname) + cmd_token_varname_set (tok, prevname); + prevname = NULL; + break; + + case START_TKN: + case END_TKN: + case JOIN_TKN: + /* "<foo|bar> WORD" -> word is not "bar" or "foo" */ + prevname = NULL; + break; + + case FORK_TKN: + /* apply "<A.B.C.D|X:X::X:X>$name" */ + jointok = tok->forkjoin->data; + if (!jointok->varname) + break; + for (i = 0; i < vector_active (tok->forkjoin->from); i++) + { + struct graph_node *tail = vector_slot (tok->forkjoin->from, i); + struct cmd_token *tailtok = tail->data; + if (tail == gn || tailtok->varname) + continue; + cmd_token_varname_set (tailtok, jointok->varname); + } + break; + } + + for (i = 0; i < vector_active (gn->to); i++) + { + struct graph_node *next = vector_slot (gn->to, i); + if (next == stop || next == join) + continue; + cmd_node_names (next, join, prevname); + } + + if (tok->type == FORK_TKN && tok->forkjoin != join) + cmd_node_names (tok->forkjoin, join, NULL); +} + +void +cmd_graph_names (struct graph *graph) +{ + struct graph_node *start; + + assert (vector_active (graph->nodes) >= 1); + start = vector_slot (graph->nodes, 0); + + /* apply varname on initial "[no]" */ + do + { + if (vector_active (start->to) != 1) + break; + + struct graph_node *first = vector_slot (start->to, 0); + struct cmd_token *tok = first->data; + /* looking for an option with 2 choices, nothing or "no" */ + if (tok->type != FORK_TKN || vector_active (first->to) != 2) + break; + + struct graph_node *next0 = vector_slot (first->to, 0); + struct graph_node *next1 = vector_slot (first->to, 1); + /* one needs to be empty */ + if (next0 != tok->forkjoin && next1 != tok->forkjoin) + break; + + struct cmd_token *tok0 = next0->data; + struct cmd_token *tok1 = next1->data; + /* the other one needs to be "no" (only one will match here) */ + if ((tok0->type == WORD_TKN && !strcmp(tok0->text, "no"))) + cmd_token_varname_set (tok0, "no"); + if ((tok1->type == WORD_TKN && !strcmp(tok1->text, "no"))) + cmd_token_varname_set (tok1, "no"); + } + while (0); + + cmd_node_names (start, NULL, NULL); +} diff --git a/lib/command_graph.h b/lib/command_graph.h new file mode 100644 index 000000000..a7a34a059 --- /dev/null +++ b/lib/command_graph.h @@ -0,0 +1,119 @@ +/* + * CLI graph handling + * + * -- + * Copyright (C) 2016 Cumulus Networks, Inc. + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * Copyright (C) 2013 by Open Source Routing. + * Copyright (C) 2013 by Internet Systems Consortium, Inc. ("ISC") + * + * 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_COMMAND_GRAPH_H +#define _FRR_COMMAND_GRAPH_H + +#include <stdbool.h> +#include <stdint.h> + +#include "memory.h" +#include "vector.h" +#include "graph.h" + +DECLARE_MTYPE(CMD_ARG) + +struct vty; + +/** + * Types for tokens. + * + * The type determines what kind of data the token can match (in the + * matching use case) or hold (in the argv use case). + */ +enum cmd_token_type +{ + WORD_TKN, // words + VARIABLE_TKN, // almost anything + RANGE_TKN, // integer range + IPV4_TKN, // IPV4 addresses + IPV4_PREFIX_TKN, // IPV4 network prefixes + IPV6_TKN, // IPV6 prefixes + IPV6_PREFIX_TKN, // IPV6 network prefixes + + /* plumbing types */ + FORK_TKN, // marks subgraph beginning + JOIN_TKN, // marks subgraph end + START_TKN, // first token in line + END_TKN, // last token in line + + SPECIAL_TKN = FORK_TKN, +}; + +#define IS_VARYING_TOKEN(x) ((x) >= VARIABLE_TKN && (x) < FORK_TKN) + +/* Command attributes */ +enum +{ + CMD_ATTR_NORMAL, + CMD_ATTR_DEPRECATED, + CMD_ATTR_HIDDEN, +}; + +/* Comamand token struct. */ +struct cmd_token +{ + enum cmd_token_type type; // token type + uint8_t attr; // token attributes + bool allowrepeat; // matcher allowed to match token repetively? + uint32_t refcnt; + + char *text; // token text + char *desc; // token description + long long min, max; // for ranges + char *arg; // user input that matches this token + char *varname; + + struct graph_node *forkjoin; // paired FORK/JOIN for JOIN/FORK +}; + +/* Structure of command element. */ +struct cmd_element +{ + const char *string; /* Command specification by string. */ + const char *doc; /* Documentation of this command. */ + int daemon; /* Daemon to which this command belong. */ + uint8_t attr; /* Command attributes */ + + /* handler function for command */ + int (*func) (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); + + const char *name; /* symbol name for debugging */ +}; + +/* text for <cr> command */ +#define CMD_CR_TEXT "<cr>" + +/* memory management for cmd_token */ +extern struct cmd_token *cmd_token_new (enum cmd_token_type, uint8_t attr, + const char *text, const char *desc); +extern struct cmd_token *cmd_token_dup (struct cmd_token *); +extern void cmd_token_del (struct cmd_token *); +extern void cmd_token_varname_set(struct cmd_token *token, const char *varname); + +extern void cmd_graph_parse (struct graph *graph, struct cmd_element *cmd); +extern void cmd_graph_names (struct graph *graph); +extern void cmd_graph_merge (struct graph *old, struct graph *new, int direction); + +#endif /* _FRR_COMMAND_GRAPH_H */ diff --git a/lib/command_match.c b/lib/command_match.c index bbd9cd091..75d8fdc3d 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -78,10 +77,7 @@ static enum match_type match_ipv4_prefix (const char *); static enum match_type -match_ipv6 (const char *); - -static enum match_type -match_ipv6_prefix (const char *); +match_ipv6_prefix (const char *, bool); static enum match_type match_range (struct cmd_token *, const char *); @@ -117,7 +113,7 @@ command_match (struct graph *cmdgraph, struct listnode *tail = listtail (*argv); // delete dummy start node - del_cmd_token ((struct cmd_token *) head->data); + cmd_token_del ((struct cmd_token *) head->data); list_delete_node (*argv, head); // get cmd_element out of list tail @@ -281,7 +277,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n, // manually deleted struct cmd_element *el = leaf->data; listnode_add (currbest, el); - currbest->del = (void (*)(void *)) &del_cmd_token; + currbest->del = (void (*)(void *)) &cmd_token_del; // do not break immediately; continue walking through the follow set // to ensure that there is exactly one END_TKN } @@ -320,7 +316,7 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n, { // copy token, set arg and prepend to currbest struct cmd_token *token = start->data; - struct cmd_token *copy = copy_cmd_token (token); + struct cmd_token *copy = cmd_token_dup (token); copy->arg = XSTRDUP (MTYPE_CMD_ARG, input_token); listnode_add_before (currbest, currbest->head, copy); matcher_rv = MATCHER_OK; @@ -677,9 +673,9 @@ match_token (struct cmd_token *token, char *input_token) case IPV4_PREFIX_TKN: return match_ipv4_prefix (input_token); case IPV6_TKN: - return match_ipv6 (input_token); + return match_ipv6_prefix (input_token, false); case IPV6_PREFIX_TKN: - return match_ipv6_prefix (input_token); + return match_ipv6_prefix (input_token, true); case RANGE_TKN: return match_range (token, input_token); case VARIABLE_TKN: @@ -835,35 +831,18 @@ match_ipv4_prefix (const char *str) #define STATE_MASK 7 static enum match_type -match_ipv6 (const char *str) -{ - struct sockaddr_in6 sin6_dummy; - int ret; - - if (strspn (str, IPV6_ADDR_STR) != strlen (str)) - return no_match; - - ret = inet_pton(AF_INET6, str, &sin6_dummy.sin6_addr); - - if (ret == 1) - return exact_match; - - return no_match; -} - -static enum match_type -match_ipv6_prefix (const char *str) +match_ipv6_prefix (const char *str, bool prefix) { int state = STATE_START; int colons = 0, nums = 0, double_colon = 0; int mask; - const char *sp = NULL; + const char *sp = NULL, *start = str; char *endptr = NULL; if (str == NULL) return partly_match; - if (strspn (str, IPV6_PREFIX_STR) != strlen (str)) + if (strspn (str, prefix ? IPV6_PREFIX_STR : IPV6_ADDR_STR) != strlen (str)) return no_match; while (*str != '\0' && state != STATE_MASK) @@ -966,6 +945,13 @@ match_ipv6_prefix (const char *str) str++; } + if (!prefix) + { + struct sockaddr_in6 sin6_dummy; + int ret = inet_pton(AF_INET6, start, &sin6_dummy.sin6_addr); + return ret == 1 ? exact_match : partly_match; + } + if (state < STATE_MASK) return partly_match; diff --git a/lib/command_match.h b/lib/command_match.h index 9e18b8d90..a04f60f0d 100644 --- a/lib/command_match.h +++ b/lib/command_match.h @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_COMMAND_MATCH_H diff --git a/lib/command_parse.y b/lib/command_parse.y index 0c415af3a..466e3d3f1 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -44,12 +44,12 @@ * struct parser_ctx is needed for the bison forward decls. */ %code requires { - #include "stdlib.h" - #include "string.h" - #include "memory.h" - #include "command.h" + #include <stdlib.h> + #include <string.h> + #include <ctype.h> + + #include "command_graph.h" #include "log.h" - #include "graph.h" DECLARE_MTYPE(LEX) @@ -104,12 +104,15 @@ %type <node> start %type <node> literal_token %type <node> placeholder_token +%type <node> placeholder_token_real %type <node> simple_token %type <subgraph> selector %type <subgraph> selector_token %type <subgraph> selector_token_seq %type <subgraph> selector_seq_seq +%type <string> varname_token + %code { /* bison declarations */ @@ -184,6 +187,16 @@ start: } ; +varname_token: '$' WORD +{ + $$ = XSTRDUP (MTYPE_LEX, $2); +} +| /* empty */ +{ + $$ = NULL; +} +; + cmd_token_seq: /* empty */ | cmd_token_seq cmd_token @@ -207,14 +220,16 @@ simple_token: | placeholder_token ; -literal_token: WORD +literal_token: WORD varname_token { $$ = new_token_node (ctx, WORD_TKN, $1, doc_next(ctx)); + cmd_token_varname_set ($$->data, $2); + XFREE (MTYPE_LEX, $2); XFREE (MTYPE_LEX, $1); } ; -placeholder_token: +placeholder_token_real: IPV4 { $$ = new_token_node (ctx, IPV4_TKN, $1, doc_next(ctx)); @@ -257,10 +272,22 @@ placeholder_token: XFREE (MTYPE_LEX, $1); } +placeholder_token: + placeholder_token_real varname_token +{ + struct cmd_token *token = $$->data; + $$ = $1; + cmd_token_varname_set (token, $2); + XFREE (MTYPE_LEX, $2); +}; + + /* <selector|set> productions */ -selector: '<' selector_seq_seq '>' +selector: '<' selector_seq_seq '>' varname_token { $$ = $2; + cmd_token_varname_set ($2.end->data, $4); + XFREE (MTYPE_LEX, $4); }; selector_seq_seq: @@ -283,7 +310,7 @@ selector_seq_seq: ; /* {keyword} productions */ -selector: '{' selector_seq_seq '}' +selector: '{' selector_seq_seq '}' varname_token { $$ = $2; graph_add_edge ($$.end, $$.start); @@ -293,6 +320,9 @@ selector: '{' selector_seq_seq '}' * loop-avoidal fails to handle * just use [{a|b}] if neccessary, that will work perfectly fine, and reason * #1 is good enough to keep it this way. */ + + cmd_token_varname_set ($2.end->data, $4); + XFREE (MTYPE_LEX, $4); }; @@ -315,10 +345,12 @@ selector_token_seq: ; /* [option] productions */ -selector: '[' selector_seq_seq ']' +selector: '[' selector_seq_seq ']' varname_token { $$ = $2; graph_add_edge ($$.start, $$.end); + cmd_token_varname_set ($2.end->data, $4); + XFREE (MTYPE_LEX, $4); } ; @@ -329,7 +361,7 @@ selector: '[' selector_seq_seq ']' DEFINE_MTYPE(LIB, LEX, "Lexer token (temporary)") void -command_parse_format (struct graph *graph, struct cmd_element *cmd) +cmd_graph_parse (struct graph *graph, struct cmd_element *cmd) { struct parser_ctx ctx = { .graph = graph, .el = cmd }; @@ -430,6 +462,6 @@ static struct graph_node * new_token_node (struct parser_ctx *ctx, enum cmd_token_type type, const char *text, const char *doc) { - struct cmd_token *token = new_cmd_token (type, ctx->el->attr, text, doc); - return graph_new_node (ctx->graph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (type, ctx->el->attr, text, doc); + return graph_new_node (ctx->graph, token, (void (*)(void *)) &cmd_token_del); } @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <stdio.h> #include <stdlib.h> @@ -13,10 +13,9 @@ * 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. + * 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 __CSV_H__ diff --git a/lib/distribute.c b/lib/distribute.c index f85994c9a..7b7d49d1d 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/distribute.h b/lib/distribute.h index e9625a354..23d7cac57 100644 --- a/lib/distribute.h +++ b/lib/distribute.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_DISTRIBUTE_H diff --git a/lib/event_counter.c b/lib/event_counter.c index e94aa4c0f..0acd0a1f7 100644 --- a/lib/event_counter.c +++ b/lib/event_counter.c @@ -35,10 +35,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/lib/event_counter.h b/lib/event_counter.h index f40c6cde6..8c11e1028 100644 --- a/lib/event_counter.h +++ b/lib/event_counter.h @@ -35,10 +35,9 @@ * 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. + * 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 _ZEBRA_EVENT_COUNTER_H diff --git a/lib/fifo.h b/lib/fifo.h index 6be75b761..631556e78 100644 --- a/lib/fifo.h +++ b/lib/fifo.h @@ -1,22 +1,22 @@ /* FIFO common header. - Copyright (C) 2015 Kunihiro Ishiguro - -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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2015 Kunihiro Ishiguro + * + * 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 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 __LIB_FIFO_H__ #define __LIB_FIFO_H__ diff --git a/lib/filter.c b/lib/filter.c index fd73d4de7..01301de4b 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -29,6 +28,7 @@ #include "buffer.h" #include "log.h" #include "routemap.h" +#include "libfrr.h" DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST, "Access List") DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST_STR, "Access List Str") @@ -1697,7 +1697,7 @@ filter_show (struct vty *vty, const char *name, afi_t afi) return 0; /* Print the name of the protocol */ - vty_out(vty, "%s:%s", zlog_protoname(), VTY_NEWLINE); + vty_out(vty, "%s:%s", frr_protoname, VTY_NEWLINE); for (access = master->num.head; access; access = access->next) { diff --git a/lib/filter.h b/lib/filter.h index 6b5ccb52e..2c7001811 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_FILTER_H diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 0408bca09..17bc82f5d 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -1,21 +1,20 @@ /* - Utilities and interfaces for managing POSIX threads - Copyright (C) 2017 Cumulus Networks - - 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 + * Utilities and interfaces for managing POSIX threads + * Copyright (C) 2017 Cumulus Networks + * + * 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 */ #include <zebra.h> diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index b4954367f..1a390b1e4 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -1,21 +1,20 @@ /* - Utilities and interfaces for managing POSIX threads - Copyright (C) 2017 Cumulus Networks - - 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 + * Utilities and interfaces for managing POSIX threads + * Copyright (C) 2017 Cumulus Networks + * + * 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_PTHREAD_H diff --git a/lib/getopt.c b/lib/getopt.c index 7a58a8a8c..d0ee43510 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -1,28 +1,28 @@ /* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. - - 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, 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ + * NOTE: getopt is now part of the C library, so if you don't know what + * "Keep this file name-space clean" means, talk to drepper@gnu.org + * before changing it! + * + * Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 + * Free Software Foundation, Inc. + * + * NOTE: The canonical source of this file is maintained with the GNU C Library. + * Bugs can be reported to bug-glibc@gnu.org. + * + * 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, 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 + */ /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */ diff --git a/lib/getopt.h b/lib/getopt.h index b359a47be..cc38a45c2 100644 --- a/lib/getopt.h +++ b/lib/getopt.h @@ -1,23 +1,23 @@ /* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. - - 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, 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ + * Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + * + * NOTE: The canonical source of this file is maintained with the GNU C Library. + * Bugs can be reported to bug-glibc@gnu.org. + * + * 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, 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 _GETOPT_H #define _GETOPT_H 1 diff --git a/lib/getopt1.c b/lib/getopt1.c index bd3099e79..1873a197e 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -1,24 +1,24 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@gnu.org. - - 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, 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ + * Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + * Free Software Foundation, Inc. + * + * NOTE: The canonical source of this file is maintained with the GNU C Library. + * Bugs can be reported to bug-glibc@gnu.org. + * + * 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, 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 + */ #include <zebra.h> #include "getopt.h" diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 97de94321..cfc3fb798 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -18,10 +18,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include "command.h" @@ -70,11 +69,11 @@ DEFUN (grammar_test, // parse the command and install it into the command graph struct graph *graph = graph_new(); - struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); - graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); + graph_new_node (graph, token, (void (*)(void *)) &cmd_token_del); - command_parse_format (graph, cmd); - cmd_merge_graphs (nodegraph, graph, +1); + cmd_graph_parse (graph, cmd); + cmd_graph_merge (nodegraph, graph, +1); return CMD_SUCCESS; } @@ -123,7 +122,7 @@ DEFUN (grammar_test_complete, } for (i = 0; i < vector_active (comps); i++) - del_cmd_token ((struct cmd_token *) vector_slot (comps, i)); + cmd_token_del ((struct cmd_token *) vector_slot (comps, i)); vector_free (comps); } else @@ -229,7 +228,7 @@ DEFUN (grammar_test_doc, cmd->func = NULL; // parse element - command_parse_format (nodegraph, cmd); + cmd_graph_parse (nodegraph, cmd); return CMD_SUCCESS; } @@ -526,6 +525,8 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, vty_out(vty, "%s", LOOKUP_DEF(tokennames, tok->type, tokennum)); if (tok->text) vty_out(vty, ":\"%s\"", tok->text); + if (tok->varname) + vty_out(vty, " => %s", tok->varname); if (desc) vty_out(vty, " ?'%s'", tok->desc); vty_out(vty, " "); @@ -588,7 +589,7 @@ pretty_print_dot (FILE *ofd, unsigned opts, struct graph_node *start, return; snprintf(tokennum, sizeof(tokennum), "%d?", tok->type); - fprintf(ofd, " n%016llx [ shape=box, label=<", (unsigned long long)start); + fprintf(ofd, " n%p [ shape=box, label=<", start); fprintf(ofd, "<b>%s</b>", LOOKUP_DEF(tokennames, tok->type, tokennum)); if (tok->attr == CMD_ATTR_DEPRECATED) @@ -621,20 +622,13 @@ pretty_print_dot (FILE *ofd, unsigned opts, struct graph_node *start, struct graph_node *adj = vector_slot (start->to, i); // if this node is a vararg, just print * if (adj == start) { - fprintf(ofd, " n%016llx -> n%016llx;\n", - (unsigned long long)start, - (unsigned long long)start); + fprintf(ofd, " n%p -> n%p;\n", start, start); } else if (((struct cmd_token *)adj->data)->type == END_TKN) { //struct cmd_token *et = adj->data; - fprintf(ofd, " n%016llx -> end%016llx;\n", - (unsigned long long)start, - (unsigned long long)adj); - fprintf(ofd, " end%016llx [ shape=box, label=<end>, style = filled, fillcolor = \"#ffddaa\" ];\n", - (unsigned long long)adj); + fprintf(ofd, " n%p -> end%p;\n", start, adj); + fprintf(ofd, " end%p [ shape=box, label=<end>, style = filled, fillcolor = \"#ffddaa\" ];\n", adj); } else { - fprintf(ofd, " n%016llx -> n%016llx;\n", - (unsigned long long)start, - (unsigned long long)adj); + fprintf(ofd, " n%p -> n%p;\n", start, adj); size_t k; for (k = 0; k < stackpos; k++) if (stack[k] == adj) @@ -654,8 +648,8 @@ init_cmdgraph (struct vty *vty, struct graph **graph) // initialize graph, add start noe *graph = graph_new (); nodegraph_free = *graph; - struct cmd_token *token = new_cmd_token (START_TKN, 0, NULL, NULL); - graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token); + struct cmd_token *token = cmd_token_new (START_TKN, 0, NULL, NULL); + graph_new_node (*graph, token, (void (*)(void *)) &cmd_token_del); if (vty) vty_out (vty, "initialized graph%s", VTY_NEWLINE); } diff --git a/lib/grammar_sandbox_main.c b/lib/grammar_sandbox_main.c index 681d4da44..3bf0e268c 100644 --- a/lib/grammar_sandbox_main.c +++ b/lib/grammar_sandbox_main.c @@ -19,8 +19,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include "command.h" diff --git a/lib/graph.c b/lib/graph.c index 0992059ef..6173b2084 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> #include "graph.h" diff --git a/lib/graph.h b/lib/graph.h index 8d8aa3823..d3973d4b0 100644 --- a/lib/graph.h +++ b/lib/graph.h @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_COMMAND_GRAPH_H diff --git a/lib/hash.c b/lib/hash.c index cb8531fcc..553a137eb 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/hash.h b/lib/hash.h index 11ecf75ec..bafb35a2a 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -1,22 +1,22 @@ /* Hash routine. - Copyright (C) 1998 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 1998 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_HASH_H #define _ZEBRA_HASH_H @@ -1,10 +1,9 @@ - /* * Interface functions. * Copyright (C) 1997, 98 Kunihiro Ishiguro * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -15,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -1126,6 +1124,36 @@ ifaddr_ipv4_lookup (struct in_addr *addr, ifindex_t ifindex) } #endif /* ifaddr_ipv4_table */ +static void if_autocomplete(vector comps, struct cmd_token *token) +{ + struct interface *ifp; + struct listnode *ln; + struct vrf *vrf = NULL; + + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + for (ALL_LIST_ELEMENTS_RO(vrf->iflist, ln, ifp)) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, ifp->name)); + } + +} + +static const struct cmd_variable_handler if_var_handlers[] = { + { + /* "interface NAME" */ + .varname = "interface", + .completions = if_autocomplete + }, { + .tokenname = "IFNAME", + .completions = if_autocomplete + }, { + .tokenname = "INTERFACE", + .completions = if_autocomplete + }, { + .completions = NULL + } +}; + /* Initialize interface list. */ void if_init (struct list **intf_list) @@ -1136,6 +1164,8 @@ if_init (struct list **intf_list) #endif /* ifaddr_ipv4_table */ (*intf_list)->cmp = (int (*)(void *, void *))if_cmp_func; + + cmd_variable_handler_register(if_var_handlers); } void @@ -1,22 +1,22 @@ /* Interface related header. - Copyright (C) 1997, 98, 99 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 1997, 98, 99 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_IF_H #define _ZEBRA_IF_H diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 2afb08c7c..fa9b17f2a 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/if_rmap.h b/lib/if_rmap.h index e6c2966ff..e38b5f7f7 100644 --- a/lib/if_rmap.h +++ b/lib/if_rmap.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_IF_RMAP_H diff --git a/lib/json.c b/lib/json.c index ccbecb726..186efc9f4 100644 --- a/lib/json.c +++ b/lib/json.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/json.h b/lib/json.h index 7e9861428..5faaaa841 100644 --- a/lib/json.h +++ b/lib/json.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_JSON_H diff --git a/lib/keychain.c b/lib/keychain.c index 95a2c8e59..1aa6edb4b 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -1,22 +1,22 @@ /* key-chain for authentication. - Copyright (C) 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/lib/keychain.h b/lib/keychain.h index d3f9168a0..e6bdcc6f0 100644 --- a/lib/keychain.h +++ b/lib/keychain.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_KEYCHAIN_H diff --git a/lib/libfrr.c b/lib/libfrr.c index de83e14f0..ff4160a24 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -13,9 +13,9 @@ * 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; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA + * 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 */ #include <zebra.h> @@ -36,6 +36,9 @@ const char frr_sysconfdir[] = SYSCONFDIR; const char frr_vtydir[] = DAEMON_VTY_DIR; const char frr_moduledir[] = MODULE_PATH; +char frr_protoname[] = "NONE"; +char frr_protonameinst[] = "NONE"; + char config_default[256]; static char pidfile_default[256]; static char vtypath_default[256]; @@ -164,6 +167,9 @@ void frr_preinit(struct frr_daemon_info *daemon, int argc, char **argv) frr_sysconfdir, di->name); snprintf(pidfile_default, sizeof(pidfile_default), "%s/%s.pid", frr_vtydir, di->name); + + strlcpy(frr_protoname, di->logname, sizeof(frr_protoname)); + strlcpy(frr_protonameinst, di->logname, sizeof(frr_protonameinst)); } void frr_opt_add(const char *optstr, const struct option *longopts, @@ -337,6 +343,10 @@ struct thread_master *frr_init(void) srandom(time(NULL)); + if (di->instance) + snprintf(frr_protonameinst, sizeof(frr_protonameinst), + "%s[%u]", di->logname, di->instance); + openzlog (di->progname, di->logname, di->instance, LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON); #if defined(HAVE_CUMULUS) diff --git a/lib/libfrr.h b/lib/libfrr.h index 0cc7ad564..832ff4486 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -13,9 +13,9 @@ * 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; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA + * 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 _ZEBRA_FRR_H @@ -110,4 +110,7 @@ extern const char frr_sysconfdir[]; extern const char frr_vtydir[]; extern const char frr_moduledir[]; +extern char frr_protoname[]; +extern char frr_protonameinst[]; + #endif /* _ZEBRA_FRR_H */ diff --git a/lib/libospf.h b/lib/libospf.h index a1ff9c24a..c9483a4c6 100644 --- a/lib/libospf.h +++ b/lib/libospf.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _LIBOSPFD_H diff --git a/lib/linklist.c b/lib/linklist.c index 6fe91c75f..0aee54d44 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/linklist.h b/lib/linklist.h index cd6e2f13a..37ba396a7 100644 --- a/lib/linklist.h +++ b/lib/linklist.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_LINKLIST_H @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #define FRR_DEFINE_DESC_TABLE @@ -764,12 +763,6 @@ closezlog (void) zlog_default = NULL; } -const char * -zlog_protoname (void) -{ - return zlog_default ? zlog_default->protoname : "NONE"; -} - /* Called from command.c. */ void zlog_set_level (zlog_dest_t dest, int log_level) @@ -14,16 +14,16 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_LOG_H #define _ZEBRA_LOG_H #include <syslog.h> +#include <stdint.h> #include <stdio.h> /* Here is some guidance on logging levels to use: @@ -64,13 +64,11 @@ struct message /* Open zlog function */ extern void openzlog (const char *progname, const char *protoname, - u_short instance, int syslog_options, int syslog_facility); + uint16_t instance, int syslog_options, int syslog_facility); /* Close zlog function. */ extern void closezlog (void); -extern const char *zlog_protoname (void); - /* GCC have printf type attribute check. */ #ifdef __GNUC__ #define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b))) diff --git a/lib/log_int.h b/lib/log_int.h index c21d723ac..7c93381cb 100644 --- a/lib/log_int.h +++ b/lib/log_int.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_LOG_PRIVATE_H diff --git a/lib/memory_vty.c b/lib/memory_vty.c index 6d63bc2d5..27254cfa5 100644 --- a/lib/memory_vty.c +++ b/lib/memory_vty.c @@ -14,9 +14,9 @@ * 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; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA + * 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 */ #include <zebra.h> diff --git a/lib/memory_vty.h b/lib/memory_vty.h index 565a75aa9..a47c5d51b 100644 --- a/lib/memory_vty.h +++ b/lib/memory_vty.h @@ -1,22 +1,22 @@ /* Memory management routine - Copyright (C) 1998 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_MEMORY_VTY_H #define _ZEBRA_MEMORY_VTY_H diff --git a/lib/mpls.h b/lib/mpls.h index f4f360c95..6cf014275 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _QUAGGA_MPLS_H diff --git a/lib/network.c b/lib/network.c index 2b6f2fbab..3d2c63c89 100644 --- a/lib/network.c +++ b/lib/network.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/network.h b/lib/network.h index a9126caf7..a6b8ed1e1 100644 --- a/lib/network.h +++ b/lib/network.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_NETWORK_H diff --git a/lib/nexthop.c b/lib/nexthop.c index a6420fea3..725b52c05 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/lib/nexthop.h b/lib/nexthop.h index 83c5b850b..8c9c801c9 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -15,10 +15,9 @@ * 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. + * 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 _LIB_NEXTHOP_H @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_NS_H diff --git a/lib/pid_output.c b/lib/pid_output.c index ba1f37476..7369e23c2 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/plist.c b/lib/plist.c index 371496969..d9bdeab6b 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -30,6 +29,7 @@ #include "log.h" #include "routemap.h" #include "lib/json.h" +#include "libfrr.h" #include "plist_int.h" @@ -1175,7 +1175,7 @@ vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist, struct prefix_list_entry *pentry; /* Print the name of the protocol */ - vty_out(vty, "%s: ", zlog_protoname()); + vty_out(vty, "%s: ", frr_protoname); if (dtype == normal_display) { @@ -3157,6 +3157,40 @@ config_write_prefix_ipv4 (struct vty *vty) } static void +plist_autocomplete_afi (afi_t afi, vector comps, struct cmd_token *token) +{ + struct prefix_list *plist; + struct prefix_master *master; + + master = prefix_master_get (afi, 0); + if (master == NULL) + return; + + for (plist = master->str.head; plist; plist = plist->next) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, plist->name)); + for (plist = master->num.head; plist; plist = plist->next) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, plist->name)); +} + +static void +plist_autocomplete(vector comps, struct cmd_token *token) +{ + plist_autocomplete_afi (AFI_IP, comps, token); + plist_autocomplete_afi (AFI_IP6, comps, token); +} + +static const struct cmd_variable_handler plist_var_handlers[] = { + { + /* "prefix-list WORD" */ + .varname = "prefix_list", + .completions = plist_autocomplete + }, { + .completions = NULL + } +}; + + +static void prefix_list_init_ipv4 (void) { install_node (&prefix_node, config_write_prefix_ipv4); @@ -3275,6 +3309,8 @@ prefix_list_init_ipv6 (void) void prefix_list_init () { + cmd_variable_handler_register(plist_var_handlers); + prefix_list_init_ipv4 (); prefix_list_init_ipv6 (); } diff --git a/lib/plist.h b/lib/plist.h index 89d9a874f..0f397ff01 100644 --- a/lib/plist.h +++ b/lib/plist.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _QUAGGA_PLIST_H diff --git a/lib/plist_int.h b/lib/plist_int.h index e6e5901db..e711d1256 100644 --- a/lib/plist_int.h +++ b/lib/plist_int.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _QUAGGA_PLIST_INT_H diff --git a/lib/pqueue.c b/lib/pqueue.c index fa502b462..2d9127b88 100644 --- a/lib/pqueue.c +++ b/lib/pqueue.c @@ -1,22 +1,22 @@ /* Priority queue functions. - Copyright (C) 2003 Yasuhiro Ohara - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 2003 Yasuhiro Ohara + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/lib/pqueue.h b/lib/pqueue.h index b39fb92ee..d87d91fdc 100644 --- a/lib/pqueue.h +++ b/lib/pqueue.h @@ -1,22 +1,22 @@ /* Priority queue functions. - Copyright (C) 2003 Yasuhiro Ohara - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ + * Copyright (C) 2003 Yasuhiro Ohara + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_PQUEUE_H #define _ZEBRA_PQUEUE_H diff --git a/lib/prefix.c b/lib/prefix.c index 0cc759bb7..9c228cf95 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -252,12 +251,14 @@ safi2str(safi_t safi) return "unicast"; case SAFI_MULTICAST: return "multicast"; - case SAFI_ENCAP: - return "encap"; case SAFI_MPLS_VPN: return "vpn"; + case SAFI_ENCAP: + return "encap"; case SAFI_EVPN: return "evpn"; + case SAFI_LABELED_UNICAST: + return "labeled-unicast"; } return NULL; } diff --git a/lib/prefix.h b/lib/prefix.h index 786c2bf7e..35dfddd9d 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_PREFIX_H @@ -180,7 +179,7 @@ struct prefix_sg { u_char family; u_char prefixlen; - struct in_addr src __attribute ((aligned (8))); + struct in_addr src __attribute__ ((aligned (8))); struct in_addr grp; }; diff --git a/lib/privs.c b/lib/privs.c index 767ab667e..6b5dc9e1a 100644 --- a/lib/privs.c +++ b/lib/privs.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> #include "log.h" @@ -105,7 +104,7 @@ static struct #ifdef HAVE_LCAPS /* Quagga -> Linux capabilities mappings */ [ZCAP_SETID] = { 2, (pvalue_t []) { CAP_SETGID, CAP_SETUID }, }, - [ZCAP_BIND] = { 2, (pvalue_t []) { CAP_NET_BIND_SERVICE }, }, + [ZCAP_BIND] = { 1, (pvalue_t []) { CAP_NET_BIND_SERVICE }, }, [ZCAP_NET_ADMIN] = { 1, (pvalue_t []) { CAP_NET_ADMIN }, }, [ZCAP_NET_RAW] = { 1, (pvalue_t []) { CAP_NET_RAW }, }, [ZCAP_CHROOT] = { 1, (pvalue_t []) { CAP_SYS_CHROOT, }, }, @@ -130,7 +129,7 @@ static struct [ZCAP_CHROOT] = { 1, (pvalue_t []) { PRIV_PROC_CHROOT }, }, [ZCAP_NICE] = { 1, (pvalue_t []) { PRIV_PROC_PRIOCNTL }, }, [ZCAP_PTRACE] = { 1, (pvalue_t []) { PRIV_PROC_SESSION }, }, - [ZCAP_DAC_OVERRIDE] = { 2, (pvalue_t []) { PRIV_FILE_DAC_EXECUTE, + [ZCAP_DAC_OVERRIDE] = { 5, (pvalue_t []) { PRIV_FILE_DAC_EXECUTE, PRIV_FILE_DAC_READ, PRIV_FILE_DAC_SEARCH, PRIV_FILE_DAC_WRITE, diff --git a/lib/privs.h b/lib/privs.h index 46d614e00..9a5eb3bd6 100644 --- a/lib/privs.h +++ b/lib/privs.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_PRIVS_H diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c index a93d7b847..7181e2d89 100644 --- a/lib/ptm_lib.c +++ b/lib/ptm_lib.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <stdio.h> #include <stdlib.h> diff --git a/lib/ptm_lib.h b/lib/ptm_lib.h index be4170bb3..747ce349a 100644 --- a/lib/ptm_lib.h +++ b/lib/ptm_lib.h @@ -13,10 +13,9 @@ * 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. + * 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 __PTM_LIB_H__ #define __PTM_LIB_H__ diff --git a/lib/qobj.c b/lib/qobj.c index 8a386d248..4cf7fbca7 100644 --- a/lib/qobj.c +++ b/lib/qobj.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> @@ -27,6 +26,7 @@ #include "log.h" #include "qobj.h" +static pthread_rwlock_t nodes_lock; static struct hash *nodes = NULL; static unsigned int qobj_key (void *data) @@ -44,37 +44,61 @@ static int qobj_cmp (const void *a, const void *b) void qobj_reg(struct qobj_node *node, struct qobj_nodetype *type) { node->type = type; + pthread_rwlock_wrlock (&nodes_lock); do { node->nid = (uint64_t)random(); node->nid ^= (uint64_t)random() << 32; } while (!node->nid || hash_get (nodes, node, hash_alloc_intern) != node); + pthread_rwlock_unlock (&nodes_lock); } void qobj_unreg(struct qobj_node *node) { + pthread_rwlock_wrlock (&nodes_lock); hash_release (nodes, node); + pthread_rwlock_unlock (&nodes_lock); } struct qobj_node *qobj_get(uint64_t id) { - struct qobj_node dummy = { .nid = id }; - return hash_lookup (nodes, &dummy); + struct qobj_node dummy = { .nid = id }, *rv; + pthread_rwlock_rdlock (&nodes_lock); + rv = hash_lookup (nodes, &dummy); + pthread_rwlock_unlock (&nodes_lock); + return rv; } void *qobj_get_typed(uint64_t id, struct qobj_nodetype *type) { - struct qobj_node *node = qobj_get(id); + struct qobj_node dummy = { .nid = id }; + struct qobj_node *node; + void *rv; + + pthread_rwlock_rdlock (&nodes_lock); + node = hash_lookup (nodes, &dummy); + + /* note: we explicitly hold the lock until after we have checked the type. + * if the caller holds a lock that for example prevents the deletion of + * route-maps, we can still race against a delete of something that isn't + * a route-map. */ if (!node || node->type != type) - return NULL; - return (char *)node - node->type->node_member_offset; + rv = NULL; + else + rv = (char *)node - node->type->node_member_offset; + + pthread_rwlock_unlock (&nodes_lock); + return rv; } void qobj_init (void) { if (!nodes) - nodes = hash_create (qobj_key, qobj_cmp); + { + pthread_rwlock_init (&nodes_lock, NULL); + nodes = hash_create (qobj_key, qobj_cmp); + } } void qobj_finish (void) @@ -82,4 +106,5 @@ void qobj_finish (void) hash_clean (nodes, NULL); hash_free (nodes); nodes = NULL; + pthread_rwlock_destroy (&nodes_lock); } diff --git a/lib/qobj.h b/lib/qobj.h index 64a6774bf..c24bed4f6 100644 --- a/lib/qobj.h +++ b/lib/qobj.h @@ -81,7 +81,18 @@ struct qobj_node { #define QOBJ_UNREG(n) \ qobj_unreg(&n->qobj_node) -/* internals - should not be directly used without a good reason*/ +/* internals - should not be directly used without a good reason + * + * note: qobj_get is essentially never safe to use in MT context because + * the object could be deleted by another thread -- and worse, it could be + * of the "wrong" type and deleted. + * + * with qobj_get_typed, the type check is done under lock, which means that + * it can be used as long as another lock prevents the deletion of objects + * of the expected type. + * + * in the long this may need another touch, e.g. built-in per-object locking. + */ void qobj_reg(struct qobj_node *node, struct qobj_nodetype *type); void qobj_unreg(struct qobj_node *node); struct qobj_node *qobj_get(uint64_t id); diff --git a/lib/routemap.c b/lib/routemap.c index cd34ffaae..ed79beb1e 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1,22 +1,22 @@ /* Route map function. - Copyright (C) 1998, 1999 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1998, 1999 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -28,8 +28,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "routemap.h" #include "command.h" #include "log.h" -#include "log_int.h" #include "hash.h" +#include "libfrr.h" DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map") DEFINE_MTYPE( LIB, ROUTE_MAP_NAME, "Route map name") @@ -989,14 +989,7 @@ vty_show_route_map_entry (struct vty *vty, struct route_map *map) struct route_map_index *index; struct route_map_rule *rule; - /* Print the name of the protocol */ - if (zlog_default) - { - vty_out (vty, "%s", zlog_protoname()); - if (zlog_default->instance) - vty_out (vty, " %d", zlog_default->instance); - } - vty_out (vty, ":%s", VTY_NEWLINE); + vty_out (vty, "%s:%s", frr_protonameinst, VTY_NEWLINE); for (index = map->head; index; index = index->next) { @@ -1052,10 +1045,8 @@ vty_show_route_map (struct vty *vty, const char *name) } else { - vty_out (vty, "%s", zlog_protoname()); - if (zlog_default && zlog_default->instance) - vty_out (vty, " %d", zlog_default->instance); - vty_out (vty, ": 'route-map %s' not found%s", name, VTY_NEWLINE); + vty_out (vty, "%s: 'route-map %s' not found%s", frr_protonameinst, + name, VTY_NEWLINE); return CMD_SUCCESS; } } @@ -2001,7 +1992,7 @@ DEFUN (match_interface, DEFUN (no_match_interface, no_match_interface_cmd, - "no match interface [INTERFACE]", + "no match interface [WORD]", NO_STR MATCH_STR "Match first hop interface of route\n" @@ -2958,6 +2949,30 @@ route_map_finish (void) route_map_master_hash = NULL; } +static void rmap_autocomplete(vector comps, struct cmd_token *token) +{ + struct route_map *map; + + for (map = route_map_master.head; map; map = map->next) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, map->name)); +} + +static const struct cmd_variable_handler rmap_var_handlers[] = { + { + /* "route-map WORD" */ + .varname = "route_map", + .completions = rmap_autocomplete + }, { + .tokenname = "ROUTEMAP_NAME", + .completions = rmap_autocomplete + }, { + .tokenname = "RMAP_NAME", + .completions = rmap_autocomplete + }, { + .completions = NULL + } +}; + /* Initialization of route map vector. */ void route_map_init (void) @@ -2973,6 +2988,8 @@ route_map_init (void) route_map_dep_hash[i] = hash_create(route_map_dep_hash_make_key, route_map_dep_hash_cmp); + cmd_variable_handler_register(rmap_var_handlers); + /* Install route map top node. */ install_node (&rmap_node, route_map_config_write); diff --git a/lib/routemap.h b/lib/routemap.h index b378c64ea..f1937ac40 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_ROUTEMAP_H diff --git a/lib/sigevent.c b/lib/sigevent.c index a34fd4946..e8c722b98 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/lib/sigevent.h b/lib/sigevent.h index 248fa2c05..08eb1ca41 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -15,10 +15,9 @@ * 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. + * 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 _QUAGGA_SIGNAL_H diff --git a/lib/smux.c b/lib/smux.c index 6e53061d4..032801f6d 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/smux.h b/lib/smux.h index dc91cac71..e94a7a9cc 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_SNMP_H diff --git a/lib/snmp.c b/lib/snmp.c index 1cbd41c72..7eb86e941 100644 --- a/lib/snmp.c +++ b/lib/snmp.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/sockopt.c b/lib/sockopt.c index 2a9f907cb..83ea57483 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/sockopt.h b/lib/sockopt.h index 1b7be1e49..d31fcaa41 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_SOCKOPT_H diff --git a/lib/sockunion.c b/lib/sockunion.c index 9ba2ce82f..423ad2044 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/sockunion.h b/lib/sockunion.h index bed68e1ee..98c3e0ade 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_SOCKUNION_H diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index 9a9af8db2..7e3494734 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -19,10 +19,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/spf_backoff.h b/lib/spf_backoff.h index 552ca4ae4..92bd46506 100644 --- a/lib/spf_backoff.h +++ b/lib/spf_backoff.h @@ -19,10 +19,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_SPF_BACKOFF_H #define _ZEBRA_SPF_BACKOFF_H diff --git a/lib/srcdest_table.c b/lib/srcdest_table.c index 04c9eff79..383cf00d4 100644 --- a/lib/srcdest_table.c +++ b/lib/srcdest_table.c @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/srcdest_table.h b/lib/srcdest_table.h index 207f5d121..0d858d11a 100644 --- a/lib/srcdest_table.h +++ b/lib/srcdest_table.h @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_SRC_DEST_TABLE_H diff --git a/lib/stream.c b/lib/stream.c index 32dde1ca0..e8320a8fa 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -1,4 +1,4 @@ - /* +/* * Packet interface * Copyright (C) 1999 Kunihiro Ishiguro * @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/stream.h b/lib/stream.h index b7bf31bf7..dd6aae677 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_STREAM_H diff --git a/lib/strlcat.c b/lib/strlcat.c index 1d04b43d9..6fdb2a4a3 100644 --- a/lib/strlcat.c +++ b/lib/strlcat.c @@ -1,20 +1,21 @@ /* Append a null-terminated string to another string, with length checking. - Copyright (C) 2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + * Copyright (C) 2016 Free Software Foundation, Inc. + * This file is part of the GNU C Library. + * + * The GNU C Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, see + * <http://www.gnu.org/licenses/>. + */ /* adapted for Quagga from glibc patch submission originally from * Florian Weimer <fweimer@redhat.com>, 2016-05-18 */ diff --git a/lib/strlcpy.c b/lib/strlcpy.c index 41bab97ea..112c8180b 100644 --- a/lib/strlcpy.c +++ b/lib/strlcpy.c @@ -1,20 +1,21 @@ /* Copy a null-terminated string to a fixed-size buffer, with length checking. - Copyright (C) 2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + * Copyright (C) 2016 Free Software Foundation, Inc. + * This file is part of the GNU C Library. + * + * The GNU C Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * The GNU C Library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the GNU C Library; if not, see + * <http://www.gnu.org/licenses/>. + */ /* adapted for Quagga from glibc patch submission originally from * Florian Weimer <fweimer@redhat.com>, 2016-05-18 */ diff --git a/lib/systemd.c b/lib/systemd.c index e2329af93..341de9eab 100644 --- a/lib/systemd.c +++ b/lib/systemd.c @@ -1,23 +1,23 @@ /* lib/systemd Code - Copyright (C) 2016 Cumulus Networks, Inc. - Donald Sharp - -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. */ + * Copyright (C) 2016 Cumulus Networks, Inc. + * Donald Sharp + * + * 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 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 + */ #include <zebra.h> diff --git a/lib/systemd.h b/lib/systemd.h index 685f3d9a7..c048797cf 100644 --- a/lib/systemd.h +++ b/lib/systemd.h @@ -1,23 +1,23 @@ /* lib/systemd Code - Copyright (C) 2016 Cumulus Networks, Inc. - Donald Sharp - -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. */ + * Copyright (C) 2016 Cumulus Networks, Inc. + * Donald Sharp + * + * 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 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 + */ /* * Wrapper functions to systemd calls. diff --git a/lib/table.c b/lib/table.c index 7f789dd3c..1461bb81a 100644 --- a/lib/table.c +++ b/lib/table.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/table.h b/lib/table.h index 1691a8e20..00131b29c 100644 --- a/lib/table.h +++ b/lib/table.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_TABLE_H diff --git a/lib/thread.c b/lib/thread.c index e4dbebe1c..ccb635a87 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* #define DEBUG */ @@ -378,6 +377,7 @@ thread_master_create (void) rv->timer->update = rv->background->update = thread_timer_update; rv->spin = true; rv->handle_signals = true; + rv->owner = pthread_self(); #if defined(HAVE_POLL_CALL) rv->handler.pfdsize = rv->fd_limit; @@ -613,6 +613,7 @@ thread_get (struct thread_master *m, u_char type, thread->arg = arg; thread->index = -1; thread->yield = THREAD_YIELD_TIME_SLOT; /* default */ + thread->ref = NULL; /* * So if the passed in funcname is not what we have @@ -776,7 +777,7 @@ fd_clear_read_write (struct thread *thread) } /* Add new read thread. */ -void +struct thread * funcname_thread_add_read_write (int dir, struct thread_master *m, int (*func) (struct thread *), void *arg, int fd, struct thread **t_ptr, debugargdef) @@ -788,7 +789,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, if (t_ptr && *t_ptr) // thread is already scheduled; don't reschedule { pthread_mutex_unlock (&m->mtx); - return; + return NULL; } #if defined (HAVE_POLL_CALL) @@ -829,18 +830,20 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, thread_add_fd (m->write, thread); } pthread_mutex_unlock (&thread->mtx); - } - if (t_ptr) - { - *t_ptr = thread; - thread->ref = t_ptr; + if (t_ptr) + { + *t_ptr = thread; + thread->ref = t_ptr; + } } } pthread_mutex_unlock (&m->mtx); + + return thread; } -static void +static struct thread * funcname_thread_add_timer_timeval (struct thread_master *m, int (*func) (struct thread *), int type, void *arg, struct timeval *time_relative, struct thread **t_ptr, debugargdef) @@ -858,7 +861,7 @@ funcname_thread_add_timer_timeval (struct thread_master *m, if (t_ptr && *t_ptr) // thread is already scheduled; don't reschedule { pthread_mutex_unlock (&m->mtx); - return; + return NULL; } queue = ((type == THREAD_TIMER) ? m->timer : m->background); @@ -869,21 +872,22 @@ funcname_thread_add_timer_timeval (struct thread_master *m, monotime(&thread->u.sands); timeradd(&thread->u.sands, time_relative, &thread->u.sands); pqueue_enqueue(thread, queue); + if (t_ptr) + { + *t_ptr = thread; + thread->ref = t_ptr; + } } pthread_mutex_unlock (&thread->mtx); - - if (t_ptr) - { - *t_ptr = thread; - thread->ref = t_ptr; - } } pthread_mutex_unlock (&m->mtx); + + return thread; } /* Add timer event thread. */ -void +struct thread * funcname_thread_add_timer (struct thread_master *m, int (*func) (struct thread *), void *arg, long timer, struct thread **t_ptr, debugargdef) @@ -900,7 +904,7 @@ funcname_thread_add_timer (struct thread_master *m, } /* Add timer event thread with "millisecond" resolution */ -void +struct thread * funcname_thread_add_timer_msec (struct thread_master *m, int (*func) (struct thread *), void *arg, long timer, struct thread **t_ptr, debugargdef) @@ -912,22 +916,22 @@ funcname_thread_add_timer_msec (struct thread_master *m, trel.tv_sec = timer / 1000; trel.tv_usec = 1000*(timer % 1000); - funcname_thread_add_timer_timeval (m, func, THREAD_TIMER, arg, &trel, - t_ptr, debugargpass); + return funcname_thread_add_timer_timeval (m, func, THREAD_TIMER, arg, &trel, + t_ptr, debugargpass); } /* Add timer event thread with "millisecond" resolution */ -void +struct thread * funcname_thread_add_timer_tv (struct thread_master *m, int (*func) (struct thread *), void *arg, struct timeval *tv, struct thread **t_ptr, debugargdef) { - funcname_thread_add_timer_timeval (m, func, THREAD_TIMER, arg, tv, t_ptr, - debugargpass); + return funcname_thread_add_timer_timeval (m, func, THREAD_TIMER, arg, tv, + t_ptr, debugargpass); } /* Add a background thread, with an optional millisec delay */ -void +struct thread * funcname_thread_add_background (struct thread_master *m, int (*func) (struct thread *), void *arg, long delay, struct thread **t_ptr, debugargdef) @@ -947,12 +951,12 @@ funcname_thread_add_background (struct thread_master *m, trel.tv_usec = 0; } - funcname_thread_add_timer_timeval (m, func, THREAD_BACKGROUND, arg, &trel, - t_ptr, debugargpass); + return funcname_thread_add_timer_timeval (m, func, THREAD_BACKGROUND, arg, &trel, + t_ptr, debugargpass); } /* Add simple event thread. */ -void +struct thread * funcname_thread_add_event (struct thread_master *m, int (*func) (struct thread *), void *arg, int val, struct thread **t_ptr, debugargdef) @@ -966,7 +970,7 @@ funcname_thread_add_event (struct thread_master *m, if (t_ptr && *t_ptr) // thread is already scheduled; don't reschedule { pthread_mutex_unlock (&m->mtx); - return; + return NULL; } thread = thread_get (m, THREAD_EVENT, func, arg, debugargpass); @@ -984,6 +988,8 @@ funcname_thread_add_event (struct thread_master *m, } } pthread_mutex_unlock (&m->mtx); + + return thread; } static void @@ -1016,7 +1022,7 @@ thread_cancel_read_or_write (struct thread *thread, short int state) * Cancel thread from scheduler. * * This function is *NOT* MT-safe. DO NOT call it from any other pthread except - * the one which owns thread->master. + * the one which owns thread->master. You will crash. */ void thread_cancel (struct thread *thread) @@ -1025,8 +1031,10 @@ thread_cancel (struct thread *thread) struct pqueue *queue = NULL; struct thread **thread_array = NULL; - pthread_mutex_lock (&thread->master->mtx); pthread_mutex_lock (&thread->mtx); + pthread_mutex_lock (&thread->master->mtx); + + assert (pthread_self() == thread->master->owner); switch (thread->type) { @@ -1087,8 +1095,8 @@ thread_cancel (struct thread *thread) thread_add_unuse (thread->master, thread); done: - pthread_mutex_unlock (&thread->mtx); pthread_mutex_unlock (&thread->master->mtx); + pthread_mutex_unlock (&thread->mtx); } /* Delete all events which has argument value arg. */ @@ -1211,14 +1219,13 @@ check_pollfds(struct thread_master *m, fd_set *readfd, int num) ready++; /* POLLIN / POLLOUT process event */ - if (m->handler.pfds[i].revents & POLLIN) + if (m->handler.pfds[i].revents & (POLLIN | POLLHUP)) thread_process_fds_helper(m, m->read[m->handler.pfds[i].fd], NULL, POLLIN, i); if (m->handler.pfds[i].revents & POLLOUT) thread_process_fds_helper(m, m->write[m->handler.pfds[i].fd], NULL, POLLOUT, i); /* remove fd from list on POLLNVAL */ - if (m->handler.pfds[i].revents & POLLNVAL || - m->handler.pfds[i].revents & POLLHUP) + if (m->handler.pfds[i].revents & POLLNVAL) { memmove(m->handler.pfds+i, m->handler.pfds+i+1, diff --git a/lib/thread.h b/lib/thread.h index 3eaae8883..7e79eb38d 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_THREAD_H @@ -89,6 +88,7 @@ struct thread_master bool spin; bool handle_signals; pthread_mutex_t mtx; + pthread_t owner; }; typedef unsigned char thread_type; @@ -185,22 +185,22 @@ extern struct thread_master *thread_master_create (void); extern void thread_master_free (struct thread_master *); extern void thread_master_free_unused(struct thread_master *); -extern void funcname_thread_add_read_write (int dir, struct thread_master *, +extern struct thread * funcname_thread_add_read_write (int dir, struct thread_master *, int (*)(struct thread *), void *, int, struct thread **, debugargdef); -extern void funcname_thread_add_timer (struct thread_master *, +extern struct thread * funcname_thread_add_timer (struct thread_master *, int (*)(struct thread *), void *, long, struct thread **, debugargdef); -extern void funcname_thread_add_timer_msec (struct thread_master *, +extern struct thread * funcname_thread_add_timer_msec (struct thread_master *, int (*)(struct thread *), void *, long, struct thread **, debugargdef); -extern void funcname_thread_add_timer_tv (struct thread_master *, +extern struct thread * funcname_thread_add_timer_tv (struct thread_master *, int (*)(struct thread *), void *, struct timeval *, struct thread **, debugargdef); -extern void funcname_thread_add_event (struct thread_master *, +extern struct thread * funcname_thread_add_event (struct thread_master *, int (*)(struct thread *), void *, int, struct thread **, debugargdef); -extern void funcname_thread_add_background (struct thread_master *, +extern struct thread * funcname_thread_add_background (struct thread_master *, int (*)(struct thread *), void *, long, struct thread **, debugargdef); extern void funcname_thread_execute (struct thread_master *, diff --git a/lib/vector.c b/lib/vector.c index e16fcf531..110cd2915 100644 --- a/lib/vector.c +++ b/lib/vector.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/lib/vector.h b/lib/vector.h index f57f28bbd..ab1d1e6aa 100644 --- a/lib/vector.h +++ b/lib/vector.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_VECTOR_H @@ -14,16 +14,16 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> #include "if.h" #include "vrf.h" +#include "vrf_int.h" #include "prefix.h" #include "table.h" #include "log.h" @@ -237,33 +237,6 @@ vrf_disable (struct vrf *vrf) (*vrf_master.vrf_disable_hook) (vrf); } - -/* Add a VRF hook. Please add hooks before calling vrf_init(). */ -void -vrf_add_hook (int type, int (*func)(struct vrf *)) -{ - if (debug_vrf) - zlog_debug ("%s: Add Hook %d to function %p", __PRETTY_FUNCTION__, - type, func); - - switch (type) { - case VRF_NEW_HOOK: - vrf_master.vrf_new_hook = func; - break; - case VRF_DELETE_HOOK: - vrf_master.vrf_delete_hook = func; - break; - case VRF_ENABLE_HOOK: - vrf_master.vrf_enable_hook = func; - break; - case VRF_DISABLE_HOOK: - vrf_master.vrf_disable_hook = func; - break; - default: - break; - } -} - vrf_id_t vrf_name_to_id (const char *name) { @@ -309,24 +282,6 @@ vrf_iflist_get (vrf_id_t vrf_id) return vrf->iflist; } -/* Create the interface list for the specified VRF, if needed. */ -void -vrf_iflist_create (vrf_id_t vrf_id) -{ - struct vrf * vrf = vrf_lookup_by_id (vrf_id); - if (vrf && !vrf->iflist) - if_init (&vrf->iflist); -} - -/* Free the interface list of the specified VRF. */ -void -vrf_iflist_terminate (vrf_id_t vrf_id) -{ - struct vrf * vrf = vrf_lookup_by_id (vrf_id); - if (vrf && vrf->iflist) - if_terminate (&vrf->iflist); -} - /* * VRF bit-map */ @@ -424,13 +379,21 @@ vrf_bitmap_check (vrf_bitmap_t bmap, vrf_id_t vrf_id) /* Initialize VRF module. */ void -vrf_init (void) +vrf_init (int (*create)(struct vrf *), + int (*enable)(struct vrf *), + int (*disable)(struct vrf *), + int (*delete)(struct vrf *)) { struct vrf *default_vrf; if (debug_vrf) zlog_debug ("%s: Initializing VRF subsystem", __PRETTY_FUNCTION__); + vrf_master.vrf_new_hook = create; + vrf_master.vrf_enable_hook = enable; + vrf_master.vrf_disable_hook = disable; + vrf_master.vrf_delete_hook = delete; + /* The default VRF always exists. */ default_vrf = vrf_get (VRF_DEFAULT, VRF_DEFAULT_NAME); if (!default_vrf) @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_VRF_H @@ -57,15 +56,6 @@ enum { #define VRF_CMD_HELP_STR "Specify the VRF\nThe VRF name\n" #define VRF_ALL_CMD_HELP_STR "Specify the VRF\nAll VRFs\n" -/* - * VRF hooks - */ - -#define VRF_NEW_HOOK 0 /* a new VRF is just created */ -#define VRF_DELETE_HOOK 1 /* a VRF is to be deleted */ -#define VRF_ENABLE_HOOK 2 /* a VRF is ready to use */ -#define VRF_DISABLE_HOOK 3 /* a VRF is to be unusable */ - struct vrf { RB_ENTRY(vrf) id_entry, name_entry; @@ -98,21 +88,9 @@ DECLARE_QOBJ_TYPE(vrf) extern struct vrf_id_head vrfs_by_id; extern struct vrf_name_head vrfs_by_name; -/* - * Add a specific hook to VRF module. - * @param1: hook type - * @param2: the callback function - * - param 1: the VRF ID - * - param 2: the address of the user data pointer (the user data - * can be stored in or freed from there) - */ -extern void vrf_add_hook (int, int (*)(struct vrf *)); - extern struct vrf *vrf_lookup_by_id (vrf_id_t); extern struct vrf *vrf_lookup_by_name (const char *); extern struct vrf *vrf_get (vrf_id_t, const char *); -extern void vrf_delete (struct vrf *); -extern int vrf_enable (struct vrf *); extern vrf_id_t vrf_name_to_id (const char *); #define VRF_GET_ID(V,NAME) \ @@ -148,10 +126,6 @@ extern void *vrf_info_lookup (vrf_id_t); extern struct list *vrf_iflist (vrf_id_t); /* Get the interface list of the specified VRF. Create one if not find. */ extern struct list *vrf_iflist_get (vrf_id_t); -/* Create the interface list for the specified VRF, if needed. */ -extern void vrf_iflist_create (vrf_id_t vrf_id); -/* Free the interface list of the specified VRF. */ -extern void vrf_iflist_terminate (vrf_id_t vrf_id); /* * VRF bit-map: maintaining flags, one bit per VRF ID @@ -168,9 +142,31 @@ extern int vrf_bitmap_check (vrf_bitmap_t, vrf_id_t); /* * VRF initializer/destructor + * + * create -> Called back when a new VRF is created. This + * can be either through these 3 options: + * 1) CLI mentions a vrf before OS knows about it + * 2) OS calls zebra and we create the vrf from OS + * callback + * 3) zebra calls individual protocols to notify + * about the new vrf + * + * enable -> Called back when a VRF is actually usable from + * an OS perspective ( 2 and 3 above ) + * + * disable -> Called back when a VRF is being deleted from + * the system ( 2 and 3 ) above + * + * delete -> Called back when a vrf is being deleted from + * the system ( 2 and 3 ) above. + */ +extern void vrf_init (int (*create)(struct vrf *), + int (*enable)(struct vrf *), + int (*disable)(struct vrf *), + int (*delete)(struct vrf *)); +/* + * Call vrf_terminate when the protocol is being shutdown */ -/* Please add hooks before calling vrf_init(). */ -extern void vrf_init (void); extern void vrf_terminate (void); extern void vrf_cmd_init (int (*writefunc)(struct vty *vty)); diff --git a/lib/vrf_int.h b/lib/vrf_int.h new file mode 100644 index 000000000..f0301b767 --- /dev/null +++ b/lib/vrf_int.h @@ -0,0 +1,56 @@ +/* + * VRF Internal Header + * Copyright (C) 2017 Cumulus Networks, Inc. + * Donald Sharp + * + * This file is part of FRR. + * + * FRR 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. + * + * FRR 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 FRR; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +#ifndef __LIB_VRF_PRIVATE_H__ +#define __LIB_VRF_PRIVATE_H__ + +#include "vrf.h" + +/* + * These functions should only be called by: + * zebra/if_netlink.c -> The interface from OS into Zebra + * lib/zclient.c -> The interface from Zebra to each daemon + * + * Why you ask? Well because these are the turn on/off + * functions and the only place we can really turn a + * vrf on properly is in the call up from the os -> zebra + * and the pass through of this informatoin from zebra -> protocols + */ + +/* + * vrf_enable + * + * Given a newly running vrf enable it to be used + * by interested routing protocols + */ +extern int vrf_enable (struct vrf *); + +/* + * vrf_delete + * + * Given a vrf that is being deleted, delete it + * from interested parties + */ +extern void vrf_delete (struct vrf *); + +#endif + @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -35,6 +34,7 @@ #include "vty.h" #include "privs.h" #include "network.h" +#include "libfrr.h" #include <arpa/telnet.h> #include <termios.h> @@ -457,7 +457,7 @@ vty_command (struct vty *vty, char *buf) ret = cmd_execute_command (vline, vty, NULL, 0); /* Get the name of the protocol if any */ - protocolname = zlog_protoname(); + protocolname = frr_protoname; #ifdef CONSUMED_TIME_CHECK GETRUSAGE(&after); @@ -738,8 +738,6 @@ vty_end_config (struct vty *vty) case BGP_NODE: case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_VRF_POLICY_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -955,14 +953,14 @@ vty_complete_command (struct vty *vty) vty_backward_pure_word (vty); vty_insert_word_overwrite (vty, matched[0]); vty_self_insert (vty, ' '); - XFREE (MTYPE_TMP, matched[0]); + XFREE (MTYPE_COMPLETION, matched[0]); break; case CMD_COMPLETE_MATCH: vty_prompt (vty); vty_redraw_line (vty); vty_backward_pure_word (vty); vty_insert_word_overwrite (vty, matched[0]); - XFREE (MTYPE_TMP, matched[0]); + XFREE (MTYPE_COMPLETION, matched[0]); break; case CMD_COMPLETE_LIST_MATCH: for (i = 0; matched[i] != NULL; i++) @@ -970,7 +968,7 @@ vty_complete_command (struct vty *vty) if (i != 0 && ((i % 6) == 0)) vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%-10s ", matched[i]); - XFREE (MTYPE_TMP, matched[i]); + XFREE (MTYPE_COMPLETION, matched[i]); } vty_out (vty, "%s", VTY_NEWLINE); @@ -1109,6 +1107,26 @@ vty_describe_command (struct vty *vty) else vty_describe_fold (vty, width, desc_width, token); + if (IS_VARYING_TOKEN(token->type)) + { + const char *ref = vector_slot(vline, vector_active(vline) - 1); + + vector varcomps = vector_init (VECTOR_MIN_SIZE); + cmd_variable_complete (token, ref, varcomps); + + if (vector_active(varcomps) > 0) + { + vty_out(vty, " "); + for (size_t j = 0; j < vector_active (varcomps); j++) + { + char *item = vector_slot (varcomps, j); + vty_out(vty, " %s", item); + XFREE(MTYPE_COMPLETION, item); + } + vty_out(vty, "%s", VTY_NEWLINE); + } + vector_free(varcomps); + } #if 0 vty_out (vty, " %-*s %s%s", width desc->cmd[0] == '.' ? desc->cmd + 1 : desc->cmd, @@ -2613,19 +2631,17 @@ static struct thread_master *vty_master; static void vty_event (enum event event, int sock, struct vty *vty) { - struct thread *vty_serv_thread; + struct thread *vty_serv_thread = NULL; switch (event) { case VTY_SERV: - vty_serv_thread = NULL; - thread_add_read(vty_master, vty_accept, vty, sock, &vty_serv_thread); + vty_serv_thread = thread_add_read(vty_master, vty_accept, vty, sock, NULL); vector_set_index (Vvty_serv_thread, sock, vty_serv_thread); break; #ifdef VTYSH case VTYSH_SERV: - vty_serv_thread = NULL; - thread_add_read(vty_master, vtysh_accept, vty, sock, &vty_serv_thread); + vty_serv_thread = thread_add_read(vty_master, vtysh_accept, vty, sock, NULL); vector_set_index (Vvty_serv_thread, sock, vty_serv_thread); break; case VTYSH_READ: @@ -1,22 +1,22 @@ /* Virtual terminal [aka TeletYpe] interface routine - Copyright (C) 1997 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1997 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_VTY_H #define _ZEBRA_VTY_H diff --git a/lib/wheel.c b/lib/wheel.c index 9bcb1b874..f273a2926 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include "zebra.h" #include "linklist.h" diff --git a/lib/wheel.h b/lib/wheel.h index 79d21e124..07be79bf2 100644 --- a/lib/wheel.h +++ b/lib/wheel.h @@ -13,10 +13,9 @@ * 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 + * 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 __WHEEL_H__ #define __WHEEL_H__ diff --git a/lib/workqueue.c b/lib/workqueue.c index e997e61b3..f99258839 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -15,10 +15,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/lib/workqueue.h b/lib/workqueue.h index 548f96d8b..45f02afc6 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -15,10 +15,9 @@ * 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. + * 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 _QUAGGA_WORK_QUEUE_H diff --git a/lib/zassert.h b/lib/zassert.h index bf0a851ba..082ad6789 100644 --- a/lib/zassert.h +++ b/lib/zassert.h @@ -13,10 +13,9 @@ * 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. + * 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 _QUAGGA_ASSERT_H diff --git a/lib/zclient.c b/lib/zclient.c index 1d3c93d85..a53e8112c 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -26,6 +25,8 @@ #include "stream.h" #include "buffer.h" #include "network.h" +#include "vrf.h" +#include "vrf_int.h" #include "if.h" #include "log.h" #include "thread.h" @@ -1511,6 +1512,47 @@ zebra_interface_vrf_update_read (struct stream *s, vrf_id_t vrf_id, *new_vrf_id = new_id; return ifp; } + +/* filter unwanted messages until the expected one arrives */ +static int +zclient_read_sync_response (struct zclient *zclient, u_int16_t expected_cmd) +{ + struct stream *s; + u_int16_t size; + u_char marker; + u_char version; + vrf_id_t vrf_id; + u_int16_t cmd; + fd_set readfds; + int ret; + + ret = 0; + cmd = expected_cmd + 1; + while (ret == 0 && cmd != expected_cmd) + { + s = zclient->ibuf; + stream_reset (s); + + /* wait until response arrives */ + FD_ZERO (&readfds); + FD_SET (zclient->sock, &readfds); + select (zclient->sock+1, &readfds, NULL, NULL, NULL); + if (!FD_ISSET(zclient->sock, &readfds)) + continue; + /* read response */ + ret = zclient_read_header (s, zclient->sock, &size, &marker, &version, + &vrf_id, &cmd); + if (zclient_debug) + zlog_debug ("%s: Response (%d bytes) received", __func__, size); + } + if (ret != 0) + { + zlog_err ("%s: Invalid Sync Message Reply", __func__); + return -1; + } + + return 0; +} /** * Connect to label manager in a syncronous way * @@ -1526,11 +1568,6 @@ lm_label_manager_connect (struct zclient *zclient) int ret; struct stream *s; u_char result; - u_int16_t size; - u_char marker; - u_char version; - vrf_id_t vrf_id; - u_int16_t cmd; if (zclient_debug) zlog_debug ("Connecting to Label Manager"); @@ -1570,20 +1607,15 @@ lm_label_manager_connect (struct zclient *zclient) zlog_debug ("%s: Label manager connect request (%d bytes) sent", __func__, ret); /* read response */ - s = zclient->ibuf; - stream_reset (s); + if (zclient_read_sync_response (zclient, ZEBRA_LABEL_MANAGER_CONNECT) != 0) + return -1; - ret = zclient_read_header (s, zclient->sock, &size, &marker, &version, - &vrf_id, &cmd); - if (ret != 0 || cmd != ZEBRA_LABEL_MANAGER_CONNECT) { - zlog_err ("%s: Invalid Label Manager Connect Message Reply Header", __func__); - return -1; - } /* result */ + s = zclient->ibuf; result = stream_getc(s); if (zclient_debug) - zlog_debug ("%s: Label Manager connect response (%d bytes) received, result %u", - __func__, size, result); + zlog_debug ("%s: Label Manager connect response received, result %u", + __func__, result); return (int)result; } @@ -1607,11 +1639,6 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size, { int ret; struct stream *s; - u_int16_t size; - u_char marker; - u_char version; - vrf_id_t vrf_id; - u_int16_t cmd; u_char response_keep; if (zclient_debug) @@ -1650,18 +1677,10 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size, zlog_debug ("%s: Label chunk request (%d bytes) sent", __func__, ret); /* read response */ - s = zclient->ibuf; - stream_reset (s); - - ret = zclient_read_header (s, zclient->sock, &size, &marker, &version, - &vrf_id, &cmd); - if (ret != 0 || cmd != ZEBRA_GET_LABEL_CHUNK) { - zlog_err ("%s: Invalid Get Label Chunk Message Reply Header", __func__); - return -1; - } - if (zclient_debug) - zlog_debug ("%s: Label chunk response (%d bytes) received", __func__, size); + if (zclient_read_sync_response (zclient, ZEBRA_GET_LABEL_CHUNK) != 0) + return -1; + s = zclient->ibuf; /* keep */ response_keep = stream_getc(s); /* start and end labels */ @@ -1669,18 +1688,20 @@ lm_get_label_chunk (struct zclient *zclient, u_char keep, uint32_t chunk_size, *end = stream_getl(s); /* not owning this response */ - if (keep != response_keep) { - zlog_err ("%s: Invalid Label chunk: %u - %u, keeps mismatch %u != %u", - __func__, *start, *end, keep, response_keep); - } + if (keep != response_keep) + { + zlog_err ("%s: Invalid Label chunk: %u - %u, keeps mismatch %u != %u", + __func__, *start, *end, keep, response_keep); + } /* sanity */ if (*start > *end || *start < MPLS_MIN_UNRESERVED_LABEL - || *end > MPLS_MAX_UNRESERVED_LABEL) { - zlog_err ("%s: Invalid Label chunk: %u - %u", __func__, - *start, *end); - return -1; - } + || *end > MPLS_MAX_UNRESERVED_LABEL) + { + zlog_err ("%s: Invalid Label chunk: %u - %u", __func__, + *start, *end); + return -1; + } if (zclient_debug) zlog_debug ("Label Chunk assign: %u - %u (%u) ", diff --git a/lib/zclient.h b/lib/zclient.h index a54bf420d..847ac3b67 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -7,16 +7,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * + * 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 _ZEBRA_ZCLIENT_H diff --git a/lib/zebra.h b/lib/zebra.h index cd72dc67f..0a61c433d 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -1,22 +1,22 @@ /* Zebra common header. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 _ZEBRA_H #define _ZEBRA_H @@ -404,8 +404,8 @@ extern const char *zserv_command_string (unsigned int command); typedef enum { AFI_IP = 1, AFI_IP6 = 2, - AFI_L2VPN = 4, - AFI_MAX = 5 + AFI_L2VPN = 3, + AFI_MAX = 4 } afi_t; /* Subsequent Address Family Identifier. */ diff --git a/nhrpd/linux.c b/nhrpd/linux.c index 1e9c69eb8..75a16eab3 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -138,16 +138,16 @@ static int linux_icmp_redirect_off(const char *iface) int os_configure_dmvpn(unsigned int ifindex, const char *ifname, int af) { - int ret = -1; + int ret = 0; switch (af) { case AF_INET: - ret = linux_icmp_redirect_off("all"); + ret |= linux_icmp_redirect_off("all"); ret |= linux_icmp_redirect_off(ifname); - ret |= netlink_configure_arp(ifindex, AF_INET); - ret |= linux_configure_arp(ifname, 1); break; } + ret |= linux_configure_arp(ifname, 1); + ret |= netlink_configure_arp(ifindex, af); return ret; } diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index da86c585a..8a3f820f7 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -215,9 +215,12 @@ void evmgr_init(void) void evmgr_set_socket(const char *socket) { - if (nhrp_event_socket_path) + if (nhrp_event_socket_path) { free((char *) nhrp_event_socket_path); - nhrp_event_socket_path = strdup(socket); + nhrp_event_socket_path = NULL; + } + if (socket) + nhrp_event_socket_path = strdup(socket); evmgr_connection_error(&evmgr_connection); } diff --git a/nhrpd/nhrp_main.c b/nhrpd/nhrp_main.c index a44ce35bb..7c5d80336 100644 --- a/nhrpd/nhrp_main.c +++ b/nhrpd/nhrp_main.c @@ -129,7 +129,7 @@ int main(int argc, char **argv) /* Library inits. */ master = frr_init(); nhrp_interface_init(); - vrf_init(); + vrf_init(NULL, NULL, NULL, NULL); resolver_init(); /* Run with elevated capabilities, as for all netlink activity diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index b926a8d7b..76c591fd7 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -189,7 +189,7 @@ static int nhrp_reg_send_req(struct thread *t) hdr->flags |= htons(NHRP_FLAG_REGISTRATION_NAT); ext = nhrp_ext_push(zb, hdr, NHRP_EXTENSION_NAT_ADDRESS); cie = nhrp_cie_push(zb, NHRP_CODE_SUCCESS, &nifp->nbma, &if_ad->addr); - cie->prefix_length = 8 * sockunion_get_addrlen(&nifp->nbma); + cie->prefix_length = 8 * sockunion_get_addrlen(&if_ad->addr); nhrp_ext_complete(zb, ext); nhrp_packet_complete(zb, hdr); diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 5f1e43a60..d9e8627a1 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -386,11 +386,12 @@ static void nhrp_handle_registration_request(struct nhrp_packet_parser *p) struct nhrp_extension_header *ext; struct nhrp_cache *c; union sockunion cie_nbma, cie_proto, *proto_addr, *nbma_addr, *nbma_natoa; - int holdtime, natted = 0; + int holdtime, prefix_len, hostprefix_len, natted = 0; size_t paylen; void *pay; debugf(NHRP_DEBUG_COMMON, "Parsing and replying to Registration Req"); + hostprefix_len = 8 * sockunion_get_addrlen(&p->if_ad->addr); if (!sockunion_same(&p->src_nbma, &p->peer->vc->remote.nbma)) natted = 1; @@ -412,13 +413,17 @@ static void nhrp_handle_registration_request(struct nhrp_packet_parser *p) zbuf_init(&payload, pay, paylen, paylen); while ((cie = nhrp_cie_pull(&payload, hdr, &cie_nbma, &cie_proto)) != NULL) { - if (cie->prefix_length != 0xff && !(p->hdr->flags & htons(NHRP_FLAG_REGISTRATION_UNIQUE))) { + prefix_len = cie->prefix_length; + if (prefix_len == 0 || prefix_len >= hostprefix_len) + prefix_len = hostprefix_len; + + if (prefix_len != hostprefix_len && !(p->hdr->flags & htons(NHRP_FLAG_REGISTRATION_UNIQUE))) { cie->code = NHRP_CODE_BINDING_NON_UNIQUE; continue; } /* We currently support only unique prefix registrations */ - if (cie->prefix_length != 0xff) { + if (prefix_len != hostprefix_len) { cie->code = NHRP_CODE_ADMINISTRATIVELY_PROHIBITED; continue; } diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 69c55e305..7f8cad6e9 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -86,7 +86,6 @@ void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp) void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix *p, struct interface *ifp, const union sockunion *nexthop, uint32_t mtu) { - struct in_addr *nexthop_ipv4; int flags = 0; if (zclient->sock < 0) @@ -109,6 +108,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix SET_FLAG(flags, ZEBRA_FLAG_INTERNAL); if (p->family == AF_INET) { + struct in_addr *nexthop_ipv4; struct zapi_ipv4 api; memset(&api, 0, sizeof(api)); @@ -118,7 +118,6 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); if (nexthop) { - SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); nexthop_ipv4 = (struct in_addr *) sockunion_get_addr(nexthop); api.nexthop_num = 1; api.nexthop = &nexthop_ipv4; @@ -147,6 +146,45 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix zapi_ipv4_route( add ? ZEBRA_IPV4_ROUTE_ADD : ZEBRA_IPV4_ROUTE_DELETE, zclient, (struct prefix_ipv4 *) p, &api); + } else if (p->family == AF_INET6) { + struct in6_addr *nexthop_ipv6; + struct zapi_ipv6 api; + + memset(&api, 0, sizeof(api)); + api.flags = flags; + api.type = ZEBRA_ROUTE_NHRP; + api.safi = SAFI_UNICAST; + + SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); + if (nexthop) { + nexthop_ipv6 = (struct in6_addr *) sockunion_get_addr(nexthop); + api.nexthop_num = 1; + api.nexthop = &nexthop_ipv6; + } + if (ifp) { + SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX); + api.ifindex_num = 1; + api.ifindex = &ifp->ifindex; + } + if (mtu) { + SET_FLAG(api.message, ZAPI_MESSAGE_MTU); + api.mtu = mtu; + } + + if (unlikely(debug_flags & NHRP_DEBUG_ROUTE)) { + char buf[2][INET6_ADDRSTRLEN]; + zlog_debug("Zebra send: IPv6 route %s %s/%d nexthop %s metric %u" + " count %d dev %s", + add ? "add" : "del", + inet_ntop(AF_INET6, &p->u.prefix6, buf[0], sizeof(buf[0])), + p->prefixlen, + nexthop ? inet_ntop(AF_INET6, api.nexthop[0], buf[1], sizeof(buf[1])) : "<onlink>", + api.metric, api.nexthop_num, ifp->name); + } + + zapi_ipv6_route( + add ? ZEBRA_IPV6_ROUTE_ADD : ZEBRA_IPV6_ROUTE_DELETE, + zclient, (struct prefix_ipv6 *) p, NULL, &api); } } diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index 4a6cbce31..4faa9d786 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -228,7 +228,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid, void *ar prefix.prefixlen = cie->prefix_length; /* Sanity check prefix length */ - if (prefix.prefixlen >= 8*prefix_blen(&prefix)) { + if (prefix.prefixlen >= 8*prefix_blen(&prefix) || prefix.prefixlen == 0) { prefix.prefixlen = 8*prefix_blen(&prefix); } else if (nhrp_route_address(NULL, &pp->dst_proto, &route_prefix, NULL) == NHRP_ROUTE_NBMA_NEXTHOP) { if (prefix.prefixlen < route_prefix.prefixlen) diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index 9b8463fb5..f62be7404 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -11,6 +11,7 @@ #include "command.h" #include "zclient.h" #include "stream.h" +#include "filter.h" #include "nhrpd.h" #include "netlink.h" @@ -206,7 +207,7 @@ DEFUN(nhrp_event_socket, nhrp_event_socket_cmd, NHRP_STR "Event Manager commands\n" "Event Manager unix socket path\n" - "Unix path for the socket") + "Unix path for the socket\n") { evmgr_set_socket(argv[3]->arg); return CMD_SUCCESS; @@ -218,7 +219,7 @@ DEFUN(no_nhrp_event_socket, no_nhrp_event_socket_cmd, NHRP_STR "Event Manager commands\n" "Event Manager unix socket path\n" - "Unix path for the socket") + "Unix path for the socket\n") { evmgr_set_socket(NULL); return CMD_SUCCESS; @@ -937,6 +938,9 @@ void nhrp_config_init(void) install_node(&zebra_node, nhrp_config_write); install_default(ZEBRA_NODE); + /* access-list commands */ + access_list_init (); + /* global commands */ install_element(VIEW_NODE, &show_debugging_nhrp_cmd); install_element(VIEW_NODE, &show_ip_nhrp_cmd); diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 2e31535d2..7ef7fdd94 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index 5bc2469e1..55d657cfc 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_ABR_H diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 198526a0e..e652a71bb 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -205,15 +204,31 @@ ospf6_area_no_summary_unset (struct ospf6 *ospf6, struct ospf6_area *area) } } -/* Make new area structure */ +/** + * Make new area structure. + * + * @param area_id - ospf6 area ID + * @param o - ospf6 instance + * @param df - display format for area ID + */ struct ospf6_area * -ospf6_area_create (u_int32_t area_id, struct ospf6 *o) +ospf6_area_create (u_int32_t area_id, struct ospf6 *o, int df) { struct ospf6_area *oa; oa = XCALLOC (MTYPE_OSPF6_AREA, sizeof (struct ospf6_area)); - inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name)); + switch (df) + { + case OSPF6_AREA_FMT_DECIMAL: + snprintf (oa->name, sizeof (oa->name), "%u", ntohl (area_id)); + break; + default: + case OSPF6_AREA_FMT_DOTTEDQUAD: + inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name)); + break; + } + oa->area_id = area_id; oa->if_list = list_new (); @@ -312,16 +327,6 @@ ospf6_area_lookup (u_int32_t area_id, struct ospf6 *ospf6) return (struct ospf6_area *) NULL; } -static struct ospf6_area * -ospf6_area_get (u_int32_t area_id, struct ospf6 *o) -{ - struct ospf6_area *oa; - oa = ospf6_area_lookup (area_id, o); - if (oa == NULL) - oa = ospf6_area_create (area_id, o); - return oa; -} - void ospf6_area_enable (struct ospf6_area *oa) { @@ -406,31 +411,20 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa) } -#define OSPF6_CMD_AREA_LOOKUP(str, oa) \ +#define OSPF6_CMD_AREA_GET(str, oa) \ { \ - u_int32_t area_id = 0; \ - if (inet_pton (AF_INET, str, &area_id) != 1) \ + char *ep; \ + u_int32_t area_id = htonl (strtoul (str, &ep, 10)); \ + if (*ep && inet_pton (AF_INET, str, &area_id) != 1) \ { \ vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ return CMD_SUCCESS; \ } \ + int format = !*ep ? OSPF6_AREA_FMT_DECIMAL : \ + OSPF6_AREA_FMT_DOTTEDQUAD; \ oa = ospf6_area_lookup (area_id, ospf6); \ if (oa == NULL) \ - { \ - vty_out (vty, "No such Area: %s%s", str, VNL); \ - return CMD_SUCCESS; \ - } \ -} - -#define OSPF6_CMD_AREA_GET(str, oa) \ -{ \ - u_int32_t area_id = 0; \ - if (inet_pton (AF_INET, str, &area_id) != 1) \ - { \ - vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \ - return CMD_SUCCESS; \ - } \ - oa = ospf6_area_get (area_id, ospf6); \ + oa = ospf6_area_create (area_id, ospf6, format); \ } DEFUN (area_range, @@ -523,6 +517,7 @@ DEFUN (no_area_range, "Advertised metric for this range\n") { int idx_ipv4 = 2; + int idx_ipv6 = 4; int ret; struct ospf6_area *oa; struct prefix prefix; @@ -530,17 +525,17 @@ DEFUN (no_area_range, OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa); - ret = str2prefix (argv[idx_ipv4]->arg, &prefix); + ret = str2prefix (argv[idx_ipv6]->arg, &prefix); if (ret != 1 || prefix.family != AF_INET6) { - vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv4]->arg, VNL); + vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv6]->arg, VNL); return CMD_SUCCESS; } range = ospf6_route_lookup (&prefix, oa->range_table); if (range == NULL) { - vty_out (vty, "Range %s does not exists.%s", argv[idx_ipv4]->arg, VNL); + vty_out (vty, "Range %s does not exists.%s", argv[idx_ipv6]->arg, VNL); return CMD_SUCCESS; } @@ -562,9 +557,6 @@ DEFUN (no_area_range, return CMD_SUCCESS; } - - - void ospf6_area_config_write (struct vty *vty) { diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index 3b752d948..86c68af17 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF_AREA_H @@ -32,6 +31,8 @@ struct ospf6_area /* Area-ID */ u_int32_t area_id; +#define OSPF6_AREA_FMT_DOTTEDQUAD 1 +#define OSPF6_AREA_FMT_DECIMAL 2 /* Area-ID string */ char name[16]; @@ -116,7 +117,7 @@ struct ospf6_area /* prototypes */ extern int ospf6_area_cmp (void *va, void *vb); -extern struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *); +extern struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *, int); extern void ospf6_area_delete (struct ospf6_area *); extern struct ospf6_area *ospf6_area_lookup (u_int32_t, struct ospf6 *); diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index da90e2f96..302d8c986 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_asbr.h b/ospf6d/ospf6_asbr.h index da6bbdd9c..aaa3c72a4 100644 --- a/ospf6d/ospf6_asbr.h +++ b/ospf6d/ospf6_asbr.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_ASBR_H diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 3bc55441c..7d9abe233 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_bfd.h b/ospf6d/ospf6_bfd.h index 9c3b57aa2..913f7dcf4 100644 --- a/ospf6d/ospf6_bfd.h +++ b/ospf6d/ospf6_bfd.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 OSPF6_BFD_H diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index eb51e353c..8a8dcfcd2 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_flood.h b/ospf6d/ospf6_flood.h index ba7fd25f9..72482cadf 100644 --- a/ospf6d/ospf6_flood.h +++ b/ospf6d/ospf6_flood.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_FLOOD_H diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 758688c60..111ca3f3d 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index 846cde419..0408fc69d 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_INTERFACE_H diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 646196385..5d415a68c 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -1455,13 +1454,14 @@ ospf6_intra_route_calculation (struct ospf6_area *oa) { if (hook_add) (*hook_add) (route); + route->flag = 0; } else { /* Redo the summaries as things might have changed */ ospf6_abr_originate_summary (route); + route->flag = 0; } - route->flag = 0; } if (IS_OSPF6_DEBUG_EXAMIN (INTRA_PREFIX)) diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index 9975bbd62..114784835 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_INTRA_H diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 38229541a..acc8fe380 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -77,8 +76,7 @@ struct ospf6_lsa_handler unknown_handler = "Unknown", "Unk", ospf6_unknown_lsa_show, - NULL, - OSPF6_LSA_DEBUG, + NULL }; void @@ -918,7 +916,6 @@ DEFUN (no_debug_ospf6_lsa_type, return CMD_SUCCESS; } - void install_element_ospf6_debug_lsa (void) { diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index a95891ac5..36cf55986 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_LSA_H diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 1d4b557cd..cb522226a 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h index b21d9ee28..866868080 100644 --- a/ospf6d/ospf6_lsdb.h +++ b/ospf6d/ospf6_lsdb.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_LSDB_H diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 54ae4645a..f69c1e1bc 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -222,7 +221,7 @@ main (int argc, char *argv[], char *envp[]) /* thread master */ master = frr_init (); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); access_list_init (); prefix_list_init (); diff --git a/ospf6d/ospf6_memory.c b/ospf6d/ospf6_memory.c index 7f2fbbf0b..35d03f7e4 100644 --- a/ospf6d/ospf6_memory.c +++ b/ospf6d/ospf6_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/ospf6d/ospf6_memory.h b/ospf6d/ospf6_memory.h index 3ff5de4c3..324065c3a 100644 --- a/ospf6d/ospf6_memory.h +++ b/ospf6d/ospf6_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_OSPF6_MEMORY_H diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 6746b8104..87c905af3 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index 4a9e0c7a6..b0107dfff 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_MESSAGE_H diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 09d3a523a..c58922b0e 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index c275ff830..3ff341933 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_NEIGHBOR_H diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 0217d6603..9e7dd06bd 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index 4fa283951..690901ca0 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_NETWORK_H diff --git a/ospf6d/ospf6_proto.c b/ospf6d/ospf6_proto.c index d011601f0..1538c891c 100644 --- a/ospf6d/ospf6_proto.c +++ b/ospf6d/ospf6_proto.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_proto.h b/ospf6d/ospf6_proto.h index af60eb922..e4f29aa3e 100644 --- a/ospf6d/ospf6_proto.h +++ b/ospf6d/ospf6_proto.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_PROTO_H diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index b8e5ca619..117f7af6e 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index 8b973d28f..7cf69a26e 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_ROUTE_H diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 96f1e3dd2..b30d3efb0 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 6a10ba7ad..e7cfd3fc9 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ /* Shortest Path First calculation for OSPFv3 */ diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index 7bf525d6f..87a86c0ac 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_SPF_H diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 85f7e0ce3..dfda06678 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -604,7 +603,7 @@ DEFUN (ospf6_interface_area, /* find/create ospf6 area */ oa = ospf6_area_lookup (area_id, o); if (oa == NULL) - oa = ospf6_area_create (area_id, o); + oa = ospf6_area_create (area_id, o, OSPF6_AREA_FMT_DOTTEDQUAD); /* attach interface to area */ listnode_add (oa->if_list, oi); /* sort ?? */ diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 42a4d1248..5e101520d 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_TOP_H diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index d0c9e4f04..305870a64 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -305,13 +304,12 @@ ospf6_zebra_read_ipv6 (int command, struct zclient *zclient, return 0; } - - - DEFUN (show_zebra, - show_zebra_cmd, - "show zebra", + show_ospf6_zebra_cmd, + "show ipv6 ospf6 zebra", SHOW_STR + IPV6_STR + OSPF6_STR "Zebra information\n") { int i; @@ -837,7 +835,7 @@ ospf6_zebra_init (struct thread_master *master) install_node (&zebra_node, config_write_ospf6_zebra); /* Install command element for zebra node. */ - install_element (VIEW_NODE, &show_zebra_cmd); + install_element (VIEW_NODE, &show_ospf6_zebra_cmd); install_default (ZEBRA_NODE); install_element (ZEBRA_NODE, &redistribute_ospf6_cmd); install_element (ZEBRA_NODE, &no_redistribute_ospf6_cmd); diff --git a/ospf6d/ospf6_zebra.h b/ospf6d/ospf6_zebra.h index 83032b64b..f7f808c86 100644 --- a/ospf6d/ospf6_zebra.h +++ b/ospf6d/ospf6_zebra.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6_ZEBRA_H diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 793397570..1ccf7ce7a 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h index f0bc02274..6595e7045 100644 --- a/ospf6d/ospf6d.h +++ b/ospf6d/ospf6d.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 OSPF6D_H diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c index c545d537f..0ebae087e 100644 --- a/ospfclient/ospf_apiclient.c +++ b/ospfclient/ospf_apiclient.c @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002, 2003 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfclient/ospf_apiclient.h b/ospfclient/ospf_apiclient.h index 5a1de3b13..5882ac349 100644 --- a/ospfclient/ospf_apiclient.h +++ b/ospfclient/ospf_apiclient.h @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002, 2003 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _OSPF_APICLIENT_H diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index 1c2ec7d1c..195fd5b5a 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -10,10 +10,9 @@ * 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. + * 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 */ /* diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index ee90ceccf..06038fed7 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -8,16 +8,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * + * 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 */ @@ -197,9 +196,8 @@ ospf_area_range_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); if (area == NULL) return 0; @@ -233,9 +231,8 @@ ospf_area_range_cost_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); if (area == NULL) return 0; @@ -282,9 +279,8 @@ ospf_area_range_substitute_set (struct ospf *ospf, struct in_addr area_id, { struct ospf_area *area; struct ospf_area_range *range; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); range = ospf_area_range_lookup (area, p); if (range != NULL) diff --git a/ospfd/ospf_abr.h b/ospfd/ospf_abr.h index 2a728936d..71eb71bdc 100644 --- a/ospfd/ospf_abr.h +++ b/ospfd/ospf_abr.h @@ -3,21 +3,20 @@ * Copyright (C) 1999 Alex Zinin * * This file is part of GNU Zebra. - * + * * GNU Zebra 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ABR_H diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c index 9f90f671c..69d61b12e 100644 --- a/ospfd/ospf_api.c +++ b/ospfd/ospf_api.c @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_api.h b/ospfd/ospf_api.h index eb5ad0aae..ee18c8934 100644 --- a/ospfd/ospf_api.h +++ b/ospfd/ospf_api.h @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 633b22346..8e619f74c 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -2455,7 +2454,7 @@ ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr) { struct msg *msg; struct in_addr ifaddr = { .s_addr = 0L }; - struct in_addr nbraddr; + struct in_addr nbraddr = { .s_addr = 0L }; assert (nbr); diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h index b60f56b4f..2fd8e7a37 100644 --- a/ospfd/ospf_apiserver.h +++ b/ospfd/ospf_apiserver.h @@ -3,7 +3,7 @@ * Copyright (C) 2001, 2002 Ralph Keller * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _OSPF_APISERVER_H diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 284c56468..2ba3b5533 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h index e2fa36745..2fd570d1b 100644 --- a/ospfd/ospf_asbr.h +++ b/ospfd/ospf_asbr.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ASBR_H diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index a30df1993..b7cba7fd7 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_ase.h b/ospfd/ospf_ase.h index e6a1b2fb7..d73322fca 100644 --- a/ospfd/ospf_ase.h +++ b/ospfd/ospf_ase.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ASE_H diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index 74bc38220..05265171a 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_bfd.h b/ospfd/ospf_bfd.h index 793962dae..75b8e11f4 100644 --- a/ospfd/ospf_bfd.h +++ b/ospfd/ospf_bfd.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_BFD_H diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 21b285549..469b66105 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_dump.h b/ospfd/ospf_dump.h index 9bed853ee..94918c265 100644 --- a/ospfd/ospf_dump.h +++ b/ospfd/ospf_dump.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_DUMP_H diff --git a/ospfd/ospf_dump_api.c b/ospfd/ospf_dump_api.c index 5ef262ce5..54cc7fb66 100644 --- a/ospfd/ospf_dump_api.c +++ b/ospfd/ospf_dump_api.c @@ -14,8 +14,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_dump_api.h b/ospfd/ospf_dump_api.h index 1cd8257f0..836d23455 100644 --- a/ospfd/ospf_dump_api.h +++ b/ospfd/ospf_dump_api.h @@ -14,8 +14,8 @@ * details. * * You should have received a copy of the GNU General Public License along - * with FRR; see the file COPYING. If not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_DUMP_API_H diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 4cc28f748..00004a1ef 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -3,7 +3,7 @@ * Copyright (C) 1999, 2000 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_flood.h b/ospfd/ospf_flood.h index 1ab11b88b..b08385754 100644 --- a/ospfd/ospf_flood.h +++ b/ospfd/ospf_flood.h @@ -3,7 +3,7 @@ * Copyright (C) 1999, 2000 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_FLOOD_H diff --git a/ospfd/ospf_ia.c b/ospfd/ospf_ia.c index b2d0faeb7..ebd267ded 100644 --- a/ospfd/ospf_ia.c +++ b/ospfd/ospf_ia.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ diff --git a/ospfd/ospf_ia.h b/ospfd/ospf_ia.h index b65b93864..f102545f8 100644 --- a/ospfd/ospf_ia.h +++ b/ospfd/ospf_ia.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_IA_H diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index aeb12a59f..1f3cc1013 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -3,7 +3,7 @@ * Copyright (C) 1999, 2000 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -795,7 +794,7 @@ ospf_vl_data_new (struct ospf_area *area, struct in_addr vl_peer) vl_data->vl_peer.s_addr = vl_peer.s_addr; vl_data->vl_area_id = area->area_id; - vl_data->format = area->format; + vl_data->vl_area_id_fmt = area->area_id_fmt; return vl_data; } @@ -869,7 +868,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data) zlog_debug ("ospf_vl_new(): set if->name to %s", vi->name); area_id.s_addr = 0; - area = ospf_area_get (ospf, area_id, OSPF_AREA_ID_FORMAT_ADDRESS); + area = ospf_area_get (ospf, area_id); voi->area = area; if (IS_DEBUG_OSPF_EVENT) diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h index 39202f777..8455d217e 100644 --- a/ospfd/ospf_interface.h +++ b/ospfd/ospf_interface.h @@ -3,7 +3,7 @@ * Copyright (C) 1999 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_INTERFACE_H @@ -104,12 +103,12 @@ struct ospf_interface; struct ospf_vl_data { - struct in_addr vl_peer; /* Router-ID of the peer for VLs. */ - struct in_addr vl_area_id; /* Transit area for this VL. */ - int format; /* area ID format */ - struct ospf_interface *vl_oi; /* Interface data structure for the VL. */ - struct vertex_nexthop nexthop; /* Nexthop router and oi to use */ - struct in_addr peer_addr; /* Address used to reach the peer. */ + struct in_addr vl_peer; /* Router-ID of the peer */ + struct in_addr vl_area_id; /* Transit area */ + int vl_area_id_fmt; /* Area ID format */ + struct ospf_interface *vl_oi; /* Interface data structure */ + struct vertex_nexthop nexthop; /* Nexthop router and oi to use */ + struct in_addr peer_addr; /* Address used to reach the peer */ u_char flags; }; diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c index 717c99c21..2a1f7bb32 100644 --- a/ospfd/ospf_ism.c +++ b/ospfd/ospf_ism.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h index 180000ae9..f099fe875 100644 --- a/ospfd/ospf_ism.h +++ b/ospfd/ospf_ism.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ISM_H diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 9067acb7f..acbb2bb07 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index 8b9a0d4c4..b6f2526c9 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_LSA_H diff --git a/ospfd/ospf_lsdb.c b/ospfd/ospf_lsdb.c index b92e7494a..ac22f5bbe 100644 --- a/ospfd/ospf_lsdb.c +++ b/ospfd/ospf_lsdb.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_lsdb.h b/ospfd/ospf_lsdb.h index 51ae45bf5..ee31cda65 100644 --- a/ospfd/ospf_lsdb.h +++ b/ospfd/ospf_lsdb.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_LSDB_H diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 38718b35d..6cd6d0272 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -207,7 +206,7 @@ main (int argc, char **argv) /* Library inits. */ debug_init (); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); access_list_init (); prefix_list_init (); diff --git a/ospfd/ospf_memory.c b/ospfd/ospf_memory.c index 0181e1e1f..5639c0f60 100644 --- a/ospfd/ospf_memory.c +++ b/ospfd/ospf_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h index b082c9503..5f5960eec 100644 --- a/ospfd/ospf_memory.h +++ b/ospfd/ospf_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_OSPF_MEMORY_H diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c index a573936c1..fc86cd09f 100644 --- a/ospfd/ospf_neighbor.c +++ b/ospfd/ospf_neighbor.c @@ -3,7 +3,7 @@ * Copyright (C) 1999, 2000 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_neighbor.h b/ospfd/ospf_neighbor.h index d62de44b5..70e3832d9 100644 --- a/ospfd/ospf_neighbor.h +++ b/ospfd/ospf_neighbor.h @@ -3,7 +3,7 @@ * Copyright (C) 1999, 2000 Toshiaki Takada * * This file is part of GNU Zebra. - * + * * GNU Zebra 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 @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_NEIGHBOR_H diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d7ec25621..0f5785966 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_network.h b/ospfd/ospf_network.h index bc01a8432..506a41905 100644 --- a/ospfd/ospf_network.h +++ b/ospfd/ospf_network.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_NETWORK_H diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c index 97f3f6a38..b3888dd83 100644 --- a/ospfd/ospf_nsm.c +++ b/ospfd/ospf_nsm.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h index 2bd8f065c..4f363b4e6 100644 --- a/ospfd/ospf_nsm.h +++ b/ospfd/ospf_nsm.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_NSM_H diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index af22d0f29..fa87434a1 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -9,16 +9,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h index 2ac9b41ef..69cbb0766 100644 --- a/ospfd/ospf_opaque.h +++ b/ospfd/ospf_opaque.h @@ -9,16 +9,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_OPAQUE_H diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 8446ebcea..11434071a 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 60761322d..ebc5d892d 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_PACKET_H diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c index 883ea7cad..4723f4a91 100644 --- a/ospfd/ospf_ri.c +++ b/ospfd/ospf_ri.c @@ -19,10 +19,9 @@ * 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 GNU Quagga; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_ri.h b/ospfd/ospf_ri.h index 3f898ac59..c9ed3c56a 100644 --- a/ospfd/ospf_ri.h +++ b/ospfd/ospf_ri.h @@ -19,10 +19,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ROUTER_INFO_H diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 175850c31..fcd5f18a7 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_route.h b/ospfd/ospf_route.h index 6b6d9f1fa..16c6b0000 100644 --- a/ospfd/ospf_route.h +++ b/ospfd/ospf_route.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPF_ROUTE_H diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index db51abca2..e2656e516 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 32449d559..e952df4eb 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 3d8d7f8e0..e0fa23f35 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1,22 +1,22 @@ /* OSPF SPF calculation. - Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> diff --git a/ospfd/ospf_spf.h b/ospfd/ospf_spf.h index e33b3e5f5..349f461c9 100644 --- a/ospfd/ospf_spf.h +++ b/ospfd/ospf_spf.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_OSPF_SPF_H diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index a89d67c6b..804b1fb65 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -12,16 +12,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* Add support of RFC7471 */ diff --git a/ospfd/ospf_te.h b/ospfd/ospf_te.h index 36f2d8241..885180bc1 100644 --- a/ospfd/ospf_te.h +++ b/ospfd/ospf_te.h @@ -12,16 +12,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* Add support of RFC7471 */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 4a7dbb954..bb908ead2 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -67,36 +66,29 @@ static const char *ospf_network_type_str[] = /* Utility functions. */ int -ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) +str2area_id (const char *str, struct in_addr *area_id, int *area_id_fmt) { - char *endptr = NULL; - unsigned long ret; + char *ep; - /* match "A.B.C.D". */ - if (strchr (str, '.') != NULL) - { - ret = inet_aton (str, area_id); - if (!ret) - return -1; - *format = OSPF_AREA_ID_FORMAT_ADDRESS; - } - /* match "<0-4294967295>". */ - else - { - if (*str == '-') - return -1; - errno = 0; - ret = strtoul (str, &endptr, 10); - if (*endptr != '\0' || errno || ret > UINT32_MAX) - return -1; + area_id->s_addr = htonl (strtoul (str, &ep, 10)); + if (*ep && !inet_aton (str, area_id)) + return -1; - area_id->s_addr = htonl (ret); - *format = OSPF_AREA_ID_FORMAT_DECIMAL; - } + *area_id_fmt = *ep ? OSPF_AREA_ID_FMT_DOTTEDQUAD : OSPF_AREA_ID_FMT_DECIMAL; return 0; } +void +area_id2str (char *buf, int length, struct in_addr *area_id, int area_id_fmt) +{ + memset (buf, 0, length); + + if (area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) + strncpy (buf, inet_ntoa (*area_id), length); + else + sprintf (buf, "%lu", (unsigned long) ntohl (area_id->s_addr)); +} static int str2metric (const char *str, int *metric) @@ -534,7 +526,7 @@ DEFUN (ospf_network_area, VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg); VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - ret = ospf_network_set (ospf, &p, area_id); + ret = ospf_network_set (ospf, &p, area_id, format); if (ret == 0) { vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); @@ -641,6 +633,7 @@ DEFUN (ospf_area_range_cost, VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg); ospf_area_range_cost_set (ospf, area_id, &p, cost); @@ -669,6 +662,7 @@ DEFUN (ospf_area_range_not_advertise, VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg); ospf_area_range_set (ospf, area_id, &p, 0); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); return CMD_SUCCESS; } @@ -728,6 +722,7 @@ DEFUN (ospf_area_range_substitute, VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg); ospf_area_range_substitute_set (ospf, area_id, &p, &s); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); return CMD_SUCCESS; } @@ -782,7 +777,7 @@ DEFUN (no_ospf_area_range_substitute, struct ospf_vl_config_data { struct vty *vty; /* vty stuff */ struct in_addr area_id; /* area ID from command line */ - int format; /* command line area ID format */ + int area_id_fmt; /* command line area ID format */ struct in_addr vl_peer; /* command line vl_peer */ int auth_type; /* Authehntication type, if given */ char *auth_key; /* simple password if present */ @@ -821,11 +816,12 @@ ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) VTY_NEWLINE); return NULL; } - area = ospf_area_get (ospf, area_id, vl_config->format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, vl_config->area_id_fmt); if (area->external_routing != OSPF_AREA_DEFAULT) { - if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) + if (vl_config->area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) vty_out (vty, "Area %s is %s%s", inet_ntoa (area_id), area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", @@ -1037,7 +1033,8 @@ DEFUN (ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); /* Read off first 2 parameters and check them */ - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format); + ret = str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, + &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1155,7 +1152,7 @@ DEFUN (ospf_area_vlink_intervals, char *area_id = argv[1]->arg; char *router_id = argv[3]->arg; - ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); + ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1210,7 +1207,7 @@ DEFUN (no_ospf_area_vlink, ospf_vl_config_data_init(&vl_config, vty); - ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); + ret = str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1319,7 +1316,7 @@ DEFUN (no_ospf_area_vlink_intervals, char *area_id = argv[2]->arg; char *router_id = argv[4]->arg; - ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format); + ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); if (ret < 0) { vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); @@ -1371,7 +1368,8 @@ DEFUN (ospf_area_shortcut, VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); if (strncmp (argv[idx_enable_disable]->arg, "de", 2) == 0) mode = OSPF_SHORTCUT_DEFAULT; @@ -1437,6 +1435,7 @@ DEFUN (ospf_area_stub, VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "First deconfigure all virtual link through this area%s", @@ -1466,6 +1465,7 @@ DEFUN (ospf_area_stub_no_summary, VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg); ret = ospf_area_stub_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s", @@ -1532,6 +1532,7 @@ ospf_area_nssa_cmd_handler (struct vty *vty, int argc, struct cmd_token **argv, VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[1]->arg); ret = ospf_area_nssa_set (ospf, area_id); + ospf_area_display_format_set (ospf, ospf_area_get (ospf, area_id), format); if (ret == 0) { vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", @@ -1669,7 +1670,8 @@ DEFUN (ospf_area_default_cost, VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg); VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); if (area->external_routing == OSPF_AREA_DEFAULT) { @@ -1756,7 +1758,8 @@ DEFUN (ospf_area_export_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); ospf_area_export_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; @@ -1807,7 +1810,8 @@ DEFUN (ospf_area_import_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); ospf_area_import_list_set (ospf, area, argv[3]->arg); return CMD_SUCCESS; @@ -1863,7 +1867,8 @@ DEFUN (ospf_area_filter_list, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); plist = prefix_list_lookup (AFI_IP, argv[idx_word]->arg); if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0) { @@ -1963,7 +1968,8 @@ DEFUN (ospf_area_authentication_message_digest, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; return CMD_SUCCESS; @@ -1985,7 +1991,8 @@ DEFUN (ospf_area_authentication, VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg); - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, format); area->auth_type = OSPF_AUTH_SIMPLE; return CMD_SUCCESS; @@ -7004,7 +7011,7 @@ DEFUN (ip_ospf_area, return CMD_SUCCESS; } - ret = ospf_str2area_id (areaid, &area_id, &format); + ret = str2area_id (areaid, &area_id, &format); if (ret < 0) { vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s", @@ -7161,7 +7168,7 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute <ospf|table> (1-65535) {metric (0-16777214)|metric-type (1-2)|route-map WORD}", + "redistribute <ospf|table> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map WORD}]", REDIST_STR "Open Shortest Path First\n" "Non-main Kernel Routing Table\n" @@ -7232,7 +7239,7 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute <ospf|table> (1-65535) {metric (0-16777214)|metric-type (1-2)|route-map WORD}", + "no redistribute <ospf|table> (1-65535) [{metric (0-16777214)|metric-type (1-2)|route-map WORD}]", NO_STR REDIST_STR "Open Shortest Path First\n" @@ -8166,19 +8173,6 @@ const char *ospf_shortcut_mode_str[] = "disable" }; - -static void -area_id2str (char *buf, int length, struct ospf_area *area) -{ - memset (buf, 0, length); - - if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy (buf, inet_ntoa (area->area_id), length); - else - sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); -} - - const char *ospf_int_type_str[] = { "unknown", /* should never be used. */ @@ -8425,7 +8419,7 @@ config_write_network_area (struct vty *vty, struct ospf *ospf) memset (buf, 0, INET_ADDRSTRLEN); /* Create Area ID string by specified Area ID format. */ - if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) + if (n->area_id_fmt == OSPF_AREA_ID_FMT_DOTTEDQUAD) strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); else sprintf ((char *) buf, "%lu", @@ -8452,7 +8446,8 @@ config_write_ospf_area (struct vty *vty, struct ospf *ospf) { struct route_node *rn1; - area_id2str ((char *) buf, INET_ADDRSTRLEN, area); + area_id2str ((char *) buf, INET_ADDRSTRLEN, &area->area_id, + area->area_id_fmt); if (area->auth_type != OSPF_AUTH_NULL) { @@ -8571,7 +8566,7 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) { struct listnode *node; struct ospf_vl_data *vl_data; - u_char buf[INET_ADDRSTRLEN]; + char buf[INET_ADDRSTRLEN]; /* Virtual-Link print */ for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) @@ -8583,12 +8578,8 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) if (vl_data != NULL) { memset (buf, 0, INET_ADDRSTRLEN); - - if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); - else - sprintf ((char *) buf, "%lu", - (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); + + area_id2str (buf, sizeof(buf), &vl_data->vl_area_id, vl_data->vl_area_id_fmt); oi = vl_data->vl_oi; /* timers */ diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h index 429ac318f..6a34e99de 100644 --- a/ospfd/ospf_vty.h +++ b/ospfd/ospf_vty.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _QUAGGA_OSPF_VTY_H @@ -26,7 +25,7 @@ #define VTY_GET_OSPF_AREA_ID(V,F,STR) \ { \ int retv; \ - retv = ospf_str2area_id ((STR), &(V), &(F)); \ + retv = str2area_id ((STR), &(V), &(F)); \ if (retv < 0) \ { \ vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \ @@ -37,7 +36,7 @@ #define VTY_GET_OSPF_AREA_ID_NO_BB(NAME,V,F,STR) \ { \ int retv; \ - retv = ospf_str2area_id ((STR), &(V), &(F)); \ + retv = str2area_id ((STR), &(V), &(F)); \ if (retv < 0) \ { \ vty_out (vty, "%% Invalid OSPF area ID%s", VTY_NEWLINE); \ @@ -54,6 +53,7 @@ extern void ospf_vty_init (void); extern void ospf_vty_show_init (void); extern void ospf_vty_clear_init (void); -extern int ospf_str2area_id (const char *, struct in_addr *, int *); +extern int str2area_id (const char *, struct in_addr *, int *); +extern void area_id2str (char *, int, struct in_addr *, int); #endif /* _QUAGGA_OSPF_VTY_H */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index c22793a09..4df49db9b 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h index 22c71a49e..c0b99a95a 100644 --- a/ospfd/ospf_zebra.h +++ b/ospfd/ospf_zebra.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_OSPF_ZEBRA_H diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 0c3230d36..fb6503013 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -1,22 +1,22 @@ /* OSPF version 2 daemon program. - Copyright (C) 1999, 2000 Toshiaki Takada - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 1999, 2000 Toshiaki Takada + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -720,6 +720,7 @@ ospf_area_new (struct ospf *ospf, struct in_addr area_id) new->ospf = ospf; new->area_id = area_id; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; new->external_routing = OSPF_AREA_DEFAULT; new->default_cost = 1; @@ -812,7 +813,7 @@ ospf_area_check_free (struct ospf *ospf, struct in_addr area_id) } struct ospf_area * -ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) +ospf_area_get (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; @@ -820,7 +821,6 @@ ospf_area_get (struct ospf *ospf, struct in_addr area_id, int format) if (!area) { area = ospf_area_new (ospf, area_id); - area->format = format; listnode_add_sort (ospf->areas, area); ospf_check_abr_status (ospf); if (ospf->stub_router_admin_set == OSPF_STUB_ROUTER_ADMINISTRATIVE_SET) @@ -923,13 +923,13 @@ static void update_redistributed(struct ospf *ospf, int add_to_ospf) /* Config network statement related functions. */ static struct ospf_network * -ospf_network_new (struct in_addr area_id, int format) +ospf_network_new (struct in_addr area_id) { struct ospf_network *new; new = XCALLOC (MTYPE_OSPF_NETWORK, sizeof (struct ospf_network)); new->area_id = area_id; - new->format = format; + new->area_id_fmt = OSPF_AREA_ID_FMT_DOTTEDQUAD; return new; } @@ -944,12 +944,11 @@ ospf_network_free (struct ospf *ospf, struct ospf_network *network) int ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, - struct in_addr area_id) + struct in_addr area_id, int df) { struct ospf_network *network; struct ospf_area *area; struct route_node *rn; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; rn = route_node_get (ospf->networks, (struct prefix *)p); if (rn->info) @@ -959,8 +958,10 @@ ospf_network_set (struct ospf *ospf, struct prefix_ipv4 *p, return 0; } - rn->info = network = ospf_network_new (area_id, ret); - area = ospf_area_get (ospf, area_id, ret); + rn->info = network = ospf_network_new (area_id); + network->area_id_fmt = df; + area = ospf_area_get (ospf, area_id); + ospf_area_display_format_set (ospf, area, df); /* Run network config now. */ ospf_network_run ((struct prefix *)p, area); @@ -1040,7 +1041,6 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) struct ospf *ospf; struct ospf_if_params *params; struct ospf_interface *oi; - int ret = OSPF_AREA_ID_FORMAT_ADDRESS; if ((ospf = ospf_lookup ()) == NULL) return 1; /* Ospf not ready yet */ @@ -1050,7 +1050,7 @@ ospf_interface_set (struct interface *ifp, struct in_addr area_id) SET_IF_PARAM (params, if_area); params->if_area = area_id; - area = ospf_area_get (ospf, area_id, ret); + area = ospf_area_get (ospf, area_id); for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, co)) { @@ -1238,7 +1238,7 @@ ospf_if_update (struct ospf *ospf, struct interface *ifp) if (rn->info != NULL) { network = (struct ospf_network *) rn->info; - area = ospf_area_get (ospf, network->area_id, network->format); + area = ospf_area_get (ospf, network->area_id); ospf_network_run_interface (&rn->p, area, ifp); } @@ -1372,12 +1372,19 @@ ospf_area_vlink_count (struct ospf *ospf, struct ospf_area *area) } int +ospf_area_display_format_set (struct ospf *ospf, struct ospf_area *area, int df) +{ + area->area_id_fmt = df; + + return 1; +} + +int ospf_area_stub_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; @@ -1408,9 +1415,8 @@ int ospf_area_no_summary_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); area->no_summary = 1; return 1; @@ -1435,9 +1441,8 @@ int ospf_area_nssa_set (struct ospf *ospf, struct in_addr area_id) { struct ospf_area *area; - int format = OSPF_AREA_ID_FORMAT_ADDRESS; - area = ospf_area_get (ospf, area_id, format); + area = ospf_area_get (ospf, area_id); if (ospf_area_vlink_count (ospf, area)) return 0; diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index c5b0324b8..822a8039b 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -8,16 +8,15 @@ * 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. - * + * * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_OSPFD_H @@ -322,9 +321,9 @@ struct ospf_area struct in_addr area_id; /* Area ID format. */ - char format; -#define OSPF_AREA_ID_FORMAT_ADDRESS 1 -#define OSPF_AREA_ID_FORMAT_DECIMAL 2 + int area_id_fmt; +#define OSPF_AREA_ID_FMT_DOTTEDQUAD 1 +#define OSPF_AREA_ID_FMT_DECIMAL 2 /* Address range. */ struct list *address_range; @@ -431,7 +430,7 @@ struct ospf_network { /* Area ID. */ struct in_addr area_id; - int format; + int area_id_fmt; }; /* OSPF NBMA neighbor structure. */ @@ -509,9 +508,11 @@ extern struct ospf *ospf_get_instance (u_short); extern void ospf_finish (struct ospf *); extern void ospf_router_id_update (struct ospf *ospf); extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *, - struct in_addr); + struct in_addr, int); extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, struct in_addr); +extern int ospf_area_display_format_set (struct ospf *, struct ospf_area *area, + int df); extern int ospf_area_stub_set (struct ospf *, struct in_addr); extern int ospf_area_stub_unset (struct ospf *, struct in_addr); extern int ospf_area_no_summary_set (struct ospf *, struct in_addr); @@ -550,7 +551,7 @@ extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *, int); extern int ospf_oi_count (struct interface *); -extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int); +extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr); extern void ospf_area_check_free (struct ospf *, struct in_addr); extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *, struct in_addr); diff --git a/pimd/Makefile.am b/pimd/Makefile.am index 77eb5c756..0dd6c569d 100644 --- a/pimd/Makefile.am +++ b/pimd/Makefile.am @@ -53,7 +53,7 @@ libpim_a_SOURCES = \ pim_ssmpingd.c pim_int.c pim_rp.c \ pim_static.c pim_br.c pim_register.c pim_routemap.c \ pim_msdp.c pim_msdp_socket.c pim_msdp_packet.c \ - pim_jp_agg.c pim_nht.c pim_ssm.c + pim_jp_agg.c pim_nht.c pim_ssm.c pim_bfd.c noinst_HEADERS = \ pim_memory.h \ @@ -66,7 +66,7 @@ noinst_HEADERS = \ pim_igmp_join.h pim_ssmpingd.h pim_int.h pim_rp.h \ pim_static.h pim_br.h pim_register.h \ pim_msdp.h pim_msdp_socket.h pim_msdp_packet.h pim_nht.h \ - pim_jp_agg.h pim_ssm.h + pim_jp_agg.h pim_ssm.h pim_bfd.h pimd_SOURCES = \ pim_main.c $(libpim_a_SOURCES) diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index a11cce943..37515cee5 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_assert.h b/pimd/pim_assert.h index ec18cab85..b2fc11523 100644 --- a/pimd/pim_assert.h +++ b/pimd/pim_assert.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_ASSERT_H #define PIM_ASSERT_H diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c new file mode 100644 index 000000000..5c10df32e --- /dev/null +++ b/pimd/pim_bfd.c @@ -0,0 +1,360 @@ +/* + * pim_bfd.c: PIM BFD handling routines + * + * Copyright (C) 2017 Cumulus Networks, Inc. + * Chirag Shah + * + * 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 + */ + +#include <zebra.h> + +#include "lib/json.h" +#include "command.h" +#include "vty.h" +#include "zclient.h" + +#include "pim_cmd.h" +#include "pim_vty.h" +#include "pim_iface.h" +#include "pim_bfd.h" +#include "bfd.h" +#include "pimd.h" +#include "pim_zebra.h" + +/* + * pim_bfd_write_config - Write the interface BFD configuration. + */ +void +pim_bfd_write_config (struct vty *vty, struct interface *ifp) +{ + struct pim_interface *pim_ifp = ifp->info; + struct bfd_info *bfd_info = NULL; + + if (!pim_ifp) + return; + bfd_info = (struct bfd_info *) pim_ifp->bfd_info; + if (!bfd_info) + { + zlog_debug ("%s: interface %s bfd_info is NULL ", __PRETTY_FUNCTION__, + ifp->name); + return; + } + if (CHECK_FLAG (bfd_info->flags, BFD_FLAG_PARAM_CFG)) + vty_out (vty, " ip pim bfd %d %d %d%s", + bfd_info->detect_mult, bfd_info->required_min_rx, + bfd_info->desired_min_tx, VTY_NEWLINE); + else + vty_out (vty, " ip pim bfd%s", VTY_NEWLINE); +} + +/* + * pim_bfd_show_info - Show BFD info structure + */ +void +pim_bfd_show_info (struct vty *vty, void *bfd_info, json_object * json_obj, + u_char use_json, int param_only) +{ + if (param_only) + bfd_show_param (vty, (struct bfd_info *) bfd_info, 1, 0, use_json, + json_obj); + else + bfd_show_info (vty, (struct bfd_info *) bfd_info, 0, 1, use_json, + json_obj); +} + +/* + * pim_bfd_info_nbr_create - Create/update BFD information for a neighbor. + */ +void +pim_bfd_info_nbr_create (struct pim_interface *pim_ifp, + struct pim_neighbor *neigh) +{ + struct bfd_info *nbr_bfd_info = NULL; + + /* Check if Pim Interface BFD is enabled */ + if (!pim_ifp || !pim_ifp->bfd_info) + return; + + if (!neigh->bfd_info) + neigh->bfd_info = bfd_info_create (); + + if (!neigh->bfd_info) + return; + zlog_debug ("%s: bfd_info ", __PRETTY_FUNCTION__); + + nbr_bfd_info = (struct bfd_info *) neigh->bfd_info; + nbr_bfd_info->detect_mult = pim_ifp->bfd_info->detect_mult; + nbr_bfd_info->desired_min_tx = pim_ifp->bfd_info->desired_min_tx; + nbr_bfd_info->required_min_rx = pim_ifp->bfd_info->required_min_rx; +} + +/* + * pim_bfd_info_free - Free BFD info structure + */ +void +pim_bfd_info_free (void **bfd_info) +{ + bfd_info_free ((struct bfd_info **) bfd_info); +} + +static void +pim_bfd_reg_dereg_nbr (struct pim_neighbor *nbr, int command) +{ + struct pim_interface *pim_ifp = NULL; + struct bfd_info *bfd_info = NULL; + struct zclient *zclient = NULL; + + zclient = pim_zebra_zclient_get (); + + if (!nbr) + return; + pim_ifp = nbr->interface->info; + bfd_info = (struct bfd_info *) pim_ifp->bfd_info; + if (!bfd_info) + return; + if (PIM_DEBUG_PIM_TRACE) + { + char str[INET_ADDRSTRLEN]; + pim_inet4_dump ("<bfd_nbr?>", nbr->source_addr, str, sizeof (str)); + zlog_debug ("%s Nbr %s %s with BFD", __PRETTY_FUNCTION__, str, + bfd_get_command_dbg_str (command)); + } + bfd_peer_sendmsg (zclient, bfd_info, AF_INET, + &nbr->source_addr, NULL, nbr->interface->name, + 0, 0, command, 0, VRF_DEFAULT); +} + +/* + * pim_bfd_reg_dereg_all_nbr - Register/Deregister all neighbors associated + * with a interface with BFD through + * zebra for starting/stopping the monitoring of + * the neighbor rechahability. + */ +int +pim_bfd_reg_dereg_all_nbr (struct interface *ifp, int command) +{ + struct pim_interface *pim_ifp = NULL; + struct listnode *node = NULL; + struct pim_neighbor *neigh = NULL; + + pim_ifp = ifp->info; + if (!pim_ifp) + return -1; + if (!pim_ifp->bfd_info) + return -1; + + for (ALL_LIST_ELEMENTS_RO (pim_ifp->pim_neighbor_list, node, neigh)) + { + if (command != ZEBRA_BFD_DEST_DEREGISTER) + pim_bfd_info_nbr_create (pim_ifp, neigh); + else + bfd_info_free ((struct bfd_info **) &neigh->bfd_info); + + pim_bfd_reg_dereg_nbr (neigh, command); + } + + return 0; +} + +/* + * pim_bfd_trigger_event - Neighbor is registered/deregistered with BFD when + * neighbor state is changed to/from 2way. + */ +void +pim_bfd_trigger_event (struct pim_interface *pim_ifp, struct pim_neighbor *nbr, uint8_t nbr_up) +{ + if (nbr_up) + { + pim_bfd_info_nbr_create (pim_ifp, nbr); + pim_bfd_reg_dereg_nbr (nbr, ZEBRA_BFD_DEST_REGISTER); + } + else + { + pim_bfd_info_free ((void *)&nbr->bfd_info); + pim_bfd_reg_dereg_nbr (nbr, ZEBRA_BFD_DEST_DEREGISTER); + } +} + +/* + * pim_bfd_if_param_set - Set the configured BFD paramter values for + * interface. + */ +void +pim_bfd_if_param_set (struct interface *ifp, u_int32_t min_rx, + u_int32_t min_tx, u_int8_t detect_mult, int defaults) +{ + struct pim_interface *pim_ifp = ifp->info; + int command = 0; + + bfd_set_param ((struct bfd_info **) &(pim_ifp->bfd_info), min_rx, min_tx, + detect_mult, defaults, &command); + + if (pim_ifp->bfd_info) + { + if (PIM_DEBUG_PIM_TRACE) + zlog_debug ("%s: interface %s has bfd_info", __PRETTY_FUNCTION__, + ifp->name); + } + if (command) + pim_bfd_reg_dereg_all_nbr (ifp, command); +} + + +/* + * pim_bfd_interface_dest_update - Find the neighbor for which the BFD status + * has changed and bring down the neighbor + * connectivity if the BFD status changed to + * down. + */ +static int +pim_bfd_interface_dest_update (int command, struct zclient *zclient, + zebra_size_t length, vrf_id_t vrf_id) +{ + struct interface *ifp = NULL; + struct pim_interface *pim_ifp = NULL; + struct prefix p; + int status; + char msg[100]; + int old_status; + struct bfd_info *bfd_info = NULL; + struct timeval tv; + struct listnode *neigh_node = NULL; + struct listnode *neigh_nextnode = NULL; + struct pim_neighbor *neigh = NULL; + + ifp = bfd_get_peer_info (zclient->ibuf, &p, NULL, &status, vrf_id); + + if ((ifp == NULL) || (p.family != AF_INET)) + return 0; + + pim_ifp = ifp->info; + if (!pim_ifp) + return 0; + + if (!pim_ifp->bfd_info) + { + if (PIM_DEBUG_PIM_TRACE) + zlog_debug ("%s: pim interface %s BFD is disabled ", __PRETTY_FUNCTION__, + ifp->name); + return 0; + } + + if (PIM_DEBUG_PIM_TRACE) + { + char buf[PREFIX2STR_BUFFER]; + prefix2str (&p, buf, sizeof (buf)); + zlog_debug ("%s: interface %s bfd destination %s %s", + __PRETTY_FUNCTION__, ifp->name, buf, + bfd_get_status_str (status)); + } + + for (ALL_LIST_ELEMENTS (pim_ifp->pim_neighbor_list, neigh_node, + neigh_nextnode, neigh)) + { + bfd_info = (struct bfd_info *) neigh->bfd_info; + if (bfd_info->status == status) + { + if (PIM_DEBUG_PIM_TRACE) + { + char str[INET_ADDRSTRLEN]; + pim_inet4_dump ("<nht_nbr?>", neigh->source_addr, str, + sizeof (str)); + zlog_debug ("%s: bfd status is same for nbr %s", + __PRETTY_FUNCTION__, str); + } + continue; + } + old_status = bfd_info->status; + bfd_info->status = status; + monotime(&tv); + bfd_info->last_update = tv.tv_sec; + + if (PIM_DEBUG_PIM_TRACE) + { + zlog_debug ("%s: status %s old_status %s", __PRETTY_FUNCTION__, + bfd_get_status_str (status), + bfd_get_status_str (old_status)); + } + if ((status == BFD_STATUS_DOWN) && (old_status == BFD_STATUS_UP)) + { + snprintf (msg, sizeof (msg), "BFD Session Expired"); + pim_neighbor_delete (ifp, neigh, msg); + } + } + return 0; +} + +/* + * pim_bfd_nbr_replay - Replay all the neighbors that have BFD enabled + * to zebra + */ +static int +pim_bfd_nbr_replay (int command, struct zclient *zclient, zebra_size_t length, + vrf_id_t vrf_id) +{ + struct interface *ifp = NULL; + struct pim_interface *pim_ifp = NULL; + struct pim_neighbor *neigh = NULL; + struct listnode *node; + struct listnode *neigh_node; + struct listnode *neigh_nextnode; + + /* Send the client registration */ + bfd_client_sendmsg (zclient, ZEBRA_BFD_CLIENT_REGISTER); + + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) + { + pim_ifp = ifp->info; + + if (!pim_ifp) + continue; + + if (pim_ifp->pim_sock_fd < 0) + continue; + + for (ALL_LIST_ELEMENTS (pim_ifp->pim_neighbor_list, neigh_node, + neigh_nextnode, neigh)) + { + if (!neigh->bfd_info) + continue; + if (PIM_DEBUG_PIM_TRACE) + { + char str[INET_ADDRSTRLEN]; + pim_inet4_dump ("<bfd_nbr?>", neigh->source_addr, str, + sizeof (str)); + zlog_debug ("%s: Replaying Pim Neigh %s to BFD", + __PRETTY_FUNCTION__, str); + } + pim_bfd_reg_dereg_nbr (neigh, ZEBRA_BFD_DEST_UPDATE); + + } + } + return 0; +} + +void +pim_bfd_init (void) +{ + struct zclient *zclient = NULL; + + zclient = pim_zebra_zclient_get (); + + bfd_gbl_init (); + + zclient->interface_bfd_dest_update = pim_bfd_interface_dest_update; + zclient->bfd_dest_replay = pim_bfd_nbr_replay; +} diff --git a/pimd/pim_bfd.h b/pimd/pim_bfd.h new file mode 100644 index 000000000..23f286b86 --- /dev/null +++ b/pimd/pim_bfd.h @@ -0,0 +1,42 @@ +/* + * pim_bfd.h: PIM BFD definitions and structures + * + * Copyright (C) 2017 Cumulus Networks, Inc. + * Chirag Shah + * + * 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 PIM_BFD_H +#define PIM_BFD_H + +#include "if.h" + +void pim_bfd_init (void); +void pim_bfd_write_config (struct vty *vty, struct interface *ifp); +void +pim_bfd_show_info (struct vty *vty, void *bfd_info, json_object * json_obj, + u_char use_json, int param_only); +void +pim_bfd_if_param_set (struct interface *ifp, u_int32_t min_rx, + u_int32_t min_tx, u_int8_t detect_mult, int defaults); +int pim_bfd_reg_dereg_all_nbr (struct interface *ifp, int command); +void +pim_bfd_trigger_event (struct pim_interface *pim_ifp, struct pim_neighbor *nbr, uint8_t nbr_up); +void +pim_bfd_info_nbr_create (struct pim_interface *pim_ifp, struct pim_neighbor *neigh); +void pim_bfd_info_free(void **bfd_info); +#endif /* _PIM_BFD_H */ diff --git a/pimd/pim_br.c b/pimd/pim_br.c index 3f84de79c..19a0293c4 100644 --- a/pimd/pim_br.c +++ b/pimd/pim_br.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include <zebra.h> diff --git a/pimd/pim_br.h b/pimd/pim_br.h index 8e4f719ed..345dd011e 100644 --- a/pimd/pim_br.h +++ b/pimd/pim_br.h @@ -13,10 +13,9 @@ * 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 + * 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 PIM_BR_H #define PIM_BR_H diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index c6e9ae0c3..59f2c33ce 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -58,6 +57,8 @@ #include "pim_msdp.h" #include "pim_ssm.h" #include "pim_nht.h" +#include "pim_bfd.h" +#include "bfd.h" static struct cmd_node pim_global_node = { PIM_NODE, @@ -1509,6 +1510,7 @@ static void pim_show_neighbors_single(struct vty *vty, const char *neighbor, u_c vty_out(vty, " Hello Option - Holdtime : %s%s", option_holdtime ? "yes" : "no", VTY_NEWLINE); vty_out(vty, " Hello Option - LAN Prune Delay : %s%s", option_lan_prune_delay ? "yes" : "no", VTY_NEWLINE); vty_out(vty, " Hello Option - T-bit : %s%s", option_t_bit ? "yes" : "no", VTY_NEWLINE); + pim_bfd_show_info (vty, neigh->bfd_info, json_ifp, uj, 0); vty_out(vty, "%s", VTY_NEWLINE); } } @@ -3495,7 +3497,7 @@ static void show_mroute(struct vty *vty, u_char uj) json_object_string_add(json_ifp_out, "group", grp_str); json_object_boolean_true_add(json_ifp_out, "protocolStatic"); json_object_string_add(json_ifp_out, "inboundInterface", in_ifname); - json_object_int_add(json_ifp_out, "iVifI", c_oil->oil.mfcc_parent); + json_object_int_add(json_ifp_out, "iVifI", s_route->c_oil.oil.mfcc_parent); json_object_string_add(json_ifp_out, "outboundInterface", out_ifname); json_object_int_add(json_ifp_out, "oVifI", oif_vif_index); json_object_int_add(json_ifp_out, "ttl", ttl); @@ -5321,11 +5323,16 @@ DEFUN (interface_ip_pim_hello, pim_ifp = ifp->info; - if (!pim_ifp) { - vty_out(vty, "Pim not enabled on this interface%s", VTY_NEWLINE); - return CMD_WARNING; - } + if (!pim_ifp) + { + if (!pim_cmd_interface_add(ifp)) + { + vty_out(vty, "Could not enable PIM SM on interface%s", VTY_NEWLINE); + return CMD_WARNING; + } + } + pim_ifp = ifp->info; pim_ifp->pim_hello_period = strtol(argv[idx_time]->arg, NULL, 10); if (argc == idx_hold + 1) @@ -5928,6 +5935,99 @@ DEFUN (interface_no_pim_use_source, return interface_pim_use_src_cmd_worker (vty, "0.0.0.0"); } +DEFUN (ip_pim_bfd, + ip_pim_bfd_cmd, + "ip pim bfd", + IP_STR + PIM_STR + "Enables BFD support\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + struct pim_interface *pim_ifp = NULL; + struct bfd_info *bfd_info = NULL; + + if (!ifp) + return CMD_SUCCESS; + pim_ifp = ifp->info; + if (!pim_ifp) + return CMD_SUCCESS; + bfd_info = pim_ifp->bfd_info; + + if (!bfd_info || !CHECK_FLAG (bfd_info->flags, BFD_FLAG_PARAM_CFG)) + pim_bfd_if_param_set (ifp, BFD_DEF_MIN_RX, BFD_DEF_MIN_TX, + BFD_DEF_DETECT_MULT, 1); + + return CMD_SUCCESS; +} + +DEFUN (no_ip_pim_bfd, + no_ip_pim_bfd_cmd, + "no ip pim bfd", + NO_STR + IP_STR + PIM_STR + "Disables BFD support\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + struct pim_interface *pim_ifp = NULL; + + assert (ifp); + + pim_ifp = ifp->info; + if (!pim_ifp) + return CMD_SUCCESS; + + if (pim_ifp->bfd_info) + { + pim_bfd_reg_dereg_all_nbr (ifp, ZEBRA_BFD_DEST_DEREGISTER); + bfd_info_free (&(pim_ifp->bfd_info)); + } + + return CMD_SUCCESS; +} + +DEFUN (ip_pim_bfd_param, + ip_pim_bfd_param_cmd, + "ip pim bfd (2-255) (50-60000) (50-60000)", + IP_STR + PIM_STR + "Enables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") +{ + VTY_DECLVAR_CONTEXT(interface, ifp); + int idx_number = 3; + int idx_number_2 = 4; + int idx_number_3 = 5; + u_int32_t rx_val; + u_int32_t tx_val; + u_int8_t dm_val; + int ret; + + + if ((ret = bfd_validate_param (vty, argv[idx_number]->arg, + argv[idx_number_2]->arg, + argv[idx_number_3]->arg, + &dm_val, &rx_val, &tx_val)) != CMD_SUCCESS) + return ret; + + pim_bfd_if_param_set (ifp, rx_val, tx_val, dm_val, 0); + + return CMD_SUCCESS; +} + +ALIAS (no_ip_pim_bfd, + no_ip_pim_bfd_param_cmd, + "no ip pim bfd (2-255) (50-60000) (50-60000)", + NO_STR + IP_STR + PIM_STR + "Enables BFD support\n" + "Detect Multiplier\n" + "Required min receive interval\n" + "Desired min transmit interval\n") + static int ip_msdp_peer_cmd_worker (struct vty *vty, const char *peer, const char *local) { @@ -6451,7 +6551,7 @@ DEFUN (show_ip_msdp_peer_detail, if (uj) argc--; - if (argc == 4) + if (argc > 4) ip_msdp_show_peers_detail(vty, argv[4]->arg, uj); else ip_msdp_show_peers(vty, uj); @@ -6911,4 +7011,9 @@ void pim_cmd_init() install_element (VIEW_NODE, &show_ip_pim_group_type_cmd); install_element (INTERFACE_NODE, &interface_pim_use_source_cmd); install_element (INTERFACE_NODE, &interface_no_pim_use_source_cmd); + /* Install BFD command */ + install_element (INTERFACE_NODE, &ip_pim_bfd_cmd); + install_element (INTERFACE_NODE, &ip_pim_bfd_param_cmd); + install_element (INTERFACE_NODE, &no_ip_pim_bfd_cmd); + install_element (INTERFACE_NODE, &no_ip_pim_bfd_param_cmd); } diff --git a/pimd/pim_cmd.h b/pimd/pim_cmd.h index e08cefb29..64751d868 100644 --- a/pimd/pim_cmd.h +++ b/pimd/pim_cmd.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_CMD_H #define PIM_CMD_H diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c index ee9433d79..0c08cfa46 100644 --- a/pimd/pim_hello.c +++ b/pimd/pim_hello.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_hello.h b/pimd/pim_hello.h index 1f8b348bd..ff799b20f 100644 --- a/pimd/pim_hello.h +++ b/pimd/pim_hello.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_HELLO_H #define PIM_HELLO_H diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 48a59344e..f36a9b3cb 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1,21 +1,20 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * 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 + */ #include <zebra.h> @@ -61,7 +60,6 @@ pim_if_init (void) for (i = 0; i < MAXVIFS; i++) pim_iface_vif_index[i] = 0; - vrf_iflist_create(VRF_DEFAULT); pim_ifchannel_list = list_new(); pim_ifchannel_list->cmp = (int (*)(void *, void *))pim_ifchannel_compare; } diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 3c353b049..a1c2b692f 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -1,21 +1,20 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_IFACE_H @@ -25,9 +24,12 @@ #include "if.h" #include "vty.h" +#include "vrf.h" +#include "zclient.h" #include "pim_igmp.h" #include "pim_upstream.h" +#include "bfd.h" #define PIM_IF_MASK_PIM (1 << 0) #define PIM_IF_MASK_IGMP (1 << 1) @@ -128,6 +130,7 @@ struct pim_interface { uint32_t pim_ifstat_reg_stop_send; uint32_t pim_ifstat_assert_recv; uint32_t pim_ifstat_assert_send; + struct bfd_info *bfd_info; }; extern struct interface *pim_regiface; diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 9f9863133..9b79c032c 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -148,7 +147,6 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) /* SGRpt entry could have empty oil */ if (ch->upstream->channel_oil) pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, mask); - pim_channel_del_oif (ch->upstream->channel_oil, ch->interface, mask); /* * Do we have any S,G's that are inheriting? * Nuke from on high too. @@ -179,6 +177,10 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) pim_upstream_update_join_desired(ch->upstream); } + /* upstream is common across ifchannels, check if upstream's + ifchannel list is empty before deleting upstream_del + ref count will take care of it. + */ pim_upstream_del(ch->upstream, __PRETTY_FUNCTION__); ch->upstream = NULL; @@ -200,6 +202,9 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) hash_release(pim_ifp->pim_ifchannel_hash, ch); listnode_delete(pim_ifchannel_list, ch); + if (PIM_DEBUG_PIM_TRACE) + zlog_debug ("%s: ifchannel entry %s is deleted ", __PRETTY_FUNCTION__, ch->sg_str); + pim_ifchannel_free(ch); } @@ -571,14 +576,18 @@ pim_ifchannel_add(struct interface *ifp, listnode_add_sort(up->ifchannels, ch); + if (PIM_DEBUG_PIM_TRACE) + zlog_debug ("%s: ifchannel %s is created ", __PRETTY_FUNCTION__, ch->sg_str); + return ch; } -static void ifjoin_to_noinfo(struct pim_ifchannel *ch) +static void ifjoin_to_noinfo(struct pim_ifchannel *ch, bool ch_del) { pim_forward_stop(ch); pim_ifchannel_ifjoin_switch(__PRETTY_FUNCTION__, ch, PIM_IFJOIN_NOINFO); - delete_on_noinfo(ch); + if (ch_del) + delete_on_noinfo(ch); } static int on_ifjoin_expiry_timer(struct thread *t) @@ -587,9 +596,7 @@ static int on_ifjoin_expiry_timer(struct thread *t) ch = THREAD_ARG(t); - ch->t_ifjoin_expiry_timer = NULL; - - ifjoin_to_noinfo(ch); + ifjoin_to_noinfo(ch, true); /* ch may have been deleted */ return 0; @@ -604,8 +611,6 @@ static int on_ifjoin_prune_pending_timer(struct thread *t) ch = THREAD_ARG(t); - ch->t_ifjoin_prune_pending_timer = NULL; - if (ch->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING) { /* Send PruneEcho(S,G) ? */ @@ -613,10 +618,6 @@ static int on_ifjoin_prune_pending_timer(struct thread *t) pim_ifp = ifp->info; send_prune_echo = (listcount(pim_ifp->pim_neighbor_list) > 1); - //ch->ifjoin_state transition to NOINFO - ifjoin_to_noinfo(ch); - /* from here ch may have been deleted */ - if (send_prune_echo) { struct pim_rpf rpf; @@ -625,6 +626,23 @@ static int on_ifjoin_prune_pending_timer(struct thread *t) rpf.rpf_addr.u.prefix4 = pim_ifp->primary_address; pim_jp_agg_single_upstream_send(&rpf, ch->upstream, 0); } + /* If SGRpt flag is set on ifchannel, Trigger SGRpt + message on RP path upon prune timer expiry. + */ + if (PIM_IF_FLAG_TEST_S_G_RPT (ch->flags)) + { + if (ch->upstream) + pim_upstream_update_join_desired(ch->upstream); + /* + ch->ifjoin_state transition to NOINFO state + ch_del is set to 0 for not deleteing from here. + Holdtime expiry (ch_del set to 1) delete the entry. + */ + ifjoin_to_noinfo(ch, false); + } + else + ifjoin_to_noinfo(ch, true); + /* from here ch may have been deleted */ } else { @@ -801,7 +819,7 @@ void pim_ifchannel_join_add(struct interface *ifp, (ch->upstream->parent->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP) && !(ch->upstream->flags & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)) { - pim_upstream_ref (ch->upstream, PIM_UPSTREAM_FLAG_MASK_SRC_LHR); + pim_upstream_ref (ch->upstream, PIM_UPSTREAM_FLAG_MASK_SRC_LHR, __PRETTY_FUNCTION__); pim_upstream_keep_alive_timer_start (ch->upstream, qpim_keep_alive_time); } break; @@ -894,8 +912,10 @@ void pim_ifchannel_prune(struct interface *ifp, case PIM_IFJOIN_NOINFO: if (source_flags & PIM_ENCODE_RPT_BIT) { - PIM_IF_FLAG_SET_S_G_RPT(ch->flags); - ch->ifjoin_state = PIM_IFJOIN_PRUNE_PENDING; + if (!(source_flags & PIM_ENCODE_WC_BIT)) + PIM_IF_FLAG_SET_S_G_RPT(ch->flags); + + ch->ifjoin_state = PIM_IFJOIN_PRUNE_PENDING; if (listcount(pim_ifp->pim_neighbor_list) > 1) jp_override_interval_msec = pim_if_jp_override_interval_msec(ifp); else @@ -1301,7 +1321,7 @@ pim_ifchannel_set_star_g_join_state (struct pim_ifchannel *ch, int eom, uint8_t if (up) { if (PIM_DEBUG_TRACE) - zlog_debug ("%s: del inherit oif from up %s", __PRETTY_FUNCTION__, up->sg_str); + zlog_debug ("%s: SGRpt Set, del inherit oif from up %s", __PRETTY_FUNCTION__, up->sg_str); pim_channel_del_oif (up->channel_oil, ch->interface, PIM_OIF_FLAG_PROTO_STAR); } } diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index 3ffb9190f..e8c2ddd07 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_IFCHANNEL_H #define PIM_IFCHANNEL_H diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index af0ddef23..c883a2c8b 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -39,6 +38,7 @@ #include "pim_zebra.h" static void group_timer_off(struct igmp_group *group); +static int pim_igmp_general_query(struct thread *t); /* This socket is used for TXing IGMP packets only, IGMP RX happens * in pim_mroute_msg() @@ -156,7 +156,6 @@ static int pim_igmp_other_querier_expire(struct thread *t) igmp = THREAD_ARG(t); - zassert(igmp->t_other_querier_timer); zassert(!igmp->t_igmp_query_timer); if (PIM_DEBUG_IGMP_TRACE) { @@ -167,13 +166,14 @@ static int pim_igmp_other_querier_expire(struct thread *t) ifaddr_str); } - igmp->t_other_querier_timer = NULL; - /* We are the current querier, then re-start sending general queries. + RFC 2236 - sec 7 Other Querier + present timer expired (Send General + Query, Set Gen. Query. timer) */ - pim_igmp_general_query_on(igmp); + pim_igmp_general_query(t); return 0; } @@ -201,9 +201,7 @@ void pim_igmp_other_querier_timer_on(struct igmp_sock *igmp) zlog_debug("Querier %s resetting TIMER event for Other-Querier-Present", ifaddr_str); } - THREAD_OFF(igmp->t_other_querier_timer); - zassert(!igmp->t_other_querier_timer); } else { /* @@ -265,7 +263,6 @@ void pim_igmp_other_querier_timer_off(struct igmp_sock *igmp) } } THREAD_OFF(igmp->t_other_querier_timer); - zassert(!igmp->t_other_querier_timer); } static int @@ -497,8 +494,6 @@ int pim_igmp_packet(struct igmp_sock *igmp, char *buf, size_t len) return -1; } -static int pim_igmp_general_query(struct thread *t); - void pim_igmp_general_query_on(struct igmp_sock *igmp) { struct pim_interface *pim_ifp; @@ -965,7 +960,6 @@ static int igmp_group_timer(struct thread *t) zassert(group->group_filtermode_isexcl); - group->t_group_timer = NULL; group->group_filtermode_isexcl = 0; /* Any source (*,G) is forwarded only if mode is EXCLUDE {empty} */ @@ -973,7 +967,6 @@ static int igmp_group_timer(struct thread *t) igmp_source_delete_expired(group->group_source_list); - zassert(!group->t_group_timer); zassert(!group->group_filtermode_isexcl); /* @@ -1000,9 +993,7 @@ static void group_timer_off(struct igmp_group *group) zlog_debug("Cancelling TIMER event for group %s on %s", group_str, group->group_igmp_sock->interface->name); } - THREAD_OFF(group->t_group_timer); - zassert(!group->t_group_timer); } void igmp_group_timer_on(struct igmp_group *group, diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h index 9c569bbd2..2f36094bd 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_IGMP_H #define PIM_IGMP_H diff --git a/pimd/pim_igmp_join.h b/pimd/pim_igmp_join.h index 228d30c5c..31fc1b047 100644 --- a/pimd/pim_igmp_join.h +++ b/pimd/pim_igmp_join.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_IGMP_JOIN_H #define PIM_IGMP_JOIN_H diff --git a/pimd/pim_igmpv2.c b/pimd/pim_igmpv2.c index ee4aa7bd9..d4b3010d3 100644 --- a/pimd/pim_igmpv2.c +++ b/pimd/pim_igmpv2.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include "zebra.h" diff --git a/pimd/pim_igmpv2.h b/pimd/pim_igmpv2.h index 10a247772..fa8d16394 100644 --- a/pimd/pim_igmpv2.h +++ b/pimd/pim_igmpv2.h @@ -13,10 +13,9 @@ * 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 + * 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 PIM_IGMPV2_H diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index e0b1d3fc2..ad37ad876 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> #include "log.h" @@ -129,9 +128,6 @@ static int igmp_source_timer(struct thread *t) group->group_igmp_sock->interface->name); } - zassert(source->t_source_timer); - source->t_source_timer = NULL; - /* RFC 3376: 6.3. IGMPv3 Source-Specific Forwarding Rules @@ -152,8 +148,6 @@ static int igmp_source_timer(struct thread *t) Source timer switched from (T > 0) to (T == 0): disable forwarding. */ - zassert(!source->t_source_timer); - if (group->group_filtermode_isexcl) { /* EXCLUDE mode */ @@ -194,7 +188,6 @@ static void source_timer_off(struct igmp_group *group, } THREAD_OFF(source->t_source_timer); - zassert(!source->t_source_timer); } static void igmp_source_timer_on(struct igmp_group *group, @@ -217,7 +210,6 @@ static void igmp_source_timer_on(struct igmp_group *group, thread_add_timer_msec(master, igmp_source_timer, source, interval_msec, &source->t_source_timer); - zassert(source->t_source_timer); /* RFC 3376: 6.3. IGMPv3 Source-Specific Forwarding Rules @@ -471,8 +463,6 @@ source_new (struct igmp_group *group, listnode_add(group->group_source_list, src); - zassert(!src->t_source_timer); /* source timer == 0 */ - /* Any source (*,G) is forwarded only if mode is EXCLUDE {empty} */ igmp_anysource_forward_stop(group); @@ -1282,8 +1272,6 @@ static int igmp_group_retransmit(struct thread *t) num_retransmit_sources_left = group_retransmit_sources(group, send_with_sflag_set); - group->t_group_query_retransmit_timer = NULL; - /* Keep group retransmit timer running if there is any retransmit counter pending diff --git a/pimd/pim_igmpv3.h b/pimd/pim_igmpv3.h index 3a4a81d97..99f7b84b8 100644 --- a/pimd/pim_igmpv3.h +++ b/pimd/pim_igmpv3.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_IGMPV3_H #define PIM_IGMPV3_H diff --git a/pimd/pim_int.c b/pimd/pim_int.c index 44b8386a3..577bf15c6 100644 --- a/pimd/pim_int.c +++ b/pimd/pim_int.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_int.h b/pimd/pim_int.h index a6349b5b3..54623ed21 100644 --- a/pimd/pim_int.h +++ b/pimd/pim_int.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_INT_H #define PIM_INT_H diff --git a/pimd/pim_join.c b/pimd/pim_join.c index ae7fedc62..5462dba61 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_join.h b/pimd/pim_join.h index adedde3cf..6dc1b3e8f 100644 --- a/pimd/pim_join.h +++ b/pimd/pim_join.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_JOIN_H #define PIM_JOIN_H diff --git a/pimd/pim_jp_agg.c b/pimd/pim_jp_agg.c index 46c6cbc69..25530f40b 100644 --- a/pimd/pim_jp_agg.c +++ b/pimd/pim_jp_agg.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include <zebra.h> diff --git a/pimd/pim_jp_agg.h b/pimd/pim_jp_agg.h index ad014d952..c3955f32f 100644 --- a/pimd/pim_jp_agg.h +++ b/pimd/pim_jp_agg.h @@ -13,10 +13,9 @@ * 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 + * 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 __PIM_JP_AGG_H__ #define __PIM_JP_AGG_H__ diff --git a/pimd/pim_macro.c b/pimd/pim_macro.c index 127e0f625..1f3b29554 100644 --- a/pimd/pim_macro.c +++ b/pimd/pim_macro.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_macro.h b/pimd/pim_macro.h index 3079ca80c..e07b2ece9 100644 --- a/pimd/pim_macro.h +++ b/pimd/pim_macro.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_MACRO_H #define PIM_MACRO_H diff --git a/pimd/pim_main.c b/pimd/pim_main.c index d814af6b2..a80059535 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -46,6 +45,7 @@ #include "pim_zebra.h" #include "pim_msdp.h" #include "pim_iface.h" +#include "pim_bfd.h" extern struct host host; @@ -130,6 +130,7 @@ int main(int argc, char** argv, char** envp) { * Initialize zclient "update" and "lookup" sockets */ pim_zebra_init(); + pim_bfd_init (); frr_config_fork(); diff --git a/pimd/pim_memory.c b/pimd/pim_memory.c index ab92665b9..d18b7f0c8 100644 --- a/pimd/pim_memory.c +++ b/pimd/pim_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/pimd/pim_memory.h b/pimd/pim_memory.h index e366377c8..01189aca7 100644 --- a/pimd/pim_memory.h +++ b/pimd/pim_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_PIM_MEMORY_H diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 76851fa81..01747268a 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> #include "log.h" @@ -626,7 +625,6 @@ static int mroute_read(struct thread *t) } /* Keep reading */ done: - qpim_mroute_socket_reader = NULL; mroute_read_on(); return result; @@ -634,8 +632,6 @@ static int mroute_read(struct thread *t) static void mroute_read_on() { - zassert(!qpim_mroute_socket_reader); - thread_add_read(master, mroute_read, 0, qpim_mroute_socket_fd, &qpim_mroute_socket_reader); } diff --git a/pimd/pim_mroute.h b/pimd/pim_mroute.h index 3c15c800d..36dce8e61 100644 --- a/pimd/pim_mroute.h +++ b/pimd/pim_mroute.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_MROUTE_H #define PIM_MROUTE_H diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 06cc24ddb..ed1284a95 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -12,10 +12,9 @@ * 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 + * 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 */ #include <zebra.h> @@ -68,7 +67,6 @@ pim_msdp_sa_timer_expiry_log(struct pim_msdp_sa *sa, const char *timer_str) static int pim_msdp_sa_adv_timer_cb(struct thread *t) { - msdp->sa_adv_timer = NULL; if (PIM_DEBUG_MSDP_EVENTS) { zlog_debug("MSDP SA advertisment timer expired"); } @@ -94,7 +92,6 @@ pim_msdp_sa_state_timer_cb(struct thread *t) struct pim_msdp_sa *sa; sa = THREAD_ARG(t); - sa->sa_state_timer = NULL; if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_sa_timer_expiry_log(sa, "state"); @@ -899,7 +896,6 @@ pim_msdp_peer_hold_timer_cb(struct thread *t) struct pim_msdp_peer *mp; mp = THREAD_ARG(t); - mp->hold_timer = NULL; if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "hold"); @@ -933,7 +929,6 @@ pim_msdp_peer_ka_timer_cb(struct thread *t) struct pim_msdp_peer *mp; mp = THREAD_ARG(t); - mp->ka_timer = NULL; if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "ka"); @@ -995,7 +990,6 @@ pim_msdp_peer_cr_timer_cb(struct thread *t) struct pim_msdp_peer *mp; mp = THREAD_ARG(t); - mp->cr_timer = NULL; if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "connect-retry"); diff --git a/pimd/pim_msdp.h b/pimd/pim_msdp.h index 57a7c2244..308b437a6 100644 --- a/pimd/pim_msdp.h +++ b/pimd/pim_msdp.h @@ -12,10 +12,9 @@ * 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 + * 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 PIM_MSDP_H #define PIM_MSDP_H diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index fbf34cd91..0a8679336 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -12,10 +12,9 @@ * 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 + * 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 */ #include <zebra.h> diff --git a/pimd/pim_msdp_packet.h b/pimd/pim_msdp_packet.h index f6fcfee6b..aa42bbfe4 100644 --- a/pimd/pim_msdp_packet.h +++ b/pimd/pim_msdp_packet.h @@ -12,10 +12,9 @@ * 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 + * 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 PIM_MSDP_PACKET_H #define PIM_MSDP_PACKET_H diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index 8ceddfa39..9662f054e 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -12,10 +12,9 @@ * 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 + * 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 */ #include <zebra.h> diff --git a/pimd/pim_msdp_socket.h b/pimd/pim_msdp_socket.h index bf3d12ad2..0abcd57da 100644 --- a/pimd/pim_msdp_socket.h +++ b/pimd/pim_msdp_socket.h @@ -12,10 +12,9 @@ * 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 + * 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 PIM_MSDP_SOCKET_H #define PIM_MSDP_SOCKET_H diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c index a9e013090..e077a8516 100644 --- a/pimd/pim_msg.c +++ b/pimd/pim_msg.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h index e5676289b..38ffaf6a7 100644 --- a/pimd/pim_msg.h +++ b/pimd/pim_msg.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_MSG_H #define PIM_MSG_H diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 5dccc3cfb..8b8946daf 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -39,6 +38,7 @@ #include "pim_zebra.h" #include "pim_join.h" #include "pim_jp_agg.h" +#include "pim_bfd.h" static void dr_election_by_addr(struct interface *ifp) { @@ -224,8 +224,6 @@ static int on_neighbor_timer(struct thread *t) neigh->holdtime, src_str, ifp->name); } - neigh->t_expire_timer = NULL; - snprintf(msg, sizeof(msg), "%d-sec holdtime expired", neigh->holdtime); pim_neighbor_delete(ifp, neigh, msg); @@ -279,7 +277,6 @@ on_neighbor_jp_timer (struct thread *t) zlog_debug("%s:Sending JP Agg to %s on %s with %d groups", __PRETTY_FUNCTION__, src_str, neigh->interface->name, neigh->upstream_jp_agg->count); } - neigh->jp_timer = NULL; rpf.source_nexthop.interface = neigh->interface; rpf.rpf_addr.u.prefix4 = neigh->source_addr; @@ -380,6 +377,9 @@ static struct pim_neighbor *pim_neighbor_new(struct interface *ifp, ++pim_ifp->pim_dr_num_nondrpri_neighbors; } + //Register PIM Neighbor with BFD + pim_bfd_trigger_event (pim_ifp, neigh, 1); + return neigh; } @@ -683,6 +683,9 @@ void pim_neighbor_delete(struct interface *ifp, src_str, ifp->name); } + //De-Register PIM Neighbor with BFD + pim_bfd_trigger_event (pim_ifp, neigh, 0); + listnode_delete(pim_ifp->pim_neighbor_list, neigh); pim_neighbor_free(neigh); diff --git a/pimd/pim_neighbor.h b/pimd/pim_neighbor.h index e27920fdd..eaaefd8fe 100644 --- a/pimd/pim_neighbor.h +++ b/pimd/pim_neighbor.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_NEIGHBOR_H #define PIM_NEIGHBOR_H @@ -44,6 +43,7 @@ struct pim_neighbor { struct thread *jp_timer; struct list *upstream_jp_agg; + struct bfd_info *bfd_info; }; void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime); diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index c5f8d1d82..01ba2039f 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include <zebra.h> #include "network.h" @@ -567,7 +566,7 @@ pim_ecmp_nexthop_search (struct pim_nexthop_cache *pnc, //PIM ECMP flag is enable then choose ECMP path. hash_val = pim_compute_ecmp_hash (src, grp); mod_val = hash_val % pnc->nexthop_num; - if (PIM_DEBUG_TRACE) + if (PIM_DEBUG_PIM_TRACE_DETAIL) zlog_debug ("%s: hash_val %u mod_val %u ", __PRETTY_FUNCTION__, hash_val, mod_val); } @@ -914,7 +913,7 @@ pim_ecmp_nexthop_lookup (struct pim_nexthop *nexthop, struct in_addr addr, { hash_val = pim_compute_ecmp_hash (src, grp); mod_val = hash_val % num_ifindex; - if (PIM_DEBUG_TRACE) + if (PIM_DEBUG_PIM_TRACE_DETAIL) zlog_debug ("%s: hash_val %u mod_val %u", __PRETTY_FUNCTION__, hash_val, mod_val); } @@ -1037,7 +1036,7 @@ int pim_ecmp_fib_lookup_if_vif_index(struct in_addr addr, { hash_val = pim_compute_ecmp_hash (src, grp); mod_val = hash_val % num_ifindex; - if (PIM_DEBUG_TRACE) + if (PIM_DEBUG_PIM_TRACE_DETAIL) zlog_debug ("%s: hash_val %u mod_val %u", __PRETTY_FUNCTION__, hash_val, mod_val); } diff --git a/pimd/pim_nht.h b/pimd/pim_nht.h index 0ccc5399c..6bd224992 100644 --- a/pimd/pim_nht.h +++ b/pimd/pim_nht.h @@ -13,10 +13,9 @@ * 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 + * 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 PIM_NHT_H #define PIM_NHT_H diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 7f5f3970a..71ca576d9 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index a7bb23cd0..02c7e740e 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_OIL_H #define PIM_OIL_H diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 57b9e6c79..f6a5bb122 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -722,7 +721,6 @@ static int on_pim_hello_send(struct thread *t) /* * Schedule next hello */ - pim_ifp->t_pim_hello_timer = NULL; hello_resched(ifp); /* @@ -802,7 +800,6 @@ void pim_hello_restart_triggered(struct interface *ifp) } THREAD_OFF(pim_ifp->t_pim_hello_timer); - pim_ifp->t_pim_hello_timer = NULL; } random_msec = triggered_hello_delay_msec; diff --git a/pimd/pim_pim.h b/pimd/pim_pim.h index 690b6c05c..7e2872184 100644 --- a/pimd/pim_pim.h +++ b/pimd/pim_pim.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_PIM_H #define PIM_PIM_H diff --git a/pimd/pim_register.c b/pimd/pim_register.c index f23993625..682a6401c 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -13,10 +13,9 @@ * 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 + * 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 */ #include <zebra.h> @@ -354,7 +353,7 @@ pim_register_recv (struct interface *ifp, zlog_debug("%s: Sending register-Stop to %s and dropping mr. packet", __func__, "Sender"); /* Drop Packet Silently */ - return 1; + return 0; } } @@ -416,5 +415,5 @@ pim_register_recv (struct interface *ifp, pim_register_stop_send (ifp, &sg, dest_addr, src_addr); } - return 1; + return 0; } diff --git a/pimd/pim_register.h b/pimd/pim_register.h index 210a904ae..adb703c61 100644 --- a/pimd/pim_register.h +++ b/pimd/pim_register.h @@ -13,10 +13,9 @@ * 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 + * 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 PIM_REGISTER_H #define PIM_REGISTER_H diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c index a8525b690..20c716c3e 100644 --- a/pimd/pim_routemap.c +++ b/pimd/pim_routemap.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index cdc760e92..3dde18708 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -12,11 +12,10 @@ * 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 + * + * 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 */ #include <zebra.h> @@ -99,6 +98,7 @@ pim_rp_init (void) str2prefix ("224.0.0.0/4", &rp_info->group); rp_info->group.family = AF_INET; rp_info->rp.rpf_addr.family = AF_INET; + rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_PREFIXLEN; rp_info->rp.rpf_addr.u.prefix4.s_addr = INADDR_NONE; tail = rp_info; @@ -307,6 +307,7 @@ pim_rp_new (const char *rp, const char *group_range, const char *plist) } rp_info->rp.rpf_addr.family = AF_INET; + rp_info->rp.rpf_addr.prefixlen = IPV4_MAX_PREFIXLEN; result = inet_pton (rp_info->rp.rpf_addr.family, rp, &rp_info->rp.rpf_addr.u.prefix4); if (result <= 0) diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h index df18c998d..319fe573c 100644 --- a/pimd/pim_rp.h +++ b/pimd/pim_rp.h @@ -12,11 +12,10 @@ * 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 + * + * 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 PIM_RP_H #define PIM_RP_H diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index f46ebfb97..3e72d8df2 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h index 85fb1ed89..bb7ee365b 100644 --- a/pimd/pim_rpf.h +++ b/pimd/pim_rpf.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_RPF_H #define PIM_RPF_H diff --git a/pimd/pim_signals.c b/pimd/pim_signals.c index 053ef6a67..ef492d0d8 100644 --- a/pimd/pim_signals.c +++ b/pimd/pim_signals.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_signals.h b/pimd/pim_signals.h index d7a4926d4..a82915691 100644 --- a/pimd/pim_signals.h +++ b/pimd/pim_signals.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_SIGNALS_H #define PIM_SIGNALS_H diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 07b137bb5..ba70cf2e1 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h index b4ce901d1..9fb64677c 100644 --- a/pimd/pim_sock.h +++ b/pimd/pim_sock.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_SOCK_H #define PIM_SOCK_H diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c index 41bf1e566..d4f88ec2c 100644 --- a/pimd/pim_ssm.c +++ b/pimd/pim_ssm.c @@ -12,10 +12,9 @@ * 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 + * 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 */ #include <zebra.h> diff --git a/pimd/pim_ssm.h b/pimd/pim_ssm.h index ca82d334f..fe337be8f 100644 --- a/pimd/pim_ssm.h +++ b/pimd/pim_ssm.h @@ -12,10 +12,9 @@ * 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 + * 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 PIM_SSM_H #define PIM_SSM_H diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index eda044f18..dd92ff1b2 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -311,18 +310,13 @@ static int ssmpingd_read_msg(struct ssmpingd_sock *ss) static int ssmpingd_sock_read(struct thread *t) { struct ssmpingd_sock *ss; - int sock_fd; int result; ss = THREAD_ARG(t); - sock_fd = THREAD_FD(t); - zassert(sock_fd == ss->sock_fd); - result = ssmpingd_read_msg(ss); /* Keep reading */ - ss->t_sock_read = 0; ssmpingd_read_on(ss); return result; @@ -330,7 +324,6 @@ static int ssmpingd_sock_read(struct thread *t) static void ssmpingd_read_on(struct ssmpingd_sock *ss) { - zassert(!ss->t_sock_read); thread_add_read(master, ssmpingd_sock_read, ss, ss->sock_fd, &ss->t_sock_read); } @@ -371,7 +364,7 @@ static struct ssmpingd_sock *ssmpingd_new(struct in_addr source_addr) } ss->sock_fd = sock_fd; - ss->t_sock_read = 0; + ss->t_sock_read = NULL; ss->source_addr = source_addr; ss->creation = pim_time_monotonic_sec(); ss->requests = 0; diff --git a/pimd/pim_ssmpingd.h b/pimd/pim_ssmpingd.h index 54f787e2a..02aa6271c 100644 --- a/pimd/pim_ssmpingd.h +++ b/pimd/pim_ssmpingd.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_SSMPINGD_H #define PIM_SSMPINGD_H diff --git a/pimd/pim_static.c b/pimd/pim_static.c index daaa95ab5..63762ef32 100644 --- a/pimd/pim_static.c +++ b/pimd/pim_static.c @@ -1,22 +1,21 @@ /* - PIM for Quagga: add the ability to configure multicast static routes - Copyright (C) 2014 Nathan Bahr, ATCorp - - 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 -*/ + * PIM for Quagga: add the ability to configure multicast static routes + * Copyright (C) 2014 Nathan Bahr, ATCorp + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_static.h b/pimd/pim_static.h index c288aa7ff..4b5ef7921 100644 --- a/pimd/pim_static.h +++ b/pimd/pim_static.h @@ -1,22 +1,21 @@ /* - PIM for Quagga: add the ability to configure multicast static routes - Copyright (C) 2014 Nathan Bahr, ATCorp - - 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 -*/ + * PIM for Quagga: add the ability to configure multicast static routes + * Copyright (C) 2014 Nathan Bahr, ATCorp + * + * 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 PIM_STATIC_H_ #define PIM_STATIC_H_ diff --git a/pimd/pim_str.c b/pimd/pim_str.c index 83f2a635b..d1219a868 100644 --- a/pimd/pim_str.c +++ b/pimd/pim_str.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_str.h b/pimd/pim_str.h index 97263e6a3..0ca517102 100644 --- a/pimd/pim_str.h +++ b/pimd/pim_str.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_STR_H #define PIM_STR_H diff --git a/pimd/pim_time.c b/pimd/pim_time.c index 348793cd0..406fec58d 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_time.h b/pimd/pim_time.h index de304a9f7..5d02d6efc 100644 --- a/pimd/pim_time.h +++ b/pimd/pim_time.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_TIME_H #define PIM_TIME_H diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index 259ed44c7..550fdde8e 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_tlv.h b/pimd/pim_tlv.h index 7e0a8a147..f80e1fba2 100644 --- a/pimd/pim_tlv.h +++ b/pimd/pim_tlv.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_TLV_H #define PIM_TLV_H diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 88b669414..bebe56567 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -78,9 +77,17 @@ pim_upstream_remove_children (struct pim_upstream *up) while (!list_isempty (up->sources)) { child = listnode_head (up->sources); - child->parent = NULL; listnode_delete (up->sources, child); + if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(child->flags)) + { + PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(child->flags); + child = pim_upstream_del(child, __PRETTY_FUNCTION__); + } + if (child) + child->parent = NULL; } + list_delete(up->sources); + up->sources = NULL; } /* @@ -149,10 +156,14 @@ void pim_upstream_free(struct pim_upstream *up) static void upstream_channel_oil_detach(struct pim_upstream *up) { - if (up->channel_oil) { - pim_channel_oil_del(up->channel_oil); - up->channel_oil = NULL; - } + if (up->channel_oil) + { + /* Detaching from channel_oil, channel_oil may exist post del, + but upstream would not keep reference of it + */ + pim_channel_oil_del(up->channel_oil); + up->channel_oil = NULL; + } } struct pim_upstream * @@ -163,7 +174,7 @@ pim_upstream_del(struct pim_upstream *up, const char *name) if (PIM_DEBUG_TRACE) zlog_debug ("%s(%s): Delete %s ref count: %d , flags: %d c_oil ref count %d (Pre decrement)", - __PRETTY_FUNCTION__, name, up->sg_str, up->ref_count, up->flags, + __PRETTY_FUNCTION__, name, up->sg_str, up->ref_count, up->flags, up->channel_oil->oil_ref_count); --up->ref_count; @@ -195,25 +206,11 @@ pim_upstream_del(struct pim_upstream *up, const char *name) } pim_upstream_remove_children (up); - pim_mroute_del (up->channel_oil, __PRETTY_FUNCTION__); - upstream_channel_oil_detach(up); - if (up->sources) - { - struct listnode *node, *nnode; - struct pim_upstream *child; - for (ALL_LIST_ELEMENTS (up->sources, node, nnode, child)) - { - if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(child->flags)) - { - PIM_UPSTREAM_FLAG_UNSET_SRC_LHR(child->flags); - pim_upstream_del(child, __PRETTY_FUNCTION__); - } - } - - list_delete (up->sources); - } + list_delete (up->sources); up->sources = NULL; + pim_mroute_del (up->channel_oil, __PRETTY_FUNCTION__); + upstream_channel_oil_detach(up); list_delete (up->ifchannels); up->ifchannels = NULL; @@ -223,11 +220,10 @@ pim_upstream_del(struct pim_upstream *up, const char *name) into pim_upstream_free() because the later is called by list_delete_all_node() */ - if (up->parent) - { - listnode_delete (up->parent->sources, up); - up->parent = NULL; - } + if (up->parent && up->parent->sources) + listnode_delete (up->parent->sources, up); + up->parent = NULL; + listnode_delete (pim_upstream_list, up); hash_release (pim_upstream_hash, up); @@ -281,8 +277,6 @@ static int on_join_timer(struct thread *t) up = THREAD_ARG(t); - up->t_join_timer = NULL; - /* * In the case of a HFR we will not ahve anyone to send this to. */ @@ -536,13 +530,14 @@ pim_upstream_switch(struct pim_upstream *up, { enum pim_upstream_state old_state = up->join_state; - if (PIM_DEBUG_PIM_EVENTS) { - zlog_debug("%s: PIM_UPSTREAM_%s: (S,G) old: %s new: %s", + if (PIM_DEBUG_PIM_EVENTS) + { + zlog_debug ("%s: PIM_UPSTREAM_%s: (S,G) old: %s new: %s", __PRETTY_FUNCTION__, up->sg_str, pim_upstream_state2str (up->join_state), pim_upstream_state2str (new_state)); - } + } up->join_state = new_state; if (old_state != new_state) @@ -582,7 +577,17 @@ pim_upstream_switch(struct pim_upstream *up, if (old_state == PIM_UPSTREAM_JOINED) pim_msdp_up_join_state_changed(up); - pim_jp_agg_single_upstream_send(&up->rpf, up, 0 /* prune */); + /* IHR, Trigger SGRpt on *,G IIF to prune S,G from RPT */ + if (pim_upstream_is_sg_rpt(up) && up->parent) + { + if (PIM_DEBUG_PIM_TRACE_DETAIL) + zlog_debug ("%s: *,G IIF %s S,G IIF %s ", __PRETTY_FUNCTION__, + up->parent->rpf.source_nexthop.interface->name, + up->rpf.source_nexthop.interface->name); + pim_jp_agg_single_upstream_send(&up->parent->rpf, up->parent, 1 /* (W,G) Join */); + } + else + pim_jp_agg_single_upstream_send(&up->rpf, up, 0 /* prune */); join_timer_stop(up); } } @@ -715,9 +720,9 @@ pim_upstream_new (struct prefix_sg *sg, if (PIM_DEBUG_TRACE) { - zlog_debug ("%s: Created Upstream %s upstream_addr %s", + zlog_debug ("%s: Created Upstream %s upstream_addr %s ref count %d increment", __PRETTY_FUNCTION__, up->sg_str, - inet_ntoa (up->upstream_addr)); + inet_ntoa (up->upstream_addr), up->ref_count); } return up; @@ -748,6 +753,9 @@ pim_upstream_find_or_add(struct prefix_sg *sg, { up->flags |= flags; up->ref_count++; + if (PIM_DEBUG_TRACE) + zlog_debug ("%s(%s): upstream %s ref count %d increment", + __PRETTY_FUNCTION__, name, up->sg_str, up->ref_count); } } else @@ -757,10 +765,13 @@ pim_upstream_find_or_add(struct prefix_sg *sg, } void -pim_upstream_ref(struct pim_upstream *up, int flags) +pim_upstream_ref(struct pim_upstream *up, int flags, const char *name) { up->flags |= flags; ++up->ref_count; + if (PIM_DEBUG_TRACE) + zlog_debug ("%s(%s): upstream %s ref count %d increment", + __PRETTY_FUNCTION__, name, up->sg_str, up->ref_count); } struct pim_upstream *pim_upstream_add(struct prefix_sg *sg, @@ -771,7 +782,7 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg, int found = 0; up = pim_upstream_find(sg); if (up) { - pim_upstream_ref(up, flags); + pim_upstream_ref(up, flags, name); found = 1; } else { @@ -784,10 +795,11 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg, { char buf[PREFIX2STR_BUFFER]; prefix2str (&up->rpf.rpf_addr, buf, sizeof (buf)); - zlog_debug("%s(%s): %s, iif %s found: %d: ref_count: %d", + zlog_debug("%s(%s): %s, iif %s (%s) found: %d: ref_count: %d", __PRETTY_FUNCTION__, name, - up->sg_str, buf, found, - up->ref_count); + up->sg_str, buf, up->rpf.source_nexthop.interface ? + up->rpf.source_nexthop.interface->name : "NIL" , + found, up->ref_count); } else zlog_debug("%s(%s): (%s) failure to create", @@ -1076,7 +1088,6 @@ pim_upstream_keep_alive_timer (struct thread *t) struct pim_upstream *up; up = THREAD_ARG(t); - up->t_ka_timer = NULL; if (I_am_RP (up->sg.grp)) { @@ -1132,7 +1143,6 @@ pim_upstream_msdp_reg_timer(struct thread *t) struct pim_upstream *up; up = THREAD_ARG(t); - up->t_msdp_reg_timer = NULL; /* source is no longer active - pull the SA from MSDP's cache */ pim_msdp_sa_local_del(&up->sg); @@ -1323,8 +1333,6 @@ pim_upstream_register_stop_timer (struct thread *t) struct ip ip_hdr; up = THREAD_ARG (t); - up->t_rs_timer = NULL; - if (PIM_DEBUG_TRACE) { char state_str[PIM_REG_STATE_STR_LEN]; @@ -1384,11 +1392,7 @@ pim_upstream_start_register_stop_timer (struct pim_upstream *up, int null_regist { uint32_t time; - if (up->t_rs_timer) - { - THREAD_TIMER_OFF (up->t_rs_timer); - up->t_rs_timer = NULL; - } + THREAD_TIMER_OFF (up->t_rs_timer); if (!null_register) { @@ -1655,7 +1659,7 @@ pim_upstream_sg_running (void *arg) if (PIM_DEBUG_TRACE) zlog_debug ("source reference created on kat restart %s", up->sg_str); - pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM); + pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM, __PRETTY_FUNCTION__); PIM_UPSTREAM_FLAG_SET_SRC_STREAM(up->flags); pim_upstream_fhr_kat_start(up); } diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index f1c8df35b..acb4b17c7 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -1,30 +1,32 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_UPSTREAM_H #define PIM_UPSTREAM_H #include <zebra.h> #include <prefix.h> +#include "plist.h" #include <pimd/pim_rpf.h> +#include "pim_str.h" +#include "pim_ifchannel.h" #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED (1 << 0) #define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED (1 << 1) @@ -145,7 +147,7 @@ struct pim_upstream *pim_upstream_find_or_add (struct prefix_sg *sg, struct pim_upstream *pim_upstream_add (struct prefix_sg *sg, struct interface *ifp, int flags, const char *name); -void pim_upstream_ref (struct pim_upstream *up, int flags); +void pim_upstream_ref (struct pim_upstream *up, int flags, const char *name); struct pim_upstream *pim_upstream_del(struct pim_upstream *up, const char *name); int pim_upstream_evaluate_join_desired(struct pim_upstream *up); diff --git a/pimd/pim_util.c b/pimd/pim_util.c index 1125db00a..139c0e3fb 100644 --- a/pimd/pim_util.c +++ b/pimd/pim_util.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_util.h b/pimd/pim_util.h index 94635466d..478800520 100644 --- a/pimd/pim_util.h +++ b/pimd/pim_util.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_UTIL_H #define PIM_UTIL_H diff --git a/pimd/pim_version.c b/pimd/pim_version.c index a43c27d5b..1da4b9663 100644 --- a/pimd/pim_version.c +++ b/pimd/pim_version.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/pimd/pim_version.h b/pimd/pim_version.h index 64e07862d..589c6f68a 100644 --- a/pimd/pim_version.h +++ b/pimd/pim_version.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_VERSION_H #define PIM_VERSION_H diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index 2d502d9aa..f87484ad5 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -39,6 +38,7 @@ #include "pim_rp.h" #include "pim_msdp.h" #include "pim_ssm.h" +#include "pim_bfd.h" int pim_debug_config_write (struct vty *vty) @@ -295,7 +295,7 @@ int pim_interface_config_write(struct vty *vty) /* IF ip igmp query-max-response-time */ if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) { - vty_out(vty, " ip igpm query-max-response-time %d%s", + vty_out(vty, " ip igmp query-max-response-time %d%s", pim_ifp->igmp_query_max_response_time_dsec, VTY_NEWLINE); ++writes; @@ -321,6 +321,8 @@ int pim_interface_config_write(struct vty *vty) } vty_out(vty, "!%s", VTY_NEWLINE); ++writes; + /* PIM BFD write */ + pim_bfd_write_config (vty, ifp); } return writes; diff --git a/pimd/pim_vty.h b/pimd/pim_vty.h index 18a632e01..54bab623d 100644 --- a/pimd/pim_vty.h +++ b/pimd/pim_vty.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_VTY_H #define PIM_VTY_H diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 62be3a69d..f2e657d77 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -30,6 +29,7 @@ #include "network.h" #include "vty.h" #include "plist.h" +#include "lib/bfd.h" #include "pimd.h" #include "pim_pim.h" @@ -580,10 +580,6 @@ void pim_scan_oil() static int on_rpf_cache_refresh(struct thread *t) { - zassert(qpim_rpf_cache_refresher); - - qpim_rpf_cache_refresher = 0; - /* update PIM protocol state */ scan_upstream_rpf_cache(); @@ -625,6 +621,9 @@ void sched_rpf_cache_refresh(void) static void pim_zebra_connected (struct zclient *zclient) { + /* Send the client registration */ + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + zclient_send_reg_requests (zclient, VRF_DEFAULT); } diff --git a/pimd/pim_zebra.h b/pimd/pim_zebra.h index 2ed463efa..37024073e 100644 --- a/pimd/pim_zebra.h +++ b/pimd/pim_zebra.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_ZEBRA_H #define PIM_ZEBRA_H diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 16dbb3ef5..e4ca04681 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> #include "zebra/rib.h" @@ -47,7 +46,6 @@ static int zclient_lookup_connect(struct thread *t) struct zclient *zlookup; zlookup = THREAD_ARG(t); - zlookup->t_connect = NULL; if (zlookup->sock >= 0) { return 0; @@ -62,7 +60,6 @@ static int zclient_lookup_connect(struct thread *t) zlookup->fail = 0; /* reset counter on connection */ } - zassert(!zlookup->t_connect); if (zlookup->sock < 0) { /* Since last connect failed, retry within 10 secs */ zclient_lookup_sched(zlookup, 10); @@ -75,8 +72,6 @@ static int zclient_lookup_connect(struct thread *t) /* Schedule connection with delay. */ static void zclient_lookup_sched(struct zclient *zlookup, int delay) { - zassert(!zlookup->t_connect); - thread_add_timer(master, zclient_lookup_connect, zlookup, delay, &zlookup->t_connect); @@ -87,7 +82,6 @@ static void zclient_lookup_sched(struct zclient *zlookup, int delay) /* Schedule connection for now. */ static void zclient_lookup_sched_now(struct zclient *zlookup) { - zassert(!zlookup->t_connect); thread_add_event(master, zclient_lookup_connect, zlookup, 0, &zlookup->t_connect); diff --git a/pimd/pim_zlookup.h b/pimd/pim_zlookup.h index 34b1434c6..08c8768d1 100644 --- a/pimd/pim_zlookup.h +++ b/pimd/pim_zlookup.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIM_ZLOOKUP_H #define PIM_ZLOOKUP_H diff --git a/pimd/pimd.c b/pimd/pimd.c index fc6663776..51a0833cd 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> @@ -28,6 +27,7 @@ #include "plist.h" #include "hash.h" #include "jhash.h" +#include "vrf.h" #include "pimd.h" #include "pim_cmd.h" @@ -141,22 +141,15 @@ pim_vrf_disable (struct vrf *vrf) void pim_vrf_init (void) { - vrf_add_hook (VRF_NEW_HOOK, pim_vrf_new); - vrf_add_hook (VRF_ENABLE_HOOK, pim_vrf_enable); - vrf_add_hook (VRF_DISABLE_HOOK, pim_vrf_disable); - vrf_add_hook (VRF_DELETE_HOOK, pim_vrf_delete); - - vrf_init (); + vrf_init (pim_vrf_new, + pim_vrf_enable, + pim_vrf_disable, + pim_vrf_delete); } static void pim_vrf_terminate (void) { - vrf_add_hook (VRF_NEW_HOOK, NULL); - vrf_add_hook (VRF_ENABLE_HOOK, NULL); - vrf_add_hook (VRF_DISABLE_HOOK, NULL); - vrf_add_hook (VRF_DELETE_HOOK, NULL); - vrf_terminate (); } diff --git a/pimd/pimd.h b/pimd/pimd.h index e10155c20..ec98c5bfd 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 PIMD_H #define PIMD_H diff --git a/pimd/test_igmpv3_join.c b/pimd/test_igmpv3_join.c index 29143f362..f363152ad 100644 --- a/pimd/test_igmpv3_join.c +++ b/pimd/test_igmpv3_join.c @@ -1,22 +1,21 @@ /* - PIM for Quagga - Copyright (C) 2008 Everton da Silva Marques - - 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 -*/ + * PIM for Quagga + * Copyright (C) 2008 Everton da Silva Marques + * + * 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 + */ #include <zebra.h> diff --git a/qpb/linear_allocator.h b/qpb/linear_allocator.h index e3ebbc64f..273bc7369 100644 --- a/qpb/linear_allocator.h +++ b/qpb/linear_allocator.h @@ -17,10 +17,9 @@ * 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. + * 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 */ /* @@ -17,10 +17,9 @@ * 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. + * 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 */ /* @@ -17,10 +17,9 @@ * 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. + * 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 */ /* diff --git a/qpb/qpb_allocator.c b/qpb/qpb_allocator.c index 4b4830a47..ae48d5589 100644 --- a/qpb/qpb_allocator.c +++ b/qpb/qpb_allocator.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include "linear_allocator.h" diff --git a/qpb/qpb_allocator.h b/qpb/qpb_allocator.h index bb7dcf38f..bdf2dc0e7 100644 --- a/qpb/qpb_allocator.h +++ b/qpb/qpb_allocator.h @@ -17,10 +17,9 @@ * 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. + * 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 */ /* diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index fbf2262b8..35d5d9b82 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_debug.h b/ripd/rip_debug.h index 990ec908a..e1dcd2fa7 100644 --- a/ripd/rip_debug.h +++ b/ripd/rip_debug.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIP_DEBUG_H diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 57c49c631..fce5d97dc 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_interface.h b/ripd/rip_interface.h index d9dfbb7cc..9513bafc2 100644 --- a/ripd/rip_interface.h +++ b/ripd/rip_interface.h @@ -12,10 +12,9 @@ * 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. + * 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 _QUAGGA_RIP_INTERFACE_H diff --git a/ripd/rip_main.c b/ripd/rip_main.c index 62ea6dd07..38c287594 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -178,7 +177,7 @@ main (int argc, char **argv) /* Library initialization. */ keychain_init (); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); /* RIP related initialization. */ rip_init (); diff --git a/ripd/rip_memory.c b/ripd/rip_memory.c index d2a958064..662a6cced 100644 --- a/ripd/rip_memory.c +++ b/ripd/rip_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/ripd/rip_memory.h b/ripd/rip_memory.h index 7aec21930..57abedd3a 100644 --- a/ripd/rip_memory.h +++ b/ripd/rip_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_RIP_MEMORY_H diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 5e0e71579..76f3cec66 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 2477740b9..464c3f4dd 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c index baba9592e..3f1495c0f 100644 --- a/ripd/rip_routemap.c +++ b/ripd/rip_routemap.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_snmp.c b/ripd/rip_snmp.c index 06cd3cef6..6a4ae11ae 100644 --- a/ripd/rip_snmp.c +++ b/ripd/rip_snmp.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 578c513c7..3b3fc9494 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/ripd.c b/ripd/ripd.c index 4a42aff78..58c8aed13 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripd/ripd.h b/ripd/ripd.h index aad0c2f11..d52df0d99 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIP_H diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index 16c8b3400..372ab85e6 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripngd/ripng_debug.h b/ripngd/ripng_debug.h index 674345c0b..b4e1455ad 100644 --- a/ripngd/ripng_debug.h +++ b/ripngd/ripng_debug.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIPNG_DEBUG_H diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index a77a7f970..0bd4a0bd1 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -756,16 +755,13 @@ ripng_enable_apply (struct interface *ifp) /* Update running status of the interface. */ if (ri->enable_network || ri->enable_interface) { - { - if (IS_RIPNG_DEBUG_EVENT) - zlog_debug ("RIPng turn on %s", ifp->name); + zlog_info ("RIPng INTERFACE ON %s", ifp->name); - /* Add interface wake up thread. */ - thread_add_timer(master, ripng_interface_wakeup, ifp, 1, - &ri->t_wakeup); + /* Add interface wake up thread. */ + thread_add_timer(master, ripng_interface_wakeup, ifp, 1, + &ri->t_wakeup); - ripng_connect_set (ifp, 1); - } + ripng_connect_set (ifp, 1); } else { @@ -980,7 +976,7 @@ DEFUN (no_ripng_network, "no network IF_OR_ADDR", NO_STR "RIPng enable on specified interface or network.\n" - "Interface or address") + "Interface or address\n") { int idx_if_or_addr = 2; int ret; diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 9d97df5c4..e51781714 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -178,7 +177,7 @@ main (int argc, char **argv) master = frr_init (); /* Library inits. */ - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); /* RIPngd inits. */ ripng_init (); diff --git a/ripngd/ripng_memory.c b/ripngd/ripng_memory.c index 1d2320ee2..60fb1751d 100644 --- a/ripngd/ripng_memory.c +++ b/ripngd/ripng_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/ripngd/ripng_memory.h b/ripngd/ripng_memory.h index 76b830afb..a4102086c 100644 --- a/ripngd/ripng_memory.h +++ b/ripngd/ripng_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_RIPNG_MEMORY_H diff --git a/ripngd/ripng_nexthop.c b/ripngd/ripng_nexthop.c index b966af001..0af636efc 100644 --- a/ripngd/ripng_nexthop.c +++ b/ripngd/ripng_nexthop.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* This file is required in order to support properly the RIPng nexthop diff --git a/ripngd/ripng_nexthop.h b/ripngd/ripng_nexthop.h index 19bd32b50..76873f80e 100644 --- a/ripngd/ripng_nexthop.h +++ b/ripngd/ripng_nexthop.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIPNG_RIPNG_NEXTHOP_H diff --git a/ripngd/ripng_offset.c b/ripngd/ripng_offset.c index dcddf96eb..adb3182a5 100644 --- a/ripngd/ripng_offset.c +++ b/ripngd/ripng_offset.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* RIPng support by Vincent Jardin <vincent.jardin@6wind.com> diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 69af4f214..461ee98bb 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* RIPng support added by Vincent Jardin <vincent.jardin@6wind.com> diff --git a/ripngd/ripng_route.c b/ripngd/ripng_route.c index 8538b07a9..f7d3ef89f 100644 --- a/ripngd/ripng_route.c +++ b/ripngd/ripng_route.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripngd/ripng_route.h b/ripngd/ripng_route.h index 9ff90aa8d..90dae0470 100644 --- a/ripngd/ripng_route.h +++ b/ripngd/ripng_route.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIPNG_ROUTE_H diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index ad8dbc92f..69ff84b22 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 964af81d1..e7f1e9e15 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 399435fb2..f373598be 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -2171,7 +2170,7 @@ DEFUN (clear_ipv6_rip, "clear ipv6 ripng", CLEAR_STR IPV6_STR - "Clear IPv6 RIP database") + "Clear IPv6 RIP database\n") { struct route_node *rp; struct ripng_info *rinfo; @@ -2358,7 +2357,7 @@ DEFUN (no_ripng_aggregate_address, "no aggregate-address X:X::X:X/M", NO_STR "Delete aggregate RIPng route announcement\n" - "Aggregate network") + "Aggregate network\n") { int idx_ipv6_prefixlen = 2; int ret; @@ -2577,7 +2576,7 @@ DEFUN (show_ipv6_protocols, "show ipv6 protocols", SHOW_STR IPV6_STR - "Routing protocol information") + "Routing protocol information\n") { if (! ripng) return CMD_SUCCESS; diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index e40fd17b5..62b7b073f 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIPNG_RIPNGD_H diff --git a/snapcraft/README.snap_build.md b/snapcraft/README.snap_build.md index eeee6a17a..7c4284845 100644 --- a/snapcraft/README.snap_build.md +++ b/snapcraft/README.snap_build.md @@ -94,7 +94,16 @@ All the commands are prefixed with frr. frr.zebra-debug vtysh can be accessed as frr.vtysh (Make sure you have /snap/bin in your -path). If access as `vtysh` instead of `frr.vtysh` is needed, a symlink -can be created: +path). If access as `vtysh` instead of `frr.vtysh` is needed, you can enable it +via a snap alias as follows: - sudo ln -s /snap/bin/frr.vtysh /usr/local/bin/vtysh + sudo snap alias frr vtysh + +This will add the vtysh command to your /snap/bin for direct access. The output of + + sudo snap aliases + +should list vtysh command alias as enabled: + +App Alias Notes +frr.vtysh vtysh enabled diff --git a/snapcraft/README.usage.md b/snapcraft/README.usage.md index 537147303..28d239545 100644 --- a/snapcraft/README.usage.md +++ b/snapcraft/README.usage.md @@ -109,13 +109,17 @@ FAQ `export VTYSH_PAGER=cat` to the end of your `.profile`) - ospfd / ospf6d are not running after installation - - Installing a new snap starts the daemons, but at this time they - may not have the required priviledged access. Make sure you - issue the `snap connect` command as given above (can be verified - with `snap interfaces`) and **THEN** restart the daemons (or - reboot the system). - This is a limitation of any snap package at this time which - requires priviledged interfaces (ie to manipulate routing tables) + - Installing a new snap starts the daemons, but at this time they + may not have the required privileged access. Make sure you + issue the `snap connect` command as given above (can be verified + with `snap interfaces`) and **THEN** restart the daemons (or + reboot the system). + This is a limitation of any snap package at this time which + requires privileged interfaces (ie to manipulate routing tables) + +- Can I run vtysh directly without the "frr." prefix? + - Yes, enable the vtysh alias in the frr snap package by: + sudo snap alias frr vtysh Sourcecode available ==================== diff --git a/snapcraft/snapcraft.yaml.in b/snapcraft/snapcraft.yaml.in index eb6130195..17fabb16f 100644 --- a/snapcraft/snapcraft.yaml.in +++ b/snapcraft/snapcraft.yaml.in @@ -16,6 +16,7 @@ apps: - network - network-bind - network-control + aliases: [vtysh] version: command: bin/show_version readme: diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c index e5ff6a137..2d83fe682 100644 --- a/tests/bgpd/test_aspath.c +++ b/tests/bgpd/test_aspath.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/bgpd/test_capability.c b/tests/bgpd/test_capability.c index c3de6a16e..1e3a5be4e 100644 --- a/tests/bgpd/test_capability.c +++ b/tests/bgpd/test_capability.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> @@ -651,7 +650,7 @@ main (void) qobj_init (); master = thread_master_create (); bgp_master_init (master); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); bgp_option_set (BGP_OPT_NO_LISTEN); if (fileno (stdout) >= 0) diff --git a/tests/bgpd/test_ecommunity.c b/tests/bgpd/test_ecommunity.c index 9174191cb..564d47129 100644 --- a/tests/bgpd/test_ecommunity.c +++ b/tests/bgpd/test_ecommunity.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/bgpd/test_mp_attr.c b/tests/bgpd/test_mp_attr.c index 6824c11fe..e323748e9 100644 --- a/tests/bgpd/test_mp_attr.c +++ b/tests/bgpd/test_mp_attr.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> @@ -751,7 +750,7 @@ main (void) qobj_init (); master = thread_master_create (); bgp_master_init (master); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); bgp_option_set (BGP_OPT_NO_LISTEN); bgp_attr_init (); diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index a2fd66528..affebbafe 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> @@ -380,7 +379,7 @@ global_test_init (void) master = thread_master_create (); zclient = zclient_new(master); bgp_master_init (master); - vrf_init (); + vrf_init (NULL, NULL, NULL, NULL); bgp_option_set (BGP_OPT_NO_LISTEN); if (fileno (stdout) >= 0) diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c index e422c7e62..b0e80fb67 100644 --- a/tests/helpers/c/main.c +++ b/tests/helpers/c/main.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/helpers/c/prng.c b/tests/helpers/c/prng.c index bdcfb07af..4b9fd5715 100644 --- a/tests/helpers/c/prng.c +++ b/tests/helpers/c/prng.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/helpers/c/prng.h b/tests/helpers/c/prng.h index cf0bacc5f..6cc6289a1 100644 --- a/tests/helpers/c/prng.h +++ b/tests/helpers/c/prng.h @@ -17,10 +17,9 @@ * 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. + * 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 _PRNG_H #define _PRNG_H diff --git a/tests/helpers/c/tests.h b/tests/helpers/c/tests.h index a528e55f0..aaf35c27d 100644 --- a/tests/helpers/c/tests.h +++ b/tests/helpers/c/tests.h @@ -16,10 +16,9 @@ * 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. + * 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 _QUAGGA_TESTS_H diff --git a/tests/lib/cli/common_cli.c b/tests/lib/cli/common_cli.c index 56db46043..7825564e5 100644 --- a/tests/lib/cli/common_cli.c +++ b/tests/lib/cli/common_cli.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/cli/common_cli.h b/tests/lib/cli/common_cli.h index 9e7fe9983..9a0ef47c8 100644 --- a/tests/lib/cli/common_cli.h +++ b/tests/lib/cli/common_cli.h @@ -14,10 +14,9 @@ * 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. + * 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 _COMMON_CLI_H diff --git a/tests/lib/cli/test_cli.c b/tests/lib/cli/test_cli.c index 54b34bc79..ba1218120 100644 --- a/tests/lib/cli/test_cli.c +++ b/tests/lib/cli/test_cli.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/cli/test_cli.refout.in b/tests/lib/cli/test_cli.refout.in index 18822c150..db9da429a 100644 --- a/tests/lib/cli/test_cli.refout.in +++ b/tests/lib/cli/test_cli.refout.in @@ -61,7 +61,7 @@ cmd2 with 3 args. [01]: ipv6
[02]: de4d:b33f::cafe
test# arg ipv6 de4d:b3
-% There is no matched command.
+ X:X::X:X 02
test# arg ipv6 de4d:b33f::caf
X:X::X:X 02
test# arg ipv6 de4d:b33f::cafe
@@ -264,7 +264,8 @@ cmd10 with 3 args. test#
test# alt a
test# alt a a
- WORD 02
+ WORD 02
+ X:X::X:X 02
test# alt a ab
cmd11 with 3 args.
[00]: alt
@@ -281,7 +282,8 @@ cmd12 with 3 args. [02]: 1.2.3.4
test# alt a 1
test# alt a 1:2
- WORD 02
+ WORD 02
+ X:X::X:X 02
test# alt a 1:2
test# alt a 1:2::
WORD 02
diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c index 272e3d12b..249a6f760 100644 --- a/tests/lib/cli/test_commands.c +++ b/tests/lib/cli/test_commands.c @@ -21,10 +21,9 @@ * 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. + * 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 */ #define REALLY_NEED_PLAIN_GETOPT 1 diff --git a/tests/lib/test_buffer.c b/tests/lib/test_buffer.c index 67e403580..b9f5fd725 100644 --- a/tests/lib/test_buffer.c +++ b/tests/lib/test_buffer.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_checksum.c b/tests/lib/test_checksum.c index 53ab260e2..267a057cc 100644 --- a/tests/lib/test_checksum.c +++ b/tests/lib/test_checksum.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_heavy.c b/tests/lib/test_heavy.c index 6ba8d9aa6..1ba7b9a20 100644 --- a/tests/lib/test_heavy.c +++ b/tests/lib/test_heavy.c @@ -13,10 +13,9 @@ * 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. + * 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 */ /* This programme shows the effects of 'heavy' long-running functions diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c index 57f0a6070..3b85619d3 100644 --- a/tests/lib/test_heavy_thread.c +++ b/tests/lib/test_heavy_thread.c @@ -13,10 +13,9 @@ * 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. + * 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 */ /* This programme shows the effects of 'heavy' long-running functions diff --git a/tests/lib/test_heavy_wq.c b/tests/lib/test_heavy_wq.c index 97371face..57e206931 100644 --- a/tests/lib/test_heavy_wq.c +++ b/tests/lib/test_heavy_wq.c @@ -11,10 +11,9 @@ * 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. + * 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 */ /* This programme shows the effects of 'heavy' long-running functions diff --git a/tests/lib/test_memory.c b/tests/lib/test_memory.c index 6849b9dce..633ee0d56 100644 --- a/tests/lib/test_memory.c +++ b/tests/lib/test_memory.c @@ -11,10 +11,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_nexthop_iter.c b/tests/lib/test_nexthop_iter.c index 250379329..77515386c 100644 --- a/tests/lib/test_nexthop_iter.c +++ b/tests/lib/test_nexthop_iter.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_privs.c b/tests/lib/test_privs.c index c6ccc28e7..26f3b5f69 100644 --- a/tests/lib/test_privs.c +++ b/tests/lib/test_privs.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_segv.c b/tests/lib/test_segv.c index dfc9d5f48..c43431622 100644 --- a/tests/lib/test_segv.c +++ b/tests/lib/test_segv.c @@ -18,10 +18,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_sig.c b/tests/lib/test_sig.c index 10bce2303..a04c9f420 100644 --- a/tests/lib/test_sig.c +++ b/tests/lib/test_sig.c @@ -11,10 +11,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c index cfc2deb8d..07f60668e 100644 --- a/tests/lib/test_srcdest_table.c +++ b/tests/lib/test_srcdest_table.c @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_stream.c b/tests/lib/test_stream.c index 3ac45eb20..596b73afc 100644 --- a/tests/lib/test_stream.c +++ b/tests/lib/test_stream.c @@ -1,5 +1,5 @@ /* Simple stream test. - * + * * Copyright (C) 2006 Sun Microsystems, Inc. * * This file is part of Quagga. @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_table.c b/tests/lib/test_table.c index 4042e1aaa..8c98bc948 100644 --- a/tests/lib/test_table.c +++ b/tests/lib/test_table.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index b0643b907..10461be1e 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c index da0355f66..b67af19ae 100644 --- a/tests/lib/test_timer_performance.c +++ b/tests/lib/test_timer_performance.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/tests/test_lblmgr.c b/tests/test_lblmgr.c index 4a4aaa001..d830094ba 100644 --- a/tests/test_lblmgr.c +++ b/tests/test_lblmgr.c @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include "lib/stream.h" diff --git a/tools/cocci.h b/tools/cocci.h index 3d877a7b4..50199fa82 100644 --- a/tools/cocci.h +++ b/tools/cocci.h @@ -1,4 +1,5 @@ -/* some of this stuff doesn't seem to parse properly in coccinelle */ +/* some of this stuff doesn't seem to parse properly in coccinelle + */ #define DEFUN(funcname, cmdname, str, help) \ static int funcname \ diff --git a/tools/frr-reload.py b/tools/frr-reload.py index c91392da1..a7a04be63 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -109,9 +109,12 @@ class Config(object): log.info('Loading Config object from file %s', filename) try: - file_output = subprocess.check_output(['/usr/bin/vtysh', '-m', '-f', filename]) + file_output = subprocess.check_output(['/usr/bin/vtysh', '-m', '-f', filename], + stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise VtyshMarkException(str(e)) + ve = VtyshMarkException(e) + ve.output = e.output + raise ve for line in file_output.split('\n'): line = line.strip() @@ -134,9 +137,11 @@ class Config(object): try: config_text = subprocess.check_output( "/usr/bin/vtysh -c 'show run' | /usr/bin/tail -n +4 | /usr/bin/vtysh -m -f -", - shell=True) + shell=True, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise VtyshMarkException(str(e)) + ve = VtyshMarkException(e) + ve.output = e.output + raise ve for line in config_text.split('\n'): line = line.strip() @@ -342,10 +347,12 @@ end # the keywords that we know are single line contexts. bgp in this case # is not the main router bgp block, but enabling multi-instance oneline_ctx_keywords = ("access-list ", + "agentx", "bgp ", "debug ", "dump ", "enable ", + "frr ", "hostname ", "ip ", "ipv6 ", @@ -815,6 +822,14 @@ def compare_context_objects(newconf, running): elif "router bgp" in running_ctx_keys[0] and len(running_ctx_keys) > 1 and delete_bgpd: continue + elif ("router bgp" in running_ctx_keys[0] and + len(running_ctx_keys) > 1 and + running_ctx_keys[1].startswith('address-family')): + # There's no 'no address-family' support and so we have to + # delete each line individually again + for line in running_ctx.lines: + lines_to_del.append((running_ctx_keys, line)) + # Non-global context elif running_ctx_keys and not any("address-family" in key for key in running_ctx_keys): lines_to_del.append((running_ctx_keys, None)) @@ -890,11 +905,15 @@ if __name__ == '__main__': # Verify the new config file is valid if not os.path.isfile(args.filename): - print "Filename %s does not exist" % args.filename + msg = "Filename %s does not exist" % args.filename + print msg + log.error(msg) sys.exit(1) if not os.path.getsize(args.filename): - print "Filename %s is an empty file" % args.filename + msg = "Filename %s is an empty file" % args.filename + print msg + log.error(msg) sys.exit(1) # Verify that 'service integrated-vtysh-config' is configured @@ -911,7 +930,9 @@ if __name__ == '__main__': break if not service_integrated_vtysh_config: - print "'service integrated-vtysh-config' is not configured, this is required for 'service frr reload'" + msg = "'service integrated-vtysh-config' is not configured, this is required for 'service frr reload'" + print msg + log.error(msg) sys.exit(1) if args.debug: @@ -922,6 +943,7 @@ if __name__ == '__main__': # Create a Config object from the config generated by newconf newconf = Config() newconf.load_from_file(args.filename) + reload_ok = True if args.test: @@ -1064,7 +1086,7 @@ if __name__ == '__main__': # 'no ip ospf authentication message-digest 1.1.1.1' in # our example above # - Split that last entry by whitespace and drop the last word - log.warning('Failed to execute %s', ' '.join(cmd)) + log.info('Failed to execute %s', ' '.join(cmd)) last_arg = cmd[-1].split(' ') if len(last_arg) <= 2: @@ -1099,9 +1121,25 @@ if __name__ == '__main__': with open(filename, 'w') as fh: for line in lines_to_configure: fh.write(line + '\n') - subprocess.call(['/usr/bin/vtysh', '-f', filename]) + + output = subprocess.check_output(['/usr/bin/vtysh', '-f', filename]) + + # exit non-zero if we see these errors + for x in ('BGP instance name and AS number mismatch', + 'BGP instance is already running', + '% not a local address'): + for line in output.splitlines(): + if x in line: + msg = "ERROR: %s" % x + log.error(msg) + print msg + reload_ok = False + os.unlink(filename) # Make these changes persistent if args.overwrite or args.filename != '/etc/frr/frr.conf': subprocess.call(['/usr/bin/vtysh', '-c', 'write']) + + if not reload_ok: + sys.exit(1) diff --git a/tools/permutations.c b/tools/permutations.c index 88d146469..fa1817a8e 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include "command.h" @@ -43,9 +42,9 @@ int main (int argc, char *argv[]) cmd->string = strdup(argv[1]); struct graph *graph = graph_new(); - struct cmd_token *token = new_cmd_token (START_TKN, cmd->attr, NULL, NULL); + struct cmd_token *token = cmd_token_new (START_TKN, cmd->attr, NULL, NULL); graph_new_node (graph, token, NULL); - command_parse_format (graph, cmd); + cmd_graph_parse (graph, cmd); permute (vector_slot (graph->nodes, 0)); } diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am index 49b96d1b9..587f72c80 100644 --- a/vtysh/Makefile.am +++ b/vtysh/Makefile.am @@ -47,10 +47,10 @@ if BGPD vtysh_scan += $(top_srcdir)/bgpd/bgp_bfd.c vtysh_scan += $(top_srcdir)/bgpd/bgp_debug.c vtysh_scan += $(top_srcdir)/bgpd/bgp_dump.c -vtysh_scan += $(top_srcdir)/bgpd/bgp_encap.c vtysh_scan += $(top_srcdir)/bgpd/bgp_evpn_vty.c vtysh_scan += $(top_srcdir)/bgpd/bgp_filter.c vtysh_scan += $(top_srcdir)/bgpd/bgp_mplsvpn.c +vtysh_scan += $(top_srcdir)/bgpd/bgp_nexthop.c vtysh_scan += $(top_srcdir)/bgpd/bgp_route.c vtysh_scan += $(top_srcdir)/bgpd/bgp_routemap.c vtysh_scan += $(top_srcdir)/bgpd/bgp_vty.c diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 6e0aec2ed..137ce1182 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -108,12 +107,9 @@ begins_with(const char *str, const char *prefix) return strncmp(str, prefix, lenprefix) == 0; } -/* NB: multiplexed function: - * if fp == NULL, this calls vtysh_config_parse_line - * if fp != NULL, this prints lines to fp - */ static int -vtysh_client_run (struct vtysh_client *vclient, const char *line, FILE *fp) +vtysh_client_run (struct vtysh_client *vclient, const char *line, FILE *fp, + void (*callback)(void *, const char *), void *cbarg) { int ret; char stackbuf[4096]; @@ -179,8 +175,8 @@ vtysh_client_run (struct vtysh_client *vclient, const char *line, FILE *fp) fputs (buf, fp); fputc ('\n', fp); } - else - vtysh_config_parse_line (buf); + if (callback) + callback(cbarg, buf); if (eol == end) /* \n\0\0\0 */ @@ -224,14 +220,15 @@ out: static int vtysh_client_run_all (struct vtysh_client *head_client, const char *line, - int continue_on_err, FILE *fp) + int continue_on_err, FILE *fp, + void (*callback)(void *, const char *), void *cbarg) { struct vtysh_client *client; int rc, rc_all = CMD_SUCCESS; for (client = head_client; client; client = client->next) { - rc = vtysh_client_run(client, line, fp); + rc = vtysh_client_run(client, line, fp, callback, cbarg); if (rc != CMD_SUCCESS) { if (!continue_on_err) @@ -246,13 +243,13 @@ static int vtysh_client_execute (struct vtysh_client *head_client, const char *line, FILE *fp) { - return vtysh_client_run_all (head_client, line, 0, fp); + return vtysh_client_run_all (head_client, line, 0, fp, NULL, NULL); } static void vtysh_client_config (struct vtysh_client *head_client, char *line) { - vtysh_client_run_all (head_client, line, 1, NULL); + vtysh_client_run_all (head_client, line, 1, NULL, vtysh_config_parse_line, NULL); } void @@ -308,7 +305,6 @@ vtysh_execute_func (const char *line, int pager) if (ret == CMD_SUCCESS || ret == CMD_SUCCESS_DAEMON || ret == CMD_WARNING) { if ((saved_node == BGP_VPNV4_NODE || saved_node == BGP_VPNV6_NODE - || saved_node == BGP_ENCAP_NODE || saved_node == BGP_ENCAPV6_NODE || saved_node == BGP_IPV4_NODE || saved_node == BGP_IPV6_NODE || saved_node == BGP_IPV4M_NODE || saved_node == BGP_IPV4L_NODE || saved_node == BGP_IPV6L_NODE @@ -327,7 +323,11 @@ vtysh_execute_func (const char *line, int pager) { vtysh_execute("exit-vnc"); } - else if ((saved_node == KEYCHAIN_KEY_NODE) && (tried == 1)) + else if ((saved_node == KEYCHAIN_KEY_NODE + || saved_node == LDP_PSEUDOWIRE_NODE + || saved_node == LDP_IPV4_IFACE_NODE + || saved_node == LDP_IPV6_IFACE_NODE) + && (tried == 1)) { vtysh_execute("exit"); } @@ -645,7 +645,7 @@ vtysh_mark_file (const char *filename) } } /* This is the end */ - fprintf(stdout, "end\n"); + fprintf(stdout, "\nend\n"); vty_close(vty); XFREE(MTYPE_VTYSH_CMD, vty_buf_copy); @@ -797,6 +797,27 @@ vtysh_rl_describe (void) width, token->text, token->desc); + + if (IS_VARYING_TOKEN(token->type)) + { + const char *ref = vector_slot(vline, vector_active(vline) - 1); + + vector varcomps = vector_init (VECTOR_MIN_SIZE); + cmd_variable_complete (token, ref, varcomps); + + if (vector_active (varcomps) > 0) + { + fprintf(stdout, " "); + for (size_t j = 0; j < vector_active (varcomps); j++) + { + char *item = vector_slot (varcomps, j); + fprintf (stdout, " %s", item); + XFREE (MTYPE_COMPLETION, item); + } + vty_out (vty, "%s", VTY_NEWLINE); + } + vector_free (varcomps); + } } cmd_free_strvec (vline); @@ -839,6 +860,7 @@ command_generator (const char *text, int state) } if (matched && matched[index]) + /* this is free()'d by readline, but we leak 1 count of MTYPE_COMPLETION */ return matched[index++]; XFREE (MTYPE_TMP, matched); @@ -926,18 +948,6 @@ static struct cmd_node bgp_vpnv6_node = "%s(config-router-af)# " }; -static struct cmd_node bgp_encap_node = -{ - BGP_ENCAP_NODE, - "%s(config-router-af)# " -}; - -static struct cmd_node bgp_encapv6_node = -{ - BGP_ENCAPV6_NODE, - "%s(config-router-af)# " -}; - static struct cmd_node bgp_ipv4_node = { BGP_IPV4_NODE, @@ -1161,31 +1171,6 @@ DEFUNSH (VTYSH_BGPD, } DEFUNSH (VTYSH_BGPD, - address_family_encapv4, - address_family_encapv4_cmd, - "address-family [ipv4] <encap|encapv4>", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAP_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, - address_family_encapv6, - address_family_encapv6_cmd, - "address-family [ipv6] encapv6", - "Enter Address Family command mode\n" - "Address Family\n" - "Address Family\n") -{ - vty->node = BGP_ENCAPV6_NODE; - return CMD_SUCCESS; -} - -DEFUNSH (VTYSH_BGPD, address_family_ipv4, address_family_ipv4_cmd, "address-family ipv4 [unicast]", @@ -1366,22 +1351,22 @@ DEFUNSH (VTYSH_RIPD, } DEFUNSH (VTYSH_RIPD, - router_rip, - router_rip_cmd, - "router rip", - ROUTER_STR - "RIP") + router_rip, + router_rip_cmd, + "router rip", + ROUTER_STR + "RIP\n") { vty->node = RIP_NODE; return CMD_SUCCESS; } DEFUNSH (VTYSH_RIPNGD, - router_ripng, - router_ripng_cmd, - "router ripng", - ROUTER_STR - "RIPng") + router_ripng, + router_ripng_cmd, + "router ripng", + ROUTER_STR + "RIPng\n") { vty->node = RIPNG_NODE; return CMD_SUCCESS; @@ -1620,8 +1605,6 @@ vtysh_exit (struct vty *vty) break; case BGP_VPNV4_NODE: case BGP_VPNV6_NODE: - case BGP_ENCAP_NODE: - case BGP_ENCAPV6_NODE: case BGP_IPV4_NODE: case BGP_IPV4M_NODE: case BGP_IPV4L_NODE: @@ -1689,8 +1672,6 @@ DEFUNSH (VTYSH_BGPD, || vty->node == BGP_IPV4L_NODE || vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE - || vty->node == BGP_ENCAP_NODE - || vty->node == BGP_ENCAPV6_NODE || vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6L_NODE || vty->node == BGP_IPV6M_NODE) @@ -3230,6 +3211,40 @@ vtysh_prompt (void) return buf; } +static void vtysh_ac_line(void *arg, const char *line) +{ + vector comps = arg; + size_t i; + for (i = 0; i < vector_active(comps); i++) + if (!strcmp(line, (char *)vector_slot(comps, i))) + return; + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, line)); +} + +static void vtysh_autocomplete(vector comps, struct cmd_token *token) +{ + char accmd[256]; + size_t i; + + snprintf(accmd, sizeof(accmd), "autocomplete %d %s %s", token->type, + token->text, token->varname ? token->varname : "-"); + + for (i = 0; i < array_size(vtysh_client); i++) + vtysh_client_run_all (&vtysh_client[i], accmd, 1, NULL, + vtysh_ac_line, comps); +} + +static const struct cmd_variable_handler vtysh_var_handler[] = { + { + /* match all */ + .tokenname = NULL, + .varname = NULL, + .completions = vtysh_autocomplete + }, { + .completions = NULL + } +}; + void vtysh_init_vty (void) { @@ -3240,6 +3255,7 @@ vtysh_init_vty (void) /* Initialize commands. */ cmd_init (0); + cmd_variable_handler_register(vtysh_var_handler); /* Install nodes. */ install_node (&bgp_node, NULL); @@ -3252,8 +3268,6 @@ vtysh_init_vty (void) install_node (&zebra_node, NULL); install_node (&bgp_vpnv4_node, NULL); install_node (&bgp_vpnv6_node, NULL); - install_node (&bgp_encap_node, NULL); - install_node (&bgp_encapv6_node, NULL); install_node (&bgp_ipv4_node, NULL); install_node (&bgp_ipv4m_node, NULL); install_node (&bgp_ipv4l_node, NULL); @@ -3294,8 +3308,6 @@ vtysh_init_vty (void) vtysh_install_default (ZEBRA_NODE); vtysh_install_default (BGP_VPNV4_NODE); vtysh_install_default (BGP_VPNV6_NODE); - vtysh_install_default (BGP_ENCAP_NODE); - vtysh_install_default (BGP_ENCAPV6_NODE); vtysh_install_default (BGP_IPV4_NODE); vtysh_install_default (BGP_IPV4M_NODE); vtysh_install_default (BGP_IPV4L_NODE); @@ -3369,10 +3381,6 @@ vtysh_init_vty (void) install_element (BGP_VPNV4_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_VPNV6_NODE, &vtysh_exit_bgpd_cmd); install_element (BGP_VPNV6_NODE, &vtysh_quit_bgpd_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_exit_bgpd_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_quit_bgpd_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_exit_bgpd_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_IPV4_NODE, &vtysh_exit_bgpd_cmd); install_element (BGP_IPV4_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_IPV4M_NODE, &vtysh_exit_bgpd_cmd); @@ -3429,8 +3437,6 @@ vtysh_init_vty (void) install_element (BGP_IPV4L_NODE, &vtysh_end_all_cmd); install_element (BGP_VPNV4_NODE, &vtysh_end_all_cmd); install_element (BGP_VPNV6_NODE, &vtysh_end_all_cmd); - install_element (BGP_ENCAP_NODE, &vtysh_end_all_cmd); - install_element (BGP_ENCAPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6M_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6L_NODE, &vtysh_end_all_cmd); @@ -3483,8 +3489,6 @@ vtysh_init_vty (void) install_element (CONFIG_NODE, &router_bgp_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); - install_element (BGP_NODE, &address_family_encapv4_cmd); - install_element (BGP_NODE, &address_family_encapv6_cmd); #if defined(ENABLE_BGP_VNC) install_element (BGP_NODE, &vnc_vrf_policy_cmd); install_element (BGP_NODE, &vnc_defaults_cmd); @@ -3502,8 +3506,6 @@ vtysh_init_vty (void) install_element (BGP_NODE, &address_family_evpn_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); - install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); install_element (BGP_IPV4_NODE, &exit_address_family_cmd); install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); install_element (BGP_IPV4L_NODE, &exit_address_family_cmd); diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index b5f42bdaa..71a0d876f 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 VTYSH_H @@ -86,7 +85,7 @@ int vtysh_mark_file(const char *filename); int vtysh_read_config (const char *); int vtysh_write_config_integrated (void); -void vtysh_config_parse_line (const char *); +void vtysh_config_parse_line (void *, const char *); void vtysh_config_dump (FILE *); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index a51d42415..7ca74da10 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -1,22 +1,22 @@ /* Configuration generator. - Copyright (C) 2000 Kunihiro Ishiguro - -This file is part of GNU Zebra. - -GNU Zebra 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. - -GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free -Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + * Copyright (C) 2000 Kunihiro Ishiguro + * + * This file is part of GNU Zebra. + * + * GNU Zebra 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. + * + * GNU Zebra 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 + */ #include <zebra.h> @@ -145,7 +145,7 @@ config_add_line_uniq (struct list *config, const char *line) } void -vtysh_config_parse_line (const char *line) +vtysh_config_parse_line (void *arg, const char *line) { char c; static struct config *config = NULL; @@ -420,12 +420,12 @@ vtysh_config_write () if (host.name) { sprintf (line, "hostname %s", host.name); - vtysh_config_parse_line(line); + vtysh_config_parse_line(NULL, line); } if (vtysh_write_integrated == WRITE_INTEGRATED_NO) - vtysh_config_parse_line ("no service integrated-vtysh-config"); + vtysh_config_parse_line (NULL, "no service integrated-vtysh-config"); if (vtysh_write_integrated == WRITE_INTEGRATED_YES) - vtysh_config_parse_line ("service integrated-vtysh-config"); + vtysh_config_parse_line (NULL, "service integrated-vtysh-config"); user_config_write (); } diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index bf62850e2..d2ac56c36 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index cce797c93..97720e9fd 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/vtysh/vtysh_user.h b/vtysh/vtysh_user.h index 16fcdd03a..9d8f4ae62 100644 --- a/vtysh/vtysh_user.h +++ b/vtysh/vtysh_user.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _VTYSH_USER_H diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 4097cb4d6..0b19a2ad2 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -1,21 +1,21 @@ /* - Monitor status of frr daemons and restart if necessary. - - Copyright (C) 2004 Andrew J. Schorr - - 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Monitor status of frr daemons and restart if necessary. + * + * Copyright (C) 2004 Andrew J. Schorr + * + * 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 */ #include <zebra.h> diff --git a/watchfrr/watchfrr.h b/watchfrr/watchfrr.h index 719ad4dfd..e7aba643d 100644 --- a/watchfrr/watchfrr.h +++ b/watchfrr/watchfrr.h @@ -1,21 +1,21 @@ /* - Common definitions for watchfrr API socket. - - Copyright (C) 2016 David Lamparter for NetDEF, Inc. - - 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Common definitions for watchfrr API socket. + * + * Copyright (C) 2016 David Lamparter for NetDEF, Inc. + * + * 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_WATCHFRR_H diff --git a/watchfrr/watchfrr_vty.c b/watchfrr/watchfrr_vty.c index 64af7d7f4..3501dd57e 100644 --- a/watchfrr/watchfrr_vty.c +++ b/watchfrr/watchfrr_vty.c @@ -1,21 +1,21 @@ /* - watchfrr CLI functions. - - Copyright (C) 2016 David Lamparter for NetDEF, Inc. - - 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; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * watchfrr CLI functions. + * + * Copyright (C) 2016 David Lamparter for NetDEF, Inc. + * + * 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 */ #include <zebra.h> diff --git a/zebra/Makefile.am b/zebra/Makefile.am index 6c5e06906..3e0de3b46 100644 --- a/zebra/Makefile.am +++ b/zebra/Makefile.am @@ -31,7 +31,7 @@ zebra_SOURCES = \ redistribute.c debug.c rtadv.c zebra_vty.c \ irdp_main.c irdp_interface.c irdp_packet.c router-id.c \ zebra_ptm.c zebra_rnh.c zebra_ptm_redistribute.c \ - zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls_vty.c \ + zebra_ns.c zebra_vrf.c zebra_static.c zebra_mpls.c zebra_mpls_vty.c \ zebra_mroute.c \ label_manager.c \ # end @@ -40,7 +40,7 @@ testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \ zebra_vty.c zebra_ptm.c zebra_routemap.c zebra_ns.c zebra_vrf.c \ kernel_null.c redistribute_null.c ioctl_null.c misc_null.c zebra_rnh_null.c \ zebra_ptm_null.c rtadv_null.c if_null.c zserv_null.c zebra_static.c \ - zebra_memory.c zebra_mpls_vty.c zebra_mpls_null.c + zebra_memory.c zebra_mpls.c zebra_mpls_vty.c zebra_mpls_null.c noinst_HEADERS = \ zebra_memory.h \ @@ -88,7 +88,7 @@ EXTRA_DIST = if_ioctl.c if_ioctl_solaris.c if_netlink.c \ rt_socket.c rtread_netlink.c rtread_sysctl.c \ rtread_getmsg.c kernel_socket.c kernel_netlink.c \ ioctl.c ioctl_solaris.c \ - zebra_mpls_netlink.c zebra_mpls_openbsd.c zebra_mpls.c \ + zebra_mpls_netlink.c zebra_mpls_openbsd.c \ GNOME-SMI GNOME-PRODUCT-ZEBRA-MIB client : client_main.o ../lib/libfrr.la diff --git a/zebra/client_main.c b/zebra/client_main.c index 178184d46..c9d738bb0 100644 --- a/zebra/client_main.c +++ b/zebra/client_main.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -116,6 +115,7 @@ struct zebra_info { "ospf6", ZEBRA_ROUTE_OSPF6 }, { "bgp", ZEBRA_ROUTE_BGP }, { "nhrp", ZEBRA_ROUTE_NHRP }, + { "pim", ZEBRA_ROUTE_PIM }, { NULL, 0 } }; diff --git a/zebra/connected.c b/zebra/connected.c index 0ceaddc8e..4d8fe9f6d 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/connected.h b/zebra/connected.h index bdcf6085e..3e3734685 100644 --- a/zebra/connected.h +++ b/zebra/connected.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_CONNECTED_H diff --git a/zebra/debug.c b/zebra/debug.c index cb1ed359a..98770371d 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/debug.h b/zebra/debug.h index f8ebf3d61..0a50da817 100644 --- a/zebra/debug.h +++ b/zebra/debug.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_DEBUG_H diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 5333f0331..73da04965 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index dbc410991..08af2aa35 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 006fcf16f..edfb564a6 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -38,6 +37,7 @@ #include "privs.h" #include "nexthop.h" #include "vrf.h" +#include "vrf_int.h" #include "mpls.h" #include "vty.h" diff --git a/zebra/if_netlink.h b/zebra/if_netlink.h index 6fa39ccab..0c1b488fb 100644 --- a/zebra/if_netlink.h +++ b/zebra/if_netlink.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_IF_NETLINK_H diff --git a/zebra/if_null.c b/zebra/if_null.c index 2ccea56c8..7cba0a4ee 100644 --- a/zebra/if_null.c +++ b/zebra/if_null.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c index c62d9926a..dbf5abd12 100644 --- a/zebra/if_sysctl.c +++ b/zebra/if_sysctl.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/interface.c b/zebra/interface.c index 42e7c7bb1..c60cb8dcb 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -710,6 +709,10 @@ if_delete_update (struct interface *ifp) interface deletion message. */ ifp->ifindex = IFINDEX_INTERNAL; ifp->node = NULL; + + /* if the ifp is in a vrf, move it to default so vrf can be deleted if desired */ + if (ifp->vrf_id) + if_handle_vrf_change (ifp, VRF_DEFAULT); } /* VRF change for an interface */ @@ -771,6 +774,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp, struct in6_addr *address, int add) { + struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id); char buf[16] = "169.254.0.1"; struct in_addr ipv4_ll; char mac[6]; @@ -779,6 +783,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp, ipv6_ll_address_to_mac(address, (u_char *)mac); kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6); + zvrf->neigh_updates++; } static void diff --git a/zebra/interface.h b/zebra/interface.h index 9f108760d..b276edc35 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_INTERFACE_H diff --git a/zebra/ioctl.c b/zebra/ioctl.c index dfd69300f..25aeea18f 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/ioctl.h b/zebra/ioctl.h index 9e3fd5b3f..b11a90f19 100644 --- a/zebra/ioctl.h +++ b/zebra/ioctl.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_IOCTL_H diff --git a/zebra/ioctl_null.c b/zebra/ioctl_null.c index c2060e90a..9cc2daedb 100644 --- a/zebra/ioctl_null.c +++ b/zebra/ioctl_null.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index 78796a8a2..4bdbdaa58 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/ioctl_solaris.h b/zebra/ioctl_solaris.h index 188986be1..dbf93bdca 100644 --- a/zebra/ioctl_solaris.h +++ b/zebra/ioctl_solaris.h @@ -14,10 +14,9 @@ * 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. + * 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 _ZEBRA_IF_IOCTL_SOLARIS_H diff --git a/zebra/ipforward.h b/zebra/ipforward.h index a75073cb3..5401ed08a 100644 --- a/zebra/ipforward.h +++ b/zebra/ipforward.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_IPFORWARD_H diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index 910fd61d0..200c50c0a 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c index 8eccfe133..09f145e81 100644 --- a/zebra/ipforward_solaris.c +++ b/zebra/ipforward_solaris.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index 28894f4e0..a381eb2d7 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/irdp.h b/zebra/irdp.h index 9ce55e587..975e378b7 100644 --- a/zebra/irdp.h +++ b/zebra/irdp.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 21f8beadf..d3c471e75 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 5c17570f0..8e4ebfda6 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 269d4c044..20982b31a 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 27beaf0c8..e23801169 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -818,6 +817,8 @@ kernel_init (struct zebra_ns *zns) thread_add_read(zebrad.master, kernel_read, zns, zns->netlink.sock, &zns->t_netlink); } + + rt_netlink_init (); } void diff --git a/zebra/kernel_netlink.h b/zebra/kernel_netlink.h index adbcf71f6..36ab5c325 100644 --- a/zebra/kernel_netlink.h +++ b/zebra/kernel_netlink.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_KERNEL_NETLINK_H diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c index fea79ffe8..ad96ce41c 100644 --- a/zebra/kernel_null.c +++ b/zebra/kernel_null.c @@ -1,6 +1,5 @@ -/* NULL kernel methods for testing. */ - -/* +/* + * NULL kernel methods for testing. * Copyright (C) 2006 Sun Microsystems, Inc. * * This file is part of Quagga. @@ -15,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 0e15153e1..25c11e578 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/kernel_socket.h b/zebra/kernel_socket.h index 04e305431..26cd6127f 100644 --- a/zebra/kernel_socket.h +++ b/zebra/kernel_socket.h @@ -14,10 +14,9 @@ * 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. + * 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 __ZEBRA_KERNEL_SOCKET_H diff --git a/zebra/label_manager.c b/zebra/label_manager.c index e60f7a4a6..fbe4cea46 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <stdio.h> @@ -56,6 +55,80 @@ static void delete_label_chunk(void *val) XFREE(MTYPE_LM_CHUNK, val); } +static int relay_response_back(struct zserv *zserv) +{ + int ret = 0; + struct stream *src, *dst; + u_int16_t size = 0; + u_char marker; + u_char version; + vrf_id_t vrf_id; + u_int16_t resp_cmd; + + src = zclient->ibuf; + dst = zserv->obuf; + + stream_reset(src); + + ret = zclient_read_header(src, zclient->sock, &size, &marker, &version, + &vrf_id, &resp_cmd); + if (ret < 0 && errno != EAGAIN) { + zlog_err("%s: Error reading Label Manager response: %s", __func__, + strerror(errno)); + return -1; + } + zlog_debug("%s: Label Manager response received, %d bytes", __func__, + size); + if (size == 0) + return -1; + + /* send response back */ + stream_copy(dst, src); + ret = writen(zserv->sock, dst->data, stream_get_endp(dst)); + if (ret <= 0) { + zlog_err("%s: Error sending Label Manager response back: %s", + __func__, strerror(errno)); + return -1; + } + zlog_debug("%s: Label Manager response (%d bytes) sent back", __func__, + ret); + + return 0; +} + +static int lm_zclient_read(struct thread *t) +{ + struct zserv *zserv; + int ret; + + /* Get socket to zebra. */ + zserv = THREAD_ARG(t); + zclient->t_read = NULL; + + /* read response and send it back */ + ret = relay_response_back(zserv); + + return ret; +} + +static int reply_error (int cmd, struct zserv *zserv, vrf_id_t vrf_id) +{ + struct stream *s; + + s = zserv->obuf; + stream_reset (s); + + zserv_create_header (s, cmd, vrf_id); + + /* result */ + stream_putc (s, 1); + + /* Write packet size. */ + stream_putw_at (s, 0, stream_get_endp (s)); + + return writen (zserv->sock, s->data, stream_get_endp (s)); + +} /** * Receive a request to get or release a label chunk and forward it to external * label manager. @@ -64,19 +137,25 @@ static void delete_label_chunk(void *val) * proxy. * * @param cmd Type of request (connect, get or release) - * @param src Input buffer from zserv + * @param zserv * @return 0 on success, -1 otherwise */ -int zread_relay_label_manager_request(int cmd, struct zserv *zserv) +int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id) { struct stream *src, *dst; - int ret; + int ret = 0; if (zclient->sock < 0) { zlog_err("%s: Error relaying label chunk request: no zclient socket", __func__); + reply_error (cmd, zserv, vrf_id); return -1; } + + /* in case there's any incoming message enqueued, read and forward it */ + while (ret == 0) + ret = relay_response_back(zserv); + /* Send request to external label manager */ src = zserv->ibuf; dst = zclient->obuf; @@ -87,6 +166,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv) if (ret <= 0) { zlog_err("%s: Error relaying label chunk request: %s", __func__, strerror(errno)); + reply_error (cmd, zserv, vrf_id); return -1; } zlog_debug("%s: Label chunk request relayed. %d bytes sent", __func__, @@ -96,43 +176,15 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv) if (cmd == ZEBRA_RELEASE_LABEL_CHUNK) return 0; - /* read response */ - src = zclient->ibuf; - dst = zserv->obuf; - - stream_reset(src); - - u_int16_t size; - u_char marker; - u_char version; - vrf_id_t vrf_id; - u_int16_t resp_cmd; - ret = zclient_read_header(src, zclient->sock, &size, &marker, &version, - &vrf_id, &resp_cmd); - if (ret < 0) { - zlog_err("%s: Error reading label chunk response: %s", __func__, - strerror(errno)); - return -1; - } - zlog_debug("%s: Label chunk response received, %d bytes", __func__, - size); - - /* send response back */ - stream_copy(dst, src); - stream_copy(zserv->obuf, zclient->ibuf); - ret = writen(zserv->sock, dst->data, stream_get_endp(dst)); - if (ret <= 0) { - zlog_err("%s: Error sending label chunk response back: %s", - __func__, strerror(errno)); - return -1; - } - zlog_debug("%s: Label chunk response (%d bytes) sent back", __func__, - ret); + /* make sure we listen to the response */ + if (!zclient->t_read) + thread_add_read(zclient->master, lm_zclient_read, zserv, + zclient->sock, &zclient->t_read); return 0; } -static int zclient_connect(struct thread *t) +static int lm_zclient_connect(struct thread *t) { zclient->t_connect = NULL; @@ -141,11 +193,15 @@ static int zclient_connect(struct thread *t) if (zclient_socket_connect(zclient) < 0) { zlog_err("Error connecting synchronous zclient!"); - thread_add_timer(zebrad.master, zclient_connect, zclient, + thread_add_timer(zebrad.master, lm_zclient_connect, zclient, CONNECTION_DELAY, &zclient->t_connect); return -1; } + /* make socket non-blocking */ + if (set_nonblocking(zclient->sock) < 0) + zlog_warn("%s: set_nonblocking(%d) failed", __func__, zclient->sock); + return 0; } @@ -164,7 +220,7 @@ static void lm_zclient_init(char *lm_zserv_path) zclient = zclient_new(zebrad.master); zclient->sock = -1; zclient->t_connect = NULL; - zclient_connect (NULL); + lm_zclient_connect(NULL); } /** diff --git a/zebra/label_manager.h b/zebra/label_manager.h index 0c6a5ebc7..b7d6118a0 100644 --- a/zebra/label_manager.h +++ b/zebra/label_manager.h @@ -16,10 +16,9 @@ * 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 FRR; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _LABEL_MANAGER_H @@ -62,7 +61,7 @@ struct label_manager { bool lm_is_external; -int zread_relay_label_manager_request(int cmd, struct zserv *zserv); +int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id); void label_manager_init(char *lm_zserv_path); struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance, u_char keep, uint32_t size); diff --git a/zebra/main.c b/zebra/main.c index 459e6148d..b136f8ae9 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/misc_null.c b/zebra/misc_null.c index 49cb92bd7..b125becdc 100644 --- a/zebra/misc_null.c +++ b/zebra/misc_null.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 23cce0a1b..1493bd9cb 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -107,45 +106,41 @@ zebra_redistribute_default (struct zserv *client, vrf_id_t vrf_id) /* Redistribute routes. */ static void -zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id) +zebra_redistribute (struct zserv *client, int type, u_short instance, vrf_id_t vrf_id, int afi) { struct rib *newrib; struct route_table *table; struct route_node *rn; - int afi; - for (afi = AFI_IP; afi <= AFI_IP6; afi++) - { - table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id); - if (! table) - continue; + table = zebra_vrf_table (afi, SAFI_UNICAST, vrf_id); + if (! table) + return; - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, newrib) - { - struct prefix *dst_p, *src_p; - srcdest_rnode_prefixes(rn, &dst_p, &src_p); - - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, " - "zebra_check_addr=%d", __func__, - CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED), - newrib->type, newrib->distance, - zebra_check_addr (dst_p)); - - if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED)) - continue; - if ((type != ZEBRA_ROUTE_ALL && - (newrib->type != type || newrib->instance != instance))) - continue; - if (newrib->distance == DISTANCE_INFINITY) - continue; - if (! zebra_check_addr (dst_p)) - continue; - - zsend_redistribute_route (1, client, dst_p, src_p, newrib); - } - } + for (rn = route_top (table); rn; rn = route_next (rn)) + RNODE_FOREACH_RIB (rn, newrib) + { + struct prefix *dst_p, *src_p; + srcdest_rnode_prefixes(rn, &dst_p, &src_p); + + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("%s: checking: selected=%d, type=%d, distance=%d, " + "zebra_check_addr=%d", __func__, + CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED), + newrib->type, newrib->distance, + zebra_check_addr (dst_p)); + + if (! CHECK_FLAG (newrib->flags, ZEBRA_FLAG_SELECTED)) + continue; + if ((type != ZEBRA_ROUTE_ALL && + (newrib->type != type || newrib->instance != instance))) + continue; + if (newrib->distance == DISTANCE_INFINITY) + continue; + if (! zebra_check_addr (dst_p)) + continue; + + zsend_redistribute_route (1, client, dst_p, src_p, newrib); + } } /* Either advertise a route for redistribution to registered clients or */ @@ -265,13 +260,13 @@ zebra_redistribute_add (int command, struct zserv *client, int length, if (! redist_check_instance (&client->mi_redist[afi][type], instance)) { redist_add_instance (&client->mi_redist[afi][type], instance); - zebra_redistribute (client, type, instance, zvrf_id (zvrf)); + zebra_redistribute (client, type, instance, zvrf_id (zvrf), afi); } } else { if (! vrf_bitmap_check (client->redist[afi][type], zvrf_id (zvrf))) { vrf_bitmap_set (client->redist[afi][type], zvrf_id (zvrf)); - zebra_redistribute (client, type, 0, zvrf_id (zvrf)); + zebra_redistribute (client, type, 0, zvrf_id (zvrf), afi); } } } diff --git a/zebra/redistribute.h b/zebra/redistribute.h index 06afc726d..8a7857498 100644 --- a/zebra/redistribute.h +++ b/zebra/redistribute.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_REDISTRIBUTE_H diff --git a/zebra/redistribute_null.c b/zebra/redistribute_null.c index ffde8ed77..7f40c2178 100644 --- a/zebra/redistribute_null.c +++ b/zebra/redistribute_null.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/rib.h b/zebra/rib.h index 8f6cff0d8..7bcbf56bd 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RIB_H diff --git a/zebra/router-id.c b/zebra/router-id.c index b1e786d0c..318986c1b 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/router-id.h b/zebra/router-id.h index 46d300eea..6b15159fd 100644 --- a/zebra/router-id.h +++ b/zebra/router-id.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ROUTER_ID_H_ diff --git a/zebra/rt.h b/zebra/rt.h index 75d234ce8..5f2441a9c 100644 --- a/zebra/rt.h +++ b/zebra/rt.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RT_H diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 77f03a2c6..f22f4acb0 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -103,6 +102,21 @@ struct gw_family_t union g_addr gate; }; +char ipv4_ll_buf[16] = "169.254.0.1"; +struct in_addr ipv4_ll; + +/* + * The ipv4_ll data structure is used for all 5549 + * additions to the kernel. Let's figure out the + * correct value one time instead for every + * install/remove of a 5549 type route + */ +void +rt_netlink_init (void) +{ + inet_pton (AF_INET, ipv4_ll_buf, &ipv4_ll); +} + static inline int is_selfroute(int proto) { if ((proto == RTPROT_BGP) || (proto == RTPROT_OSPF) || @@ -675,32 +689,12 @@ _netlink_route_build_singlepath( mpls_lse_t out_lse[MPLS_MAX_LABELS]; char label_buf[100]; - if (rtmsg->rtm_family == AF_INET && - (nexthop->type == NEXTHOP_TYPE_IPV6 - || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) - { - char buf[16] = "169.254.0.1"; - struct in_addr ipv4_ll; - - inet_pton (AF_INET, buf, &ipv4_ll); - rtmsg->rtm_flags |= RTNH_F_ONLINK; - addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4); - addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex); - - if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE)) - addattr_l (nlmsg, req_size, RTA_PREFSRC, - &nexthop->rmap_src.ipv4, bytelen); - else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE)) - addattr_l (nlmsg, req_size, RTA_PREFSRC, - &nexthop->src.ipv4, bytelen); - - if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): " - "nexthop via %s if %u", - routedesc, buf, nexthop->ifindex); - return; - } - + /* + * label_buf is *only* currently used within debugging. + * As such when we assign it we are guarding it inside + * a debug test. If you want to change this make sure + * you fix this assumption + */ label_buf[0] = '\0'; /* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP * (in the case of LER) @@ -724,13 +718,16 @@ _netlink_route_build_singlepath( { bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0); out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos); - if (!num_labels) - sprintf (label_buf, "label %d", nh_label->label[i]); - else - { - sprintf (label_buf1, "/%d", nh_label->label[i]); - strcat (label_buf, label_buf1); - } + if (IS_ZEBRA_DEBUG_KERNEL) + { + if (!num_labels) + sprintf (label_buf, "label %d", nh_label->label[i]); + else + { + sprintf (label_buf1, "/%d", nh_label->label[i]); + strcat (label_buf, label_buf1); + } + } num_labels++; } } @@ -757,6 +754,28 @@ _netlink_route_build_singlepath( if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) rtmsg->rtm_flags |= RTNH_F_ONLINK; + if (rtmsg->rtm_family == AF_INET && + (nexthop->type == NEXTHOP_TYPE_IPV6 + || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) + { + rtmsg->rtm_flags |= RTNH_F_ONLINK; + addattr_l (nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4); + addattr32 (nlmsg, req_size, RTA_OIF, nexthop->ifindex); + + if (nexthop->rmap_src.ipv4.s_addr && (cmd == RTM_NEWROUTE)) + addattr_l (nlmsg, req_size, RTA_PREFSRC, + &nexthop->rmap_src.ipv4, bytelen); + else if (nexthop->src.ipv4.s_addr && (cmd == RTM_NEWROUTE)) + addattr_l (nlmsg, req_size, RTA_PREFSRC, + &nexthop->src.ipv4, bytelen); + + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug(" 5549: _netlink_route_build_singlepath() (%s): " + "nexthop via %s %s if %u", + routedesc, ipv4_ll_buf, label_buf, nexthop->ifindex); + return; + } + if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { @@ -782,6 +801,7 @@ _netlink_route_build_singlepath( inet_ntoa (nexthop->gate.ipv4), label_buf, nexthop->ifindex); } + if (nexthop->type == NEXTHOP_TYPE_IPV6 || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { @@ -880,33 +900,12 @@ _netlink_route_build_multipath( rtnh->rtnh_hops = 0; rta->rta_len += rtnh->rtnh_len; - if (rtmsg->rtm_family == AF_INET && - (nexthop->type == NEXTHOP_TYPE_IPV6 - || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) - { - char buf[16] = "169.254.0.1"; - struct in_addr ipv4_ll; - - inet_pton (AF_INET, buf, &ipv4_ll); - bytelen = 4; - rtnh->rtnh_flags |= RTNH_F_ONLINK; - rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY, - &ipv4_ll, bytelen); - rtnh->rtnh_len += sizeof (struct rtattr) + bytelen; - rtnh->rtnh_ifindex = nexthop->ifindex; - - if (nexthop->rmap_src.ipv4.s_addr) - *src = &nexthop->rmap_src; - else if (nexthop->src.ipv4.s_addr) - *src = &nexthop->src; - - if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug(" 5549: netlink_route_build_multipath() (%s): " - "nexthop via %s if %u", - routedesc, buf, nexthop->ifindex); - return; - } - + /* + * label_buf is *only* currently used within debugging. + * As such when we assign it we are guarding it inside + * a debug test. If you want to change this make sure + * you fix this assumption + */ label_buf[0] = '\0'; /* outgoing label - either as NEWDST (in the case of LSR) or as ENCAP * (in the case of LER) @@ -930,13 +929,16 @@ _netlink_route_build_multipath( { bos = ((i == (nh_label->num_labels - 1)) ? 1 : 0); out_lse[i] = mpls_lse_encode (nh_label->label[i], 0, 0, bos); - if (!num_labels) - sprintf (label_buf, "label %d", nh_label->label[i]); - else - { - sprintf (label_buf1, "/%d", nh_label->label[i]); - strcat (label_buf, label_buf1); - } + if (IS_ZEBRA_DEBUG_KERNEL) + { + if (!num_labels) + sprintf (label_buf, "label %d", nh_label->label[i]); + else + { + sprintf (label_buf1, "/%d", nh_label->label[i]); + strcat (label_buf, label_buf1); + } + } num_labels++; } } @@ -968,6 +970,29 @@ _netlink_route_build_multipath( if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) rtnh->rtnh_flags |= RTNH_F_ONLINK; + if (rtmsg->rtm_family == AF_INET && + (nexthop->type == NEXTHOP_TYPE_IPV6 + || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) + { + bytelen = 4; + rtnh->rtnh_flags |= RTNH_F_ONLINK; + rta_addattr_l (rta, NL_PKT_BUF_SIZE, RTA_GATEWAY, + &ipv4_ll, bytelen); + rtnh->rtnh_len += sizeof (struct rtattr) + bytelen; + rtnh->rtnh_ifindex = nexthop->ifindex; + + if (nexthop->rmap_src.ipv4.s_addr) + *src = &nexthop->rmap_src; + else if (nexthop->src.ipv4.s_addr) + *src = &nexthop->src; + + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug(" 5549: netlink_route_build_multipath() (%s): " + "nexthop via %s %s if %u", + routedesc, ipv4_ll_buf, label_buf, nexthop->ifindex); + return; + } + if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index af58a0f0d..4ec5f1853 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RT_NETLINK_H @@ -35,6 +34,7 @@ #define RTPROT_RIP 189 #define RTPROT_RIPNG 190 +void rt_netlink_init (void); extern void clear_nhlfe_installed (zebra_lsp_t *lsp); diff --git a/zebra/rt_socket.c b/zebra/rt_socket.c index de8cc69a8..3e4833016 100644 --- a/zebra/rt_socket.c +++ b/zebra/rt_socket.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 03b7ace9b..7f46066a6 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/rtadv.h b/zebra/rtadv.h index e4c2c6b36..5f389b30a 100644 --- a/zebra/rtadv.h +++ b/zebra/rtadv.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RTADV_H diff --git a/zebra/rtadv_null.c b/zebra/rtadv_null.c index ee6eda6bd..ccb1a39e0 100644 --- a/zebra/rtadv_null.c +++ b/zebra/rtadv_null.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c index 4d491f320..1fb2984dd 100644 --- a/zebra/rtread_getmsg.c +++ b/zebra/rtread_getmsg.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c index 1d41861bb..d59883445 100644 --- a/zebra/rtread_netlink.c +++ b/zebra/rtread_netlink.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c index b68e1cb74..cabb1f771 100644 --- a/zebra/rtread_sysctl.c +++ b/zebra/rtread_sysctl.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/test_main.c b/zebra/test_main.c index f3ef3df96..83c1ebb17 100644 --- a/zebra/test_main.c +++ b/zebra/test_main.c @@ -11,10 +11,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index cf8f78afe..2a23ff102 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_fpm_dt.c b/zebra/zebra_fpm_dt.c index 7b4e1b90d..db28b6f0e 100644 --- a/zebra/zebra_fpm_dt.c +++ b/zebra/zebra_fpm_dt.c @@ -17,10 +17,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 92ab5df2c..4ca7b5972 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -17,10 +17,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_fpm_private.h b/zebra/zebra_fpm_private.h index 1c4fd4c22..49650541e 100644 --- a/zebra/zebra_fpm_private.h +++ b/zebra/zebra_fpm_private.h @@ -16,10 +16,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 _ZEBRA_FPM_PRIVATE_H diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c index 11869d8a2..312d4cd3e 100644 --- a/zebra/zebra_fpm_protobuf.c +++ b/zebra/zebra_fpm_protobuf.c @@ -17,10 +17,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_memory.c b/zebra/zebra_memory.c index 728051c34..51c240ae2 100644 --- a/zebra/zebra_memory.c +++ b/zebra/zebra_memory.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #ifdef HAVE_CONFIG_H diff --git a/zebra/zebra_memory.h b/zebra/zebra_memory.h index c1ac4fe95..35d70d81e 100644 --- a/zebra/zebra_memory.h +++ b/zebra/zebra_memory.h @@ -14,10 +14,9 @@ * 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. + * 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 _QUAGGA_ZEBRA_MEMORY_H diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 65e7f9ab9..b547c6256 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -928,6 +927,7 @@ lsp_process (struct work_queue *wq, void *data) zebra_lsp_t *lsp; zebra_nhlfe_t *oldbest, *newbest; char buf[BUFSIZ], buf2[BUFSIZ]; + struct zebra_vrf *zvrf = vrf_info_lookup (VRF_DEFAULT); lsp = (zebra_lsp_t *)data; if (!lsp) // unexpected @@ -956,15 +956,24 @@ lsp_process (struct work_queue *wq, void *data) { /* Not already installed */ if (newbest) - kernel_add_lsp (lsp); + { + kernel_add_lsp (lsp); + zvrf->lsp_installs++; + } } else { /* Installed, may need an update and/or delete. */ if (!newbest) - kernel_del_lsp (lsp); + { + kernel_del_lsp (lsp); + zvrf->lsp_removals++; + } else if (CHECK_FLAG (lsp->flags, LSP_FLAG_CHANGED)) - kernel_upd_lsp (lsp); + { + kernel_upd_lsp (lsp); + zvrf->lsp_installs++; + } } return WQ_SUCCESS; diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h index b5a8f3173..1f17de67a 100644 --- a/zebra/zebra_mpls.h +++ b/zebra/zebra_mpls.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_MPLS_H diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c index 045bee2b9..d0c4acb37 100644 --- a/zebra/zebra_mpls_netlink.c +++ b/zebra/zebra_mpls_netlink.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_mpls_null.c b/zebra/zebra_mpls_null.c index 0333b6e6b..a8acdb19f 100644 --- a/zebra/zebra_mpls_null.c +++ b/zebra/zebra_mpls_null.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -27,209 +26,3 @@ int kernel_add_lsp (zebra_lsp_t *lsp) { return 0; } int kernel_upd_lsp (zebra_lsp_t *lsp) { return 0; } int kernel_del_lsp (zebra_lsp_t *lsp) { return 0; } int mpls_kernel_init (void) { return -1; }; - -int mpls_enabled; - -char * -mpls_label2str (u_int8_t num_labels, mpls_label_t *labels, - char *buf, int len, int pretty) -{ - return NULL; -} - -int -mpls_str2label (const char *label_str, u_int8_t *num_labels, - mpls_label_t *labels) -{ - return 0; -} - -int -zebra_mpls_label_block_add (struct zebra_vrf *vrf, u_int32_t start_label, - u_int32_t end_label) -{ - return 0; -} - -int -zebra_mpls_label_block_del (struct zebra_vrf *zvrf) -{ - return 0; -} - -int -zebra_mpls_write_label_block_config (struct vty *vty, struct zebra_vrf *zvrf) -{ - return 0; -} - -int -zebra_mpls_lsp_install (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib) -{ - return 0; -} - -int -zebra_mpls_lsp_uninstall (struct zebra_vrf *zvrf, struct route_node *rn, struct rib *rib) -{ - return 0; -} - -void -zebra_mpls_init_tables (struct zebra_vrf *zvrf) -{ -} - -void -zebra_mpls_print_lsp (struct vty *vty, struct zebra_vrf *zvrf, mpls_label_t label, - u_char use_json) -{ -} - -void -zebra_mpls_print_lsp_table (struct vty *vty, struct zebra_vrf *zvrf, - u_char use_json) -{ -} - -int -zebra_mpls_write_lsp_config (struct vty *vty, struct zebra_vrf *zvrf) -{ - return 0; -} - -#ifdef HAVE_CUMULUS -int -zebra_mpls_lsp_label_consistent (struct zebra_vrf *zvrf, mpls_label_t in_label, - mpls_label_t out_label, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex) -{ - return 0; -} -#endif - -int -zebra_mpls_static_lsp_add (struct zebra_vrf *zvrf, mpls_label_t in_label, - mpls_label_t out_label, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex) -{ - return 0; -} - -int -zebra_mpls_static_lsp_del (struct zebra_vrf *zvrf, mpls_label_t in_label, - enum nexthop_types_t gtype, union g_addr *gate, - ifindex_t ifindex) -{ - return 0; -} - -void -zebra_mpls_lsp_schedule (struct zebra_vrf *zvrf) -{ -} - -void -zebra_mpls_close_tables (struct zebra_vrf *zvrf) -{ -} - -zebra_fec_t * -zebra_mpls_fec_for_label (struct zebra_vrf *zvrf, mpls_label_t label) -{ - return NULL; -} - -int -zebra_mpls_label_already_bound (struct zebra_vrf *zvrf, mpls_label_t label) -{ - return 0; -} - -int -zebra_mpls_static_fec_add (struct zebra_vrf *zvrf, struct prefix *p, - mpls_label_t in_label) -{ - return 0; -} - -int -zebra_mpls_static_fec_del (struct zebra_vrf *zvrf, struct prefix *p) -{ - return 0; -} - -int -zebra_mpls_write_fec_config (struct vty *vty, struct zebra_vrf *zvrf) -{ - return 0; -} - -void -zebra_mpls_print_fec_table (struct vty *vty, struct zebra_vrf *zvrf) -{ -} - -void -zebra_mpls_print_fec (struct vty *vty, struct zebra_vrf *zvrf, struct prefix *p) -{ -} - -int -zebra_mpls_fec_register (struct zebra_vrf *zvrf, struct prefix *p, - u_int32_t label_index, struct zserv *client) -{ - return 0; -} - -int -zebra_mpls_fec_unregister (struct zebra_vrf *zvrf, struct prefix *p, - struct zserv *client) -{ - return 0; -} - -int -zebra_mpls_cleanup_fecs_for_client (struct zebra_vrf *zvrf, struct zserv *client) -{ - return 0; -} - -void mpls_ldp_lsp_uninstall_all (struct hash_backet *backet, void *ctxt) -{ - return; -} - -void mpls_ldp_ftn_uninstall_all (struct zebra_vrf *zvrf, int afi) -{ - return; -} - -void zebra_mpls_init (void) -{ - return; -} - -int mpls_lsp_install (struct zebra_vrf *zvrf, enum lsp_types_t type, - mpls_label_t in_label, mpls_label_t out_label, - enum nexthop_types_t gtype, union g_addr *gate, - ifindex_t ifindex) -{ - return 0; -} - -int mpls_lsp_uninstall (struct zebra_vrf *zvrf, enum lsp_types_t type, - mpls_label_t in_label, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex) -{ - return 0; -} - -int mpls_ftn_update (int add, struct zebra_vrf *zvrf, enum lsp_types_t type, - struct prefix *prefix, enum nexthop_types_t gtype, - union g_addr *gate, ifindex_t ifindex, u_int8_t distance, - mpls_label_t out_label) -{ - return 0; -} - diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c index eaa80ac55..bca73898c 100644 --- a/zebra/zebra_mpls_openbsd.c +++ b/zebra/zebra_mpls_openbsd.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 7662cf416..3010a3bd8 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c index 86356104b..82c7f404b 100644 --- a/zebra/zebra_mroute.c +++ b/zebra/zebra_mroute.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_mroute.h b/zebra/zebra_mroute.h index c0bac43a8..eeaf9caf1 100644 --- a/zebra/zebra_mroute.h +++ b/zebra/zebra_mroute.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 __ZEBRA_MROUTE_H__ diff --git a/zebra/zebra_ns.c b/zebra/zebra_ns.c index 642d2700a..a5869585d 100644 --- a/zebra/zebra_ns.c +++ b/zebra/zebra_ns.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include "zebra.h" diff --git a/zebra/zebra_ns.h b/zebra/zebra_ns.h index c50f9249d..721b6c818 100644 --- a/zebra/zebra_ns.h +++ b/zebra/zebra_ns.h @@ -15,10 +15,9 @@ * 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. + * 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 */ #if !defined(__ZEBRA_NS_H__) #define __ZEBRA_NS_H__ diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 4141cdd90..e49347638 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -1027,7 +1026,7 @@ zebra_ptm_bfd_client_deregister (int proto) int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF; if (proto != ZEBRA_ROUTE_OSPF && proto != ZEBRA_ROUTE_BGP - && proto != ZEBRA_ROUTE_OSPF6) + && proto != ZEBRA_ROUTE_OSPF6 && proto != ZEBRA_ROUTE_PIM) return; if (IS_ZEBRA_DEBUG_EVENT) diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h index 71c85d909..28fe9c1de 100644 --- a/zebra/zebra_ptm.h +++ b/zebra/zebra_ptm.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_PTM_H diff --git a/zebra/zebra_ptm_null.c b/zebra/zebra_ptm_null.c index 4afa2ce52..576ea1732 100644 --- a/zebra/zebra_ptm_null.c +++ b/zebra/zebra_ptm_null.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> #include "prefix.h" diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c index 396857bc1..d6902142a 100644 --- a/zebra/zebra_ptm_redistribute.c +++ b/zebra/zebra_ptm_redistribute.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -79,9 +78,9 @@ zebra_interface_bfd_update (struct interface *ifp, struct prefix *dp, for (ALL_LIST_ELEMENTS (zebrad.client_list, node, nnode, client)) { - /* Supporting for OSPF and BGP */ + /* Supporting for OSPF, BGP and PIM */ if (client->proto != ZEBRA_ROUTE_OSPF && client->proto != ZEBRA_ROUTE_BGP - && client->proto != ZEBRA_ROUTE_OSPF6) + && client->proto != ZEBRA_ROUTE_OSPF6 && client->proto != ZEBRA_ROUTE_PIM) continue; /* Notify to the protocol daemons. */ @@ -118,7 +117,8 @@ zebra_bfd_peer_replay_req (void) /* Supporting for BGP */ if ((client->proto != ZEBRA_ROUTE_BGP) && (client->proto != ZEBRA_ROUTE_OSPF) && - (client->proto != ZEBRA_ROUTE_OSPF6)) + (client->proto != ZEBRA_ROUTE_OSPF6) && + (client->proto != ZEBRA_ROUTE_PIM)) continue; /* Notify to the protocol daemons. */ diff --git a/zebra/zebra_ptm_redistribute.h b/zebra/zebra_ptm_redistribute.h index d5aa37d5f..ac3873f24 100644 --- a/zebra/zebra_ptm_redistribute.h +++ b/zebra/zebra_ptm_redistribute.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 07b19155e..5f457a6fc 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -1115,6 +1114,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old) rib_table_info_t *info = srcdest_rnode_table_info(rn); int recursing; struct prefix *p, *src_p; + struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id); srcdest_rnode_prefixes (rn, &p, &src_p); @@ -1131,6 +1131,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old) */ hook_call(rib_update, rn, "installing in kernel"); ret = kernel_route_rib (p, src_p, old, rib); + zvrf->installs++; /* If install succeeds, update FIB flag for nexthops. */ if (!ret) @@ -1159,6 +1160,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib) rib_table_info_t *info = srcdest_rnode_table_info(rn); int recursing; struct prefix *p, *src_p; + struct zebra_vrf *zvrf = vrf_info_lookup (rib->vrf_id); srcdest_rnode_prefixes (rn, &p, &src_p); @@ -1175,6 +1177,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib) */ hook_call(rib_update, rn, "uninstalling from kernel"); ret = kernel_route_rib (p, src_p, rib, NULL); + zvrf->removals++; for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing)) UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 67859fd46..16c157e30 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -555,7 +554,7 @@ zebra_rnh_process_static_routes (vrf_id_t vrfid, int family, { RNODE_FOREACH_RIB(static_rn, srib) { - if (srib->type == ZEBRA_ROUTE_STATIC) + if (srib->type != ZEBRA_ROUTE_STATIC) continue; /* Set the filter flag for the correct nexthop - static route may diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h index 4394fde4f..a75674d0c 100644 --- a/zebra/zebra_rnh.h +++ b/zebra/zebra_rnh.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_RNH_H diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c index 286290a52..0a3620bbe 100644 --- a/zebra/zebra_rnh_null.c +++ b/zebra/zebra_rnh_null.c @@ -13,10 +13,9 @@ * 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. + * 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 */ #include <zebra.h> #include "vty.h" diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 1738b0b05..4a81cb635 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_routemap.h b/zebra/zebra_routemap.h index bf418ccac..94981a3cd 100644 --- a/zebra/zebra_routemap.h +++ b/zebra/zebra_routemap.h @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 __ZEBRA_ROUTEMAP_H__ diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c index 8adb8873d..7c2e6697c 100644 --- a/zebra/zebra_snmp.c +++ b/zebra/zebra_snmp.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ /* diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 4628d1109..b218eb521 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -15,10 +15,9 @@ * 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. + * 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 */ #include <zebra.h> diff --git a/zebra/zebra_static.h b/zebra/zebra_static.h index adc2efff5..9f76ab5f5 100644 --- a/zebra/zebra_static.h +++ b/zebra/zebra_static.h @@ -15,10 +15,9 @@ * 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. + * 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 __ZEBRA_STATIC_H__ #define __ZEBRA_STATIC_H__ diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 6b3689105..94e250618 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -536,11 +535,10 @@ vrf_config_write (struct vty *vty) void zebra_vrf_init (void) { - vrf_add_hook (VRF_NEW_HOOK, zebra_vrf_new); - vrf_add_hook (VRF_ENABLE_HOOK, zebra_vrf_enable); - vrf_add_hook (VRF_DISABLE_HOOK, zebra_vrf_disable); - vrf_add_hook (VRF_DELETE_HOOK, zebra_vrf_delete); + vrf_init (zebra_vrf_new, + zebra_vrf_enable, + zebra_vrf_disable, + zebra_vrf_delete); - vrf_init (); vrf_cmd_init (vrf_config_write); } diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index 74c2a5217..790e2e53d 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -15,10 +15,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #if !defined(__ZEBRA_RIB_H__) #define __ZEBRA_RIB_H__ @@ -95,6 +94,13 @@ struct zebra_vrf /* MPLS processing flags */ u_int16_t mpls_flags; #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0) + + /* Route Installs */ + uint64_t installs; + uint64_t removals; + uint64_t neigh_updates; + uint64_t lsp_installs; + uint64_t lsp_removals; }; static inline vrf_id_t diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index c5c462c8d..d0d761af9 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -46,7 +45,9 @@ extern int allow_delete; static int do_show_ip_route(struct vty *vty, const char *vrf_name, - safi_t safi, bool use_fib, u_char use_json); + afi_t afi, safi_t safi, bool use_fib, u_char use_json, + route_tag_t tag, struct prefix *longer_prefix_p, + bool supernets_only, int type, u_short ospf_instance_id); static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast); @@ -299,12 +300,14 @@ DEFUN (no_ip_multicast_mode, DEFUN (show_ip_rpf, show_ip_rpf_cmd, - "show ip rpf", + "show ip rpf [json]", SHOW_STR IP_STR - "Display RPF information for multicast source\n") + "Display RPF information for multicast source\n" + JSON_STR) { - return do_show_ip_route(vty, VRF_DEFAULT_NAME, SAFI_MULTICAST, false, 0); + int uj = use_json(argc, argv); + return do_show_ip_route (vty, VRF_DEFAULT_NAME, AFI_IP, SAFI_MULTICAST, false, uj, 0, NULL, false, -1, 0); } DEFUN (show_ip_rpf_addr, @@ -1086,22 +1089,11 @@ use_fib (struct cmd_token *token) return strncmp(token->arg, "route", strlen(token->arg)); } -DEFUN (show_ip_route, - show_ip_route_cmd, - "show ip <fib|route> [json]", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - JSON_STR) -{ - return do_show_ip_route (vty, VRF_DEFAULT_NAME, SAFI_UNICAST, - use_fib(argv[2]), use_json(argc, argv)); -} - static int -do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, - bool use_fib, u_char use_json) +do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi, + bool use_fib, u_char use_json, route_tag_t tag, + struct prefix *longer_prefix_p, bool supernets_only, + int type, u_short ospf_instance_id) { struct route_table *table; struct route_node *rn; @@ -1111,6 +1103,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, char buf[BUFSIZ]; json_object *json = NULL; json_object *json_prefix = NULL; + u_int32_t addr; if (!(zvrf = zebra_vrf_lookup_by_name (vrf_name))) { @@ -1130,7 +1123,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, return CMD_SUCCESS; } - table = zebra_vrf_table (AFI_IP, safi, zvrf_id (zvrf)); + table = zebra_vrf_table (afi, safi, zvrf_id (zvrf)); if (! table) { if (use_json) @@ -1139,69 +1132,82 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi, } if (use_json) - { json = json_object_new_object(); - /* Show all IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) + /* Show all routes. */ + for (rn = route_top (table); rn; rn = route_next (rn)) + { + RNODE_FOREACH_RIB (rn, rib) { - RNODE_FOREACH_RIB (rn, rib) + if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + continue; + + if (tag && rib->tag != tag) + continue; + + if (longer_prefix_p && ! prefix_match (longer_prefix_p, &rn->p)) + continue; + + /* This can only be true when the afi is IPv4 */ + if (supernets_only) { - if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) + addr = ntohl (rn->p.u.prefix4.s_addr); + + if (IN_CLASSC (addr) && rn->p.prefixlen >= 24) + continue; + + if (IN_CLASSB (addr) && rn->p.prefixlen >= 16) + continue; + + if (IN_CLASSA (addr) && rn->p.prefixlen >= 8) continue; - if (!json_prefix) - json_prefix = json_object_new_array(); - vty_show_ip_route (vty, rn, rib, json_prefix); } - if (json_prefix) + if (type && rib->type != type) + continue; + + if (ospf_instance_id && (rib->type != ZEBRA_ROUTE_OSPF || rib->instance != ospf_instance_id)) + continue; + + if (use_json) { - prefix2str (&rn->p, buf, sizeof buf); - json_object_object_add(json, buf, json_prefix); - json_prefix = NULL; + if (!json_prefix) + json_prefix = json_object_new_array(); } - } - - vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); - json_object_free(json); - } - else - { - /* Show all IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - { - RNODE_FOREACH_RIB (rn, rib) + else { - if (use_fib && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; if (first) { - vty_out (vty, SHOW_ROUTE_V4_HEADER); + if (afi == AFI_IP) + vty_out (vty, SHOW_ROUTE_V4_HEADER); + else + vty_out (vty, SHOW_ROUTE_V6_HEADER); + + if (zvrf_id (zvrf) != VRF_DEFAULT) + vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); + first = 0; } - vty_show_ip_route (vty, rn, rib, NULL); } + + vty_show_ip_route (vty, rn, rib, json_prefix); } - } - return CMD_SUCCESS; -} + if (json_prefix) + { + prefix2str (&rn->p, buf, sizeof buf); + json_object_object_add(json, buf, json_prefix); + json_prefix = NULL; + } + } -DEFUN (show_ip_route_vrf, - show_ip_route_vrf_cmd, - "show ip <fib|route> vrf NAME [json]", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_CMD_HELP_STR - JSON_STR) -{ - int idx_vrf = 4; - bool uf = use_fib(argv[2]); - u_char uj = use_json(argc, argv); + if (use_json) + { + vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); + json_object_free(json); + } - return do_show_ip_route (vty, argv[idx_vrf]->arg, SAFI_UNICAST, uf, uj); + return CMD_SUCCESS; } DEFUN (show_ip_nht, @@ -1346,258 +1352,115 @@ DEFUN (no_ipv6_nht_default_route, return CMD_SUCCESS; } -DEFUN (show_ip_route_tag, - show_ip_route_tag_cmd, - "show ip <fib|route> [vrf NAME] tag (1-4294967295)", +// dwalton one "show ip route" to rule them all +DEFUN (show_ip_route, + show_ip_route_cmd, + "show ip <fib|route> [vrf NAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]", SHOW_STR IP_STR "IP forwarding table\n" "IP routing table\n" VRF_CMD_HELP_STR "Show only routes with tag\n" - "Tag value\n") + "Tag value\n" + "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" + "Show route matching the specified Network/Mask pair only\n" + "Show supernet entries only\n" + FRR_IP_REDIST_HELP_STR_ZEBRA + "Open Shortest Path First (OSPFv2)\n" + "Instance ID\n" + JSON_STR) { bool uf = use_fib(argv[2]); - int idx_vrf = 3; - int idx_name = 4; - int idx_tag = 6; struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; + int vrf_all = 0; route_tag_t tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; + struct vrf *vrf; + struct zebra_vrf *zvrf; + int uj = use_json(argc, argv); + int idx = 0; + struct prefix p; + bool longer_prefixes = false; + bool supernets_only = false; + int type = 0; + u_short ospf_instance_id = 0; - if (strmatch(argv[idx_vrf]->text, "vrf")) - { - VRF_GET_ID (vrf_id, argv[idx_name]->arg); - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295); - } - else + if (argv_find (argv, argc, "vrf", &idx)) { - idx_tag -= 2; - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295); + if (strmatch(argv[idx+1]->arg, "all")) + vrf_all = 1; + else + VRF_GET_ID (vrf_id, argv[idx+1]->arg); } - table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show all IPv4 routes with matching tag value. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (rib->tag != tag) - continue; - - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_prefix_longer, - show_ip_route_prefix_longer_cmd, - "show ip <fib|route> [vrf NAME] A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_CMD_HELP_STR - "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" - "Show route matching the specified Network/Mask pair only\n") -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct prefix p; - int ret; - int first = 1; - bool uf = use_fib(argv[2]); - vrf_id_t vrf_id = VRF_DEFAULT; + if (argv_find (argv, argc, "tag", &idx)) + VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295); - if (strmatch(argv[3]->text, "vrf")) + else if (argv_find (argv, argc, "A.B.C.D/M", &idx)) { - VRF_GET_ID (vrf_id, argv[4]->arg); - ret = str2prefix (argv[5]->arg, &p); + str2prefix (argv[idx]->arg, &p); + longer_prefixes = true; } + + else if (argv_find (argv, argc, "supernets_only", &idx)) + supernets_only = true; + else { - ret = str2prefix (argv[3]->arg, &p); + if (argv_find (argv, argc, "kernel", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "connected", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "static", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "rip", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "ospf", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "isis", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "bgp", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "pim", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "eigrp", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "nhrp", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "table", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + else if (argv_find (argv, argc, "vnc", &idx)) + type = proto_redistnum (AFI_IP, argv[idx]->text); + + if (argv_find (argv, argc, "(1-65535)", &idx)) + VTY_GET_INTEGER ("Instance", ospf_instance_id, argv[idx]->arg); + + if (type < 0) + { + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); + return CMD_WARNING; + } } - if (! ret) + if (vrf_all) { - vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); - return CMD_WARNING; - } - - table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (prefix_match (&p, &rn->p)) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_supernets, - show_ip_route_supernets_cmd, - "show ip <fib|route> [vrf NAME] supernets-only", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_CMD_HELP_STR - "Show supernet entries only\n") -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - u_int32_t addr; - int first = 1; - vrf_id_t vrf_id = VRF_DEFAULT; - bool uf = use_fib(argv[2]); - - if (strmatch(argv[3]->text, "vrf")) - VRF_GET_ID (vrf_id, argv[4]->arg); - - table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - addr = ntohl (rn->p.u.prefix4.s_addr); - - if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) - || (IN_CLASSB (addr) && rn->p.prefixlen < 16) - || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) - { - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - } - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_protocol, - show_ip_route_protocol_cmd, - "show ip <fib|route> [vrf NAME] " FRR_IP_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_CMD_HELP_STR - FRR_IP_REDIST_HELP_STR_ZEBRA) -{ - int type; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; - vrf_id_t vrf_id = VRF_DEFAULT; - bool uf = use_fib(argv[2]); - - int idx = 0; - if (argv_find (argv, argc, "NAME", &idx)) - VRF_GET_ID (vrf_id, argv[idx]->arg); - - char *proto = argv[argc - 1]->text; - type = proto_redistnum (AFI_IP, proto); + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + if ((zvrf = vrf->info) == NULL || + (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) + continue; - if (type < 0) + do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP, SAFI_UNICAST, uf, uj, tag, + longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id); + } + } + else { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; + vrf = vrf_lookup_by_id (vrf_id); + do_show_ip_route (vty, vrf->name, AFI_IP, SAFI_UNICAST, uf, uj, tag, + longer_prefixes ? &p : NULL, supernets_only, type, ospf_instance_id); } - - table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (rib->type == type) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - return CMD_SUCCESS; -} - - -DEFUN (show_ip_route_ospf_instance, - show_ip_route_ospf_instance_cmd, - "show ip <fib|route> ospf (1-65535)", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n") -{ - int idx_number = 4; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; - u_short instance = 0; - bool uf = use_fib(argv[2]); - - VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg); - - table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, VRF_DEFAULT); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (rib->type == ZEBRA_ROUTE_OSPF && rib->instance == instance) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } return CMD_SUCCESS; } @@ -1901,294 +1764,6 @@ DEFUN (show_ip_route_summary_prefix, } -DEFUN (show_ip_route_vrf_all, - show_ip_route_vrf_all_cmd, - "show ip <fib|route> vrf all", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_ALL_CMD_HELP_STR) -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) - continue; - - /* Show all IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_vrf_all_tag, - show_ip_route_vrf_all_tag_cmd, - "show ip <fib|route> vrf all tag (1-4294967295)", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_ALL_CMD_HELP_STR - "Show only routes with tag\n" - "Tag value\n") -{ - int idx_number = 6; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - route_tag_t tag = 0; - bool uf = use_fib(argv[2]); - - if (argv[idx_number]->arg) - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295); - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) - continue; - - /* Show all IPv4 routes with matching tag value. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (rib->tag != tag) - continue; - - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_vrf_all_prefix_longer, - show_ip_route_vrf_all_prefix_longer_cmd, - "show ip <fib|route> vrf all A.B.C.D/M longer-prefixes", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_ALL_CMD_HELP_STR - "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" - "Show route matching the specified Network/Mask pair only\n") -{ - int idx_ipv4_prefixlen = 5; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct prefix p; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int ret; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - ret = str2prefix (argv[idx_ipv4_prefixlen]->arg, &p); - if (! ret) - { - vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); - return CMD_WARNING; - } - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) - continue; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (prefix_match (&p, &rn->p)) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_vrf_all_supernets, - show_ip_route_vrf_all_supernets_cmd, - "show ip <fib|route> vrf all supernets-only", - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_ALL_CMD_HELP_STR - "Show supernet entries only\n") -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - u_int32_t addr; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) - continue; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - - addr = ntohl (rn->p.u.prefix4.s_addr); - - if ((IN_CLASSC (addr) && rn->p.prefixlen < 24) - || (IN_CLASSB (addr) && rn->p.prefixlen < 16) - || (IN_CLASSA (addr) && rn->p.prefixlen < 8)) - { - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ip_route_vrf_all_protocol, - show_ip_route_vrf_all_protocol_cmd, - "show ip <fib|route> vrf all " FRR_IP_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IP forwarding table\n" - "IP routing table\n" - VRF_ALL_CMD_HELP_STR - FRR_IP_REDIST_HELP_STR_ZEBRA"\n") -{ - int type; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - char *proto = argv[argc - 1]->text; - type = proto_redistnum (AFI_IP, proto); - - if (type < 0) - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; - } - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL) - continue; - - /* Show matched type IPv4 routes. */ - for (rn = route_top (table); rn; rn = route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (rib->type == type) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V4_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - DEFUN (show_ip_route_vrf_all_addr, show_ip_route_vrf_all_addr_cmd, "show ip route vrf all A.B.C.D", @@ -2317,49 +1892,49 @@ DEFUN (show_ip_route_vrf_all_summary_prefix, return CMD_SUCCESS; } -/* Write IPv4 static route configuration. */ +/* Write static route configuration. */ static int -static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) +static_config (struct vty *vty, afi_t afi, safi_t safi, const char *cmd) { struct route_node *rn; struct static_route *si; struct route_table *stable; struct vrf *vrf; struct zebra_vrf *zvrf; - char buf[BUFSIZ]; + char buf[SRCDEST2STR_BUFFER]; int write =0; RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { if (!(zvrf = vrf->info)) continue; - if ((stable = zvrf->stable[AFI_IP][safi]) == NULL) + if ((stable = zvrf->stable[afi][safi]) == NULL) continue; - for (rn = route_top (stable); rn; rn = route_next (rn)) + for (rn = route_top (stable); rn; rn = srcdest_route_next (rn)) for (si = rn->info; si; si = si->next) { - vty_out (vty, "%s %s", cmd, prefix2str (&rn->p, buf, sizeof buf)); + vty_out (vty, "%s %s", cmd, srcdest_rnode2str (rn, buf, sizeof buf)); switch (si->type) { case STATIC_IPV4_GATEWAY: vty_out (vty, " %s", inet_ntoa (si->addr.ipv4)); break; + case STATIC_IPV6_GATEWAY: + vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ)); + break; case STATIC_IFINDEX: vty_out (vty, " %s", si->ifname); break; case STATIC_BLACKHOLE: vty_out (vty, " Null0"); break; - case STATIC_IPV6_GATEWAY: - vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ)); - break; - case STATIC_IPV6_GATEWAY_IFINDEX: - vty_out (vty, " %s %s", - inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ), - ifindex2ifname (si->ifindex, si->vrf_id)); - break; + case STATIC_IPV6_GATEWAY_IFINDEX: + vty_out (vty, " %s %s", + inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ), + ifindex2ifname (si->ifindex, si->vrf_id)); + break; } /* flags are incompatible with STATIC_BLACKHOLE */ @@ -2379,7 +1954,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd) vty_out (vty, " %d", si->distance); if (si->vrf_id != VRF_DEFAULT) - vty_out (vty, " vrf %s", zvrf ? zvrf_name (zvrf) : ""); + vty_out (vty, " vrf %s", zvrf_name (zvrf)); /* Label information */ if (si->snh_label.num_labels) @@ -2979,278 +2554,101 @@ DEFUN (no_ipv6_route_ifname_flags, tag, distance, vrf, NULL); } +// dwalton duplicate to here DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 <fib|route> [vrf NAME] [json]", + "show ipv6 <fib|route> [vrf NAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]", SHOW_STR IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" + "IP forwarding table\n" + "IP routing table\n" VRF_CMD_HELP_STR - "Output JSON\n") + "Show only routes with tag\n" + "Tag value\n" + "IPv6 prefix\n" + "Show route matching the specified Network/Mask pair only\n" + FRR_IP6_REDIST_HELP_STR_ZEBRA + JSON_STR) { + bool uf = use_fib(argv[2]); struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; + int vrf_all = 0; + route_tag_t tag = 0; vrf_id_t vrf_id = VRF_DEFAULT; - struct zebra_vrf *zvrf = NULL; - char buf[SRCDEST2STR_BUFFER]; - json_object *json = NULL; - json_object *json_prefix = NULL; - bool uf = use_fib(argv[2]); - - int vrf = (argc > 3 && strmatch (argv[3]->text, "vrf")); - int uj = vrf ? argc == 6 : argc == 4; - char *vrfname = vrf ? argv[4]->arg : NULL; - - if (vrf) - { - if (!(zvrf = zebra_vrf_lookup_by_name (vrfname))) - { - if (uj) - vty_out (vty, "{}%s", VTY_NEWLINE); - else - vty_out (vty, "vrf %s not defined%s", vrfname, VTY_NEWLINE); - return CMD_SUCCESS; - } - - if (zvrf_id (zvrf) == VRF_UNKNOWN) - { - if (uj) - vty_out (vty, "{}%s", VTY_NEWLINE); - else - vty_out (vty, "vrf %s inactive%s", vrfname, VTY_NEWLINE); - return CMD_SUCCESS; - } - else - vrf_id = zvrf_id (zvrf); - } + struct vrf *vrf; + struct zebra_vrf *zvrf; + int uj = use_json(argc, argv); + int idx = 0; + struct prefix p; + bool longer_prefixes = false; + bool supernets_only = false; + int type = 0; - table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); - if (!table) + if (argv_find (argv, argc, "vrf", &idx)) { - if (uj) - vty_out (vty, "{}%s", VTY_NEWLINE); - return CMD_SUCCESS; + if (strmatch(argv[idx+1]->arg, "all")) + vrf_all = 1; + else + VRF_GET_ID (vrf_id, argv[idx+1]->arg); } - if (uj) - { - json = json_object_new_object(); + if (argv_find (argv, argc, "tag", &idx)) + VTY_GET_INTEGER_RANGE("tag", tag, argv[idx+1]->arg, 0, 4294967295); - /* Show all IPv6 route. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - { - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (!json_prefix) - json_prefix = json_object_new_array(); - vty_show_ip_route (vty, rn, rib, json_prefix); - } - - if (json_prefix) - { - srcdest_rnode2str (rn, buf, sizeof buf); - json_object_object_add(json, buf, json_prefix); - json_prefix = NULL; - } - } - - vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE); - json_object_free(json); + else if (argv_find (argv, argc, "X:X::X:X/M", &idx)) + { + str2prefix (argv[idx]->arg, &p); + longer_prefixes = true; } + else { - /* Show all IPv6 route. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) + if (argv_find (argv, argc, "kernel", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "connected", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "static", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "ripng", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "ospf6", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "isis", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "bgp", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "nhrp", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "table", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + else if (argv_find (argv, argc, "vnc", &idx)) + type = proto_redistnum (AFI_IP6, argv[idx]->text); + + if (type < 0) { - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } + vty_out (vty, "Unknown route type%s", VTY_NEWLINE); + return CMD_WARNING; } } - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_tag, - show_ipv6_route_tag_cmd, - "show ipv6 <fib|route> [vrf NAME] tag (1-4294967295)", - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "Show only routes with tag\n" - "Tag value\n") -{ - int idx_vrf = 3; - int idx_name = 4; - int idx_tag = 6; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; - route_tag_t tag = 0; - vrf_id_t vrf_id = VRF_DEFAULT; - bool uf = use_fib(argv[2]); - - if (strmatch(argv[idx_vrf]->text, "vrf")) - { - VRF_GET_ID (vrf_id, argv[idx_name]->arg); - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295); - } - else + if (vrf_all) { - idx_tag -= 2; - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_tag]->arg, 0, 4294967295); - } - - table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show all IPv6 routes with matching tag value. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (rib->tag != tag) - continue; - - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_prefix_longer, - show_ipv6_route_prefix_longer_cmd, - "show ipv6 <fib|route> [vrf NAME] X:X::X:X/M longer-prefixes", - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_CMD_HELP_STR - "IPv6 prefix\n" - "Show route matching the specified Network/Mask pair only\n") -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct prefix p; - int ret; - int first = 1; - vrf_id_t vrf_id = VRF_DEFAULT; - bool uf = use_fib(argv[2]); + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + if ((zvrf = vrf->info) == NULL || + (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) + continue; - if (strmatch(argv[3]->text, "vrf")) - { - VRF_GET_ID (vrf_id, argv[4]->arg); - ret = str2prefix (argv[5]->arg, &p); + do_show_ip_route (vty, zvrf_name (zvrf), AFI_IP6, SAFI_UNICAST, uf, uj, tag, + longer_prefixes ? &p : NULL, supernets_only, type, 0); + } } else { - ret = str2prefix (argv[3]->arg, &p); + vrf = vrf_lookup_by_id (vrf_id); + do_show_ip_route (vty, vrf->name, AFI_IP6, SAFI_UNICAST, uf, uj, tag, + longer_prefixes ? &p : NULL, supernets_only, type, 0); } - - if (! ret) - { - vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); - return CMD_WARNING; - } - - table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv6 routes. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - struct prefix *p, *src_p; - srcdest_rnode_prefixes(rn, &p, &src_p); - - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (prefix_match (p, &rn->p)) - { - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - } - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_protocol, - show_ipv6_route_protocol_cmd, - "show ipv6 <fib|route> [vrf NAME] " FRR_IP6_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_CMD_HELP_STR - FRR_IP6_REDIST_HELP_STR_ZEBRA) -{ - int type; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - int first = 1; - vrf_id_t vrf_id = VRF_DEFAULT; - bool uf = use_fib(argv[2]); - - int idx = 0; - if (argv_find (argv, argc, "NAME", &idx)) - VRF_GET_ID (vrf_id, argv[idx]->arg); - - char *proto = argv[argc - 1]->text; - type = proto_redistnum (AFI_IP6, proto); - - if (type < 0) - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; - } - - table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); - if (! table) - return CMD_SUCCESS; - - /* Show matched type IPv6 routes. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (rib->type == type) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } return CMD_SUCCESS; } @@ -3443,242 +2841,6 @@ DEFUN (show_ipv6_mroute, return CMD_SUCCESS; } - -DEFUN (show_ipv6_route_vrf_all, - show_ipv6_route_vrf_all_cmd, - "show ipv6 <fib|route> vrf all", - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_ALL_CMD_HELP_STR) -{ - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) - continue; - - /* Show all IPv6 route. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_vrf_all_tag, - show_ipv6_route_vrf_all_tag_cmd, - "show ipv6 <fib|route> vrf all tag (1-4294967295)", - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_ALL_CMD_HELP_STR - "Show only routes with tag\n" - "Tag value\n") -{ - int idx_number = 6; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - route_tag_t tag = 0; - bool uf = use_fib(argv[2]); - - if (argv[idx_number]->arg) - VTY_GET_INTEGER_RANGE("tag", tag, argv[idx_number]->arg, 0, 4294967295); - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) - continue; - - /* Show all IPv6 routes with matching tag value. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (rib->tag != tag) - continue; - - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_vrf_all_prefix_longer, - show_ipv6_route_vrf_all_prefix_longer_cmd, - "show ipv6 <fib|route> vrf all X:X::X:X/M longer-prefixes", - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_ALL_CMD_HELP_STR - "IPv6 prefix\n" - "Show route matching the specified Network/Mask pair only\n") -{ - int idx_ipv6_prefixlen = 5; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct prefix p; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int ret; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &p); - if (! ret) - { - vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE); - return CMD_WARNING; - } - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) - continue; - - /* Show matched type IPv6 routes. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - { - struct prefix *p, *src_p; - srcdest_rnode_prefixes(rn, &p, &src_p); - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (prefix_match (p, &rn->p)) - { - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - -DEFUN (show_ipv6_route_vrf_all_protocol, - show_ipv6_route_vrf_all_protocol_cmd, - "show ipv6 <fib|route> vrf all " FRR_IP6_REDIST_STR_ZEBRA, - SHOW_STR - IP_STR - "IPv6 forwarding table\n" - "IPv6 routing table\n" - VRF_ALL_CMD_HELP_STR - FRR_IP6_REDIST_HELP_STR_ZEBRA) -{ - int type; - struct route_table *table; - struct route_node *rn; - struct rib *rib; - struct vrf *vrf; - struct zebra_vrf *zvrf; - int first = 1; - int vrf_header = 1; - bool uf = use_fib(argv[2]); - - char *proto = argv[argc - 1]->text; - type = proto_redistnum (AFI_IP6, proto); - - if (type < 0) - { - vty_out (vty, "Unknown route type%s", VTY_NEWLINE); - return CMD_WARNING; - } - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if ((zvrf = vrf->info) == NULL || - (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL) - continue; - - /* Show matched type IPv6 routes. */ - for (rn = route_top (table); rn; rn = srcdest_route_next (rn)) - RNODE_FOREACH_RIB (rn, rib) - if (rib->type == type) - { - if (uf && !CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB)) - continue; - if (first) - { - vty_out (vty, SHOW_ROUTE_V6_HEADER); - first = 0; - } - - if (vrf_header) - { - vty_out (vty, "%sVRF %s:%s", VTY_NEWLINE, zvrf_name (zvrf), VTY_NEWLINE); - vrf_header = 0; - } - vty_show_ip_route (vty, rn, rib, NULL); - } - vrf_header = 1; - } - - return CMD_SUCCESS; -} - DEFUN (show_ipv6_route_vrf_all_addr, show_ipv6_route_vrf_all_addr_cmd, "show ipv6 route vrf all X:X::X:X", @@ -3843,85 +3005,6 @@ DEFUN (show_ipv6_route_vrf_all_summary_prefix, return CMD_SUCCESS; } -/* Write IPv6 static route configuration. */ -static int -static_config_ipv6 (struct vty *vty) -{ - struct route_node *rn; - struct static_route *si; - int write = 0; - char buf[SRCDEST2STR_BUFFER]; - struct route_table *stable; - struct vrf *vrf; - struct zebra_vrf *zvrf; - - RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) - { - if (!(zvrf = vrf->info)) - continue; - if ((stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL) - continue; - - for (rn = route_top (stable); rn; rn = srcdest_route_next (rn)) - for (si = rn->info; si; si = si->next) - { - vty_out (vty, "ipv6 route %s", srcdest_rnode2str (rn, buf, sizeof buf)); - - switch (si->type) - { - case STATIC_IPV4_GATEWAY: - vty_out (vty, " %s", inet_ntoa (si->addr.ipv4)); - break; - case STATIC_IPV6_GATEWAY: - vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ)); - break; - case STATIC_IFINDEX: - vty_out (vty, " %s", si->ifname); - break; - case STATIC_BLACKHOLE: - vty_out (vty, " Null0" ); - break; - case STATIC_IPV6_GATEWAY_IFINDEX: - vty_out (vty, " %s %s", - inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ), - ifindex2ifname (si->ifindex, si->vrf_id)); - break; - } - - /* flags are incompatible with STATIC_BLACKHOLE */ - if (si->type != STATIC_BLACKHOLE) - { - if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT)) - vty_out (vty, " %s", "reject"); - if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE)) - vty_out (vty, " %s", "blackhole"); - } - - if (si->tag) - vty_out (vty, " tag %"ROUTE_TAG_PRI, si->tag); - - if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT) - vty_out (vty, " %d", si->distance); - - if (si->vrf_id != VRF_DEFAULT) - { - vty_out (vty, " vrf %s", zvrf_name (zvrf)); - } - - /* Label information */ - if (si->snh_label.num_labels) - vty_out (vty, " label %s", - mpls_label2str (si->snh_label.num_labels, - si->snh_label.label, buf, sizeof buf, 0)); - - vty_out (vty, "%s", VTY_NEWLINE); - - write = 1; - } - } - return write; -} - DEFUN (allow_external_route_update, allow_external_route_update_cmd, "allow-external-route-update", @@ -3978,9 +3061,9 @@ zebra_ip_config (struct vty *vty) { int write = 0; - write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route"); - write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute"); - write += static_config_ipv6 (vty); + write += static_config (vty, AFI_IP, SAFI_UNICAST, "ip route"); + write += static_config (vty, AFI_IP, SAFI_MULTICAST, "ip mroute"); + write += static_config (vty, AFI_IP6, SAFI_UNICAST, "ipv6 route"); write += zebra_import_table_config (vty); return write; @@ -4114,17 +3197,12 @@ zebra_vty_init (void) install_element (VIEW_NODE, &show_vrf_cmd); install_element (VIEW_NODE, &show_ip_route_cmd); - install_element (VIEW_NODE, &show_ip_route_ospf_instance_cmd); - install_element (VIEW_NODE, &show_ip_route_tag_cmd); install_element (VIEW_NODE, &show_ip_nht_cmd); install_element (VIEW_NODE, &show_ip_nht_vrf_all_cmd); install_element (VIEW_NODE, &show_ipv6_nht_cmd); install_element (VIEW_NODE, &show_ipv6_nht_vrf_all_cmd); install_element (VIEW_NODE, &show_ip_route_addr_cmd); install_element (VIEW_NODE, &show_ip_route_prefix_cmd); - install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_route_protocol_cmd); - install_element (VIEW_NODE, &show_ip_route_supernets_cmd); install_element (VIEW_NODE, &show_ip_route_summary_cmd); install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd); @@ -4136,15 +3214,8 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &no_ip_route_flags_cmd); install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_cmd); - - install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_addr_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_all_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_all_protocol_cmd); - install_element (VIEW_NODE, &show_ip_route_vrf_all_supernets_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_cmd); install_element (VIEW_NODE, &show_ip_route_vrf_all_summary_prefix_cmd); @@ -4161,25 +3232,17 @@ zebra_vty_init (void) install_element (CONFIG_NODE, &ipv6_nht_default_route_cmd); install_element (CONFIG_NODE, &no_ipv6_nht_default_route_cmd); install_element (VIEW_NODE, &show_ipv6_route_cmd); - install_element (VIEW_NODE, &show_ipv6_route_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_summary_cmd); install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd); install_element (VIEW_NODE, &show_ipv6_route_addr_cmd); install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd); - install_element (VIEW_NODE, &show_ipv6_mroute_cmd); /* Commands for VRF */ - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_tag_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_summary_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_protocol_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_addr_cmd); install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_cmd); - install_element (VIEW_NODE, &show_ipv6_route_vrf_all_prefix_longer_cmd); install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd); } diff --git a/zebra/zserv.c b/zebra/zserv.c index aa08ddc04..e93299d62 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * 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 */ #include <zebra.h> @@ -1398,7 +1397,7 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct { unsigned int i; struct stream *s; - struct in6_addr nexthop; + struct in6_addr nhop_addr; struct rib *rib; u_char message; u_char nexthop_num; @@ -1408,11 +1407,14 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct static struct in6_addr nexthops[MULTIPATH_NUM]; static unsigned int ifindices[MULTIPATH_NUM]; int ret; + static mpls_label_t labels[MULTIPATH_NUM]; + mpls_label_t label; + struct nexthop *nexthop; /* Get input stream. */ s = client->ibuf; - memset (&nexthop, 0, sizeof (struct in6_addr)); + memset (&nhop_addr, 0, sizeof (struct in6_addr)); /* Allocate new rib. */ rib = XCALLOC (MTYPE_RIB, sizeof (struct rib)); @@ -1453,11 +1455,19 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct switch (nexthop_type) { case NEXTHOP_TYPE_IPV6: - stream_get (&nexthop, s, 16); - if (nh_count < multipath_num) { - nexthops[nh_count++] = nexthop; - } - break; + stream_get (&nhop_addr, s, 16); + if (nh_count < MULTIPATH_NUM) + { + /* For labeled-unicast, each nexthop is followed by label. */ + if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL)) + { + label = (mpls_label_t)stream_getl (s); + labels[nh_count] = label; + } + nexthops[nh_count] = nhop_addr; + nh_count++; + } + break; case NEXTHOP_TYPE_IFINDEX: if (if_count < multipath_num) { ifindices[if_count++] = stream_getl (s); @@ -1473,18 +1483,18 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, struct for (i = 0; i < max_nh_if; i++) { if ((i < nh_count) && !IN6_IS_ADDR_UNSPECIFIED (&nexthops[i])) { - if ((i < if_count) && ifindices[i]) { - rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]); - } - else { - rib_nexthop_ipv6_add (rib, &nexthops[i]); - } + if ((i < if_count) && ifindices[i]) + nexthop = rib_nexthop_ipv6_ifindex_add (rib, &nexthops[i], ifindices[i]); + else + nexthop = rib_nexthop_ipv6_add (rib, &nexthops[i]); + + if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL)) + nexthop_add_labels (nexthop, nexthop->nh_label_type, 1, &labels[i]); } else { - if ((i < if_count) && ifindices[i]) { + if ((i < if_count) && ifindices[i]) rib_nexthop_ifindex_add (rib, ifindices[i]); - } - } + } } } @@ -1599,7 +1609,7 @@ zread_ipv6_add (struct zserv *client, u_short length, struct zebra_vrf *zvrf) if (CHECK_FLAG (message, ZAPI_MESSAGE_LABEL)) { label = (mpls_label_t)stream_getl (s); - labels[nh_count++] = label; + labels[nh_count] = label; } nexthops[nh_count++] = nhop_addr; } @@ -2046,10 +2056,7 @@ zread_label_manager_request (int cmd, struct zserv *client, vrf_id_t vrf_id) /* external label manager */ if (lm_is_external) - { - if (zread_relay_label_manager_request (cmd, client) != 0) - zsend_label_manager_connect_response (client, vrf_id, 1); - } + zread_relay_label_manager_request (cmd, client, vrf_id); /* this is a label manager */ else { @@ -2821,6 +2828,28 @@ DEFUN (no_ip_forwarding, return CMD_SUCCESS; } +DEFUN (show_zebra, + show_zebra_cmd, + "show zebra", + SHOW_STR + "Zebra information\n") +{ + struct vrf *vrf; + + vty_out (vty, " Route Route Neighbor LSP LSP%s", VTY_NEWLINE); + vty_out (vty, "VRF Installs Removals Updates Installs Removals%s", VTY_NEWLINE); + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + struct zebra_vrf *zvrf = vrf->info; + vty_out (vty,"%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 "%s", + vrf->name, zvrf->installs, zvrf->removals, + zvrf->neigh_updates, zvrf->lsp_installs, zvrf->lsp_removals, + VTY_NEWLINE); + } + + return CMD_SUCCESS; +} + /* This command is for debugging purpose. */ DEFUN (show_zebra_client, show_zebra_client_cmd, @@ -3009,6 +3038,7 @@ zebra_init (void) install_element (VIEW_NODE, &show_ip_forwarding_cmd); install_element (CONFIG_NODE, &ip_forwarding_cmd); install_element (CONFIG_NODE, &no_ip_forwarding_cmd); + install_element (ENABLE_NODE, &show_zebra_cmd); install_element (ENABLE_NODE, &show_zebra_client_cmd); install_element (ENABLE_NODE, &show_zebra_client_summary_cmd); diff --git a/zebra/zserv.h b/zebra/zserv.h index cd1948373..2fafd040c 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -13,10 +13,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 _ZEBRA_ZSERV_H diff --git a/zebra/zserv_null.c b/zebra/zserv_null.c index 4b52abb22..47518f477 100644 --- a/zebra/zserv_null.c +++ b/zebra/zserv_null.c @@ -14,10 +14,9 @@ * 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. + * 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 */ #include <zebra.h> @@ -30,6 +29,13 @@ #include <zebra_vrf.h> #include <router-id.h> +int +zebra_server_send_message(struct zserv *client) +{ return 0; } + +void zserv_create_header (struct stream *s, uint16_t cmd, vrf_id_t vrf_id) +{ return; } + int zsend_vrf_delete (struct zserv *zserv, struct zebra_vrf *zvrf) { return 0; } |