Merge pull request #178 from opensourcerouting/ospf_lib_private

make libfrrospf private
This commit is contained in:
Donald Sharp 2017-02-07 13:04:13 -05:00 committed by GitHub
commit dbcceee45a
11 changed files with 207 additions and 152 deletions

View File

@ -1,4 +1,3 @@
frr: non-dev-pkg-with-shlib-symlink usr/lib/libfrrospfapiclient.so.0.0.0 usr/lib/libfrrospfapiclient.so
frr: non-dev-pkg-with-shlib-symlink usr/lib/libfrrospf.so.0.0.0 usr/lib/libfrrospf.so
frr: non-dev-pkg-with-shlib-symlink usr/lib/libfrr.so.0.0.0 usr/lib/libfrr.so
frr: package-name-doesnt-match-sonames libfrrospf0 libfrrospfapiclient0 libfrr0

View File

@ -1,16 +1,17 @@
## Automake.am for OSPF API client
AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
AM_CFLAGS = $(WERROR)
lib_LTLIBRARIES = libfrrospfapiclient.la
libfrrospfapiclient_la_LDFLAGS = -version-info 0:0:0
libfrrospfapiclient_la_LIBADD = ../ospfd/libfrrospf.la ../lib/libfrr.la
libfrrospfapiclient_la_LIBADD = ../lib/libfrr.la
sbin_PROGRAMS = ospfclient
libfrrospfapiclient_la_SOURCES = \
ospf_apiclient.c
ospf_apiclient.c ../ospfd/ospf_dump_api.c ../ospfd/ospf_api.c
ospfapiheaderdir = $(pkgincludedir)/ospfapi
@ -21,7 +22,7 @@ ospfclient_SOURCES = \
ospfclient.c
ospfclient_LDADD = libfrrospfapiclient.la \
../ospfd/libfrrospf.la ../lib/libfrr.la @LIBCAP@
../lib/libfrr.la @LIBCAP@
ospfclient_CFLAGS = $(AM_CFLAGS)
ospfclient_LDFLAGS = $(AM_LDFLAGS)

View File

@ -49,7 +49,8 @@
#include "ospf_apiclient.h"
DEFINE_MTYPE_STATIC(OSPFD, OSPF_APICLIENT, "OSPF-API client")
DEFINE_MGROUP(OSPFCLIENT, "libospfapiclient")
DEFINE_MTYPE_STATIC(OSPFCLIENT, OSPF_APICLIENT, "OSPF-API client")
/* Backlog for listen */
#define BACKLOG 5

View File

@ -5,25 +5,23 @@ AM_CFLAGS = $(WERROR)
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
lib_LTLIBRARIES = libfrrospf.la
libfrrospf_la_LDFLAGS = -version-info 0:0:0
libfrrospf_la_LIBADD = ../lib/libfrr.la
noinst_LIBRARIES = libfrrospf.a
sbin_PROGRAMS = ospfd
libfrrospf_la_SOURCES = \
libfrrospf_a_SOURCES = \
ospfd.c ospf_zebra.c ospf_interface.c ospf_ism.c ospf_neighbor.c \
ospf_nsm.c ospf_dump.c ospf_network.c ospf_packet.c ospf_lsa.c \
ospf_spf.c ospf_route.c ospf_ase.c ospf_abr.c ospf_ia.c ospf_flood.c \
ospf_lsdb.c ospf_asbr.c ospf_routemap.c ospf_snmp.c \
ospf_opaque.c ospf_te.c ospf_ri.c ospf_vty.c ospf_api.c ospf_apiserver.c \
ospf_bfd.c ospf_memory.c
ospf_bfd.c ospf_memory.c ospf_dump_api.c
ospfdheaderdir = $(pkgincludedir)/ospfd
ospfdheader_HEADERS = \
ospf_api.h ospf_asbr.h ospf_dump.h ospf_lsa.h ospf_lsdb.h \
ospf_nsm.h ospf_ism.h ospf_opaque.h ospfd.h
ospf_nsm.h ospf_ism.h ospf_opaque.h ospfd.h \
ospf_dump_api.h
noinst_HEADERS = \
ospf_interface.h ospf_neighbor.h ospf_network.h ospf_packet.h \
@ -33,7 +31,7 @@ noinst_HEADERS = \
ospfd_SOURCES = ospf_main.c
ospfd_LDADD = libfrrospf.la ../lib/libfrr.la @LIBCAP@ @LIBM@
ospfd_LDADD = libfrrospf.a ../lib/libfrr.la @LIBCAP@ @LIBM@
EXTRA_DIST = OSPF-MIB.txt OSPF-TRAP-MIB.txt ChangeLog.opaque.txt

View File

@ -42,89 +42,6 @@
#include "ospfd/ospf_packet.h"
#include "ospfd/ospf_network.h"
const struct message ospf_ism_state_msg[] =
{
{ ISM_DependUpon, "DependUpon" },
{ ISM_Down, "Down" },
{ ISM_Loopback, "Loopback" },
{ ISM_Waiting, "Waiting" },
{ ISM_PointToPoint, "Point-To-Point" },
{ ISM_DROther, "DROther" },
{ ISM_Backup, "Backup" },
{ ISM_DR, "DR" },
};
const int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
const struct message ospf_nsm_state_msg[] =
{
{ NSM_DependUpon, "DependUpon" },
{ NSM_Deleted, "Deleted" },
{ NSM_Down, "Down" },
{ NSM_Attempt, "Attempt" },
{ NSM_Init, "Init" },
{ NSM_TwoWay, "2-Way" },
{ NSM_ExStart, "ExStart" },
{ NSM_Exchange, "Exchange" },
{ NSM_Loading, "Loading" },
{ NSM_Full, "Full" },
};
const int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
const struct message ospf_lsa_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "unknown" },
{ OSPF_ROUTER_LSA, "router-LSA" },
{ OSPF_NETWORK_LSA, "network-LSA" },
{ OSPF_SUMMARY_LSA, "summary-LSA" },
{ OSPF_ASBR_SUMMARY_LSA, "summary-LSA" },
{ OSPF_AS_EXTERNAL_LSA, "AS-external-LSA" },
{ OSPF_GROUP_MEMBER_LSA, "GROUP MEMBER LSA" },
{ OSPF_AS_NSSA_LSA, "NSSA-LSA" },
{ 8, "Type-8 LSA" },
{ OSPF_OPAQUE_LINK_LSA, "Link-Local Opaque-LSA" },
{ OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" },
{ OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" },
};
const int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
const struct message ospf_link_state_id_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "(unknown)" },
{ OSPF_ROUTER_LSA, "" },
{ OSPF_NETWORK_LSA, "(address of Designated Router)" },
{ OSPF_SUMMARY_LSA, "(summary Network Number)" },
{ OSPF_ASBR_SUMMARY_LSA, "(AS Boundary Router address)" },
{ OSPF_AS_EXTERNAL_LSA, "(External Network Number)" },
{ OSPF_GROUP_MEMBER_LSA, "(Group membership information)" },
{ OSPF_AS_NSSA_LSA, "(External Network Number for NSSA)" },
{ 8, "(Type-8 LSID)" },
{ OSPF_OPAQUE_LINK_LSA, "(Link-Local Opaque-Type/ID)" },
{ OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" },
{ OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" },
};
const int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
const struct message ospf_network_type_msg[] =
{
{ OSPF_IFTYPE_NONE, "NONE" },
{ OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" },
{ OSPF_IFTYPE_BROADCAST, "Broadcast" },
{ OSPF_IFTYPE_NBMA, "NBMA" },
{ OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" },
{ OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" },
};
const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
/* AuType */
const struct message ospf_auth_type_str[] =
{
{ OSPF_AUTH_NULL, "Null" },
{ OSPF_AUTH_SIMPLE, "Simple" },
{ OSPF_AUTH_CRYPTOGRAPHIC, "Cryptographic" },
};
const size_t ospf_auth_type_str_max = sizeof (ospf_auth_type_str) /
sizeof (ospf_auth_type_str[0]);
/* Configuration debug option variables. */
unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
unsigned long conf_debug_ospf_event = 0;
@ -322,25 +239,6 @@ ospf_timer_dump (struct thread *t, char *buf, size_t size)
return ospf_timeval_dump (&result, buf, size);
}
#define OSPF_OPTION_STR_MAXLEN 24
char *
ospf_options_dump (u_char options)
{
static char buf[OSPF_OPTION_STR_MAXLEN];
snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s",
(options & OSPF_OPTION_O) ? "O" : "-",
(options & OSPF_OPTION_DC) ? "DC" : "-",
(options & OSPF_OPTION_EA) ? "EA" : "-",
(options & OSPF_OPTION_NP) ? "N/P" : "-",
(options & OSPF_OPTION_MC) ? "MC" : "-",
(options & OSPF_OPTION_E) ? "E" : "-",
(options & OSPF_OPTION_MT) ? "M/T" : "-");
return buf;
}
static void
ospf_packet_hello_dump (struct stream *s, u_int16_t length)
{
@ -378,24 +276,6 @@ ospf_dd_flags_dump (u_char flags, char *buf, size_t size)
return buf;
}
void
ospf_lsa_header_dump (struct lsa_header *lsah)
{
const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
zlog_debug (" LSA Header");
zlog_debug (" LS age %d", ntohs (lsah->ls_age));
zlog_debug (" Options %d (%s)", lsah->options,
ospf_options_dump (lsah->options));
zlog_debug (" LS type %d (%s)", lsah->type,
(lsah->type ? lsah_type : "unknown type"));
zlog_debug (" Link State ID %s", inet_ntoa (lsah->id));
zlog_debug (" Advertising Router %s", inet_ntoa (lsah->adv_router));
zlog_debug (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
zlog_debug (" LS checksum 0x%x", ntohs (lsah->checksum));
zlog_debug (" length %d", ntohs (lsah->length));
}
static char *
ospf_router_lsa_flags_dump (u_char flags, char *buf, size_t size)
{

View File

@ -126,20 +126,16 @@ extern unsigned long term_debug_ospf_te;
/* Message Strings. */
extern char *ospf_lsa_type_str[];
extern const struct message ospf_auth_type_str[];
extern const size_t ospf_auth_type_str_max;
/* Prototypes. */
extern const char *ospf_area_name_string (struct ospf_area *);
extern const char *ospf_area_desc_string (struct ospf_area *);
extern const char *ospf_if_name_string (struct ospf_interface *);
extern void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t);
extern char *ospf_options_dump (u_char);
extern const char *ospf_timer_dump (struct thread *, char *, size_t);
extern const char *ospf_timeval_dump (struct timeval *, char *, size_t);
extern void ospf_ip_header_dump (struct ip *);
extern void ospf_packet_dump (struct stream *);
extern void ospf_lsa_header_dump (struct lsa_header *);
extern void debug_init (void);
/* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */

151
ospfd/ospf_dump_api.c Normal file
View File

@ -0,0 +1,151 @@
/*
* OSPFd dump routine (parts used by ospfclient).
* Copyright (C) 1999, 2000 Toshiaki Takada
*
* This file is part of FreeRangeRouting (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.
*/
#include <zebra.h>
#include "log.h"
#include "prefix.h"
#include "ospf_dump_api.h"
#include "ospfd.h"
#include "ospf_asbr.h"
#include "ospf_lsa.h"
#include "ospf_nsm.h"
#include "ospf_ism.h"
const struct message ospf_ism_state_msg[] =
{
{ ISM_DependUpon, "DependUpon" },
{ ISM_Down, "Down" },
{ ISM_Loopback, "Loopback" },
{ ISM_Waiting, "Waiting" },
{ ISM_PointToPoint, "Point-To-Point" },
{ ISM_DROther, "DROther" },
{ ISM_Backup, "Backup" },
{ ISM_DR, "DR" },
};
const int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
const struct message ospf_nsm_state_msg[] =
{
{ NSM_DependUpon, "DependUpon" },
{ NSM_Deleted, "Deleted" },
{ NSM_Down, "Down" },
{ NSM_Attempt, "Attempt" },
{ NSM_Init, "Init" },
{ NSM_TwoWay, "2-Way" },
{ NSM_ExStart, "ExStart" },
{ NSM_Exchange, "Exchange" },
{ NSM_Loading, "Loading" },
{ NSM_Full, "Full" },
};
const int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
const struct message ospf_lsa_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "unknown" },
{ OSPF_ROUTER_LSA, "router-LSA" },
{ OSPF_NETWORK_LSA, "network-LSA" },
{ OSPF_SUMMARY_LSA, "summary-LSA" },
{ OSPF_ASBR_SUMMARY_LSA, "summary-LSA" },
{ OSPF_AS_EXTERNAL_LSA, "AS-external-LSA" },
{ OSPF_GROUP_MEMBER_LSA, "GROUP MEMBER LSA" },
{ OSPF_AS_NSSA_LSA, "NSSA-LSA" },
{ 8, "Type-8 LSA" },
{ OSPF_OPAQUE_LINK_LSA, "Link-Local Opaque-LSA" },
{ OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" },
{ OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" },
};
const int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
const struct message ospf_link_state_id_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "(unknown)" },
{ OSPF_ROUTER_LSA, "" },
{ OSPF_NETWORK_LSA, "(address of Designated Router)" },
{ OSPF_SUMMARY_LSA, "(summary Network Number)" },
{ OSPF_ASBR_SUMMARY_LSA, "(AS Boundary Router address)" },
{ OSPF_AS_EXTERNAL_LSA, "(External Network Number)" },
{ OSPF_GROUP_MEMBER_LSA, "(Group membership information)" },
{ OSPF_AS_NSSA_LSA, "(External Network Number for NSSA)" },
{ 8, "(Type-8 LSID)" },
{ OSPF_OPAQUE_LINK_LSA, "(Link-Local Opaque-Type/ID)" },
{ OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" },
{ OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" },
};
const int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
const struct message ospf_network_type_msg[] =
{
{ OSPF_IFTYPE_NONE, "NONE" },
{ OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" },
{ OSPF_IFTYPE_BROADCAST, "Broadcast" },
{ OSPF_IFTYPE_NBMA, "NBMA" },
{ OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" },
{ OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" },
};
const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
/* AuType */
const struct message ospf_auth_type_str[] =
{
{ OSPF_AUTH_NULL, "Null" },
{ OSPF_AUTH_SIMPLE, "Simple" },
{ OSPF_AUTH_CRYPTOGRAPHIC, "Cryptographic" },
};
const size_t ospf_auth_type_str_max = sizeof (ospf_auth_type_str) /
sizeof (ospf_auth_type_str[0]);
#define OSPF_OPTION_STR_MAXLEN 24
char *
ospf_options_dump (u_char options)
{
static char buf[OSPF_OPTION_STR_MAXLEN];
snprintf (buf, OSPF_OPTION_STR_MAXLEN, "*|%s|%s|%s|%s|%s|%s|%s",
(options & OSPF_OPTION_O) ? "O" : "-",
(options & OSPF_OPTION_DC) ? "DC" : "-",
(options & OSPF_OPTION_EA) ? "EA" : "-",
(options & OSPF_OPTION_NP) ? "N/P" : "-",
(options & OSPF_OPTION_MC) ? "MC" : "-",
(options & OSPF_OPTION_E) ? "E" : "-",
(options & OSPF_OPTION_MT) ? "M/T" : "-");
return buf;
}
void
ospf_lsa_header_dump (struct lsa_header *lsah)
{
const char *lsah_type = LOOKUP (ospf_lsa_type_msg, lsah->type);
zlog_debug (" LSA Header");
zlog_debug (" LS age %d", ntohs (lsah->ls_age));
zlog_debug (" Options %d (%s)", lsah->options,
ospf_options_dump (lsah->options));
zlog_debug (" LS type %d (%s)", lsah->type,
(lsah->type ? lsah_type : "unknown type"));
zlog_debug (" Link State ID %s", inet_ntoa (lsah->id));
zlog_debug (" Advertising Router %s", inet_ntoa (lsah->adv_router));
zlog_debug (" LS sequence number 0x%lx", (u_long)ntohl (lsah->ls_seqnum));
zlog_debug (" LS checksum 0x%x", ntohs (lsah->checksum));
zlog_debug (" length %d", ntohs (lsah->length));
}

43
ospfd/ospf_dump_api.h Normal file
View File

@ -0,0 +1,43 @@
/*
* OSPFd dump routine (parts used by ospfclient).
* Copyright (C) 1999 Toshiaki Takada
*
* This file is part of FreeRangeRouting (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 _ZEBRA_OSPF_DUMP_API_H
#define _ZEBRA_OSPF_DUMP_API_H
#include "log.h"
struct lsa_header;
extern const struct message ospf_ism_state_msg[];
extern const struct message ospf_nsm_state_msg[];
extern const struct message ospf_lsa_type_msg[];
extern const struct message ospf_link_state_id_type_msg[];
extern const struct message ospf_network_type_msg[];
extern const struct message ospf_auth_type_str[];
extern const int ospf_ism_state_msg_max;
extern const int ospf_nsm_state_msg_max;
extern const int ospf_lsa_type_msg_max;
extern const int ospf_link_state_id_type_msg_max;
extern const int ospf_network_type_msg_max;
extern const size_t ospf_auth_type_str_max;
extern char *ospf_options_dump (u_char);
extern void ospf_lsa_header_dump (struct lsa_header *);
#endif /* _ZEBRA_OSPF_DUMP_API_H */

View File

@ -30,6 +30,7 @@
#include "log.h"
#include "ospf_memory.h"
#include "ospf_dump_api.h"
#define OSPF_VERSION 2
@ -506,17 +507,7 @@ struct ospf_nbr_nbma
/* Extern variables. */
extern struct ospf_master *om;
extern const struct message ospf_ism_state_msg[];
extern const struct message ospf_nsm_state_msg[];
extern const struct message ospf_lsa_type_msg[];
extern const struct message ospf_link_state_id_type_msg[];
extern const struct message ospf_network_type_msg[];
extern const int ospf_ism_state_msg_max;
extern const int ospf_nsm_state_msg_max;
extern const int ospf_lsa_type_msg_max;
extern const int ospf_link_state_id_type_msg_max;
extern const int ospf_redistributed_proto_max;
extern const int ospf_network_type_msg_max;
extern struct zclient *zclient;
extern struct thread_master *master;
extern int ospf_zlog;

View File

@ -3,8 +3,6 @@ i depend=$abs_builddir/depend.dev
i copying=$abs_top_srcdir/COPYING
f none @libdir@/libfrr.la=$DESTDIR/@libdir@/libfrr.la 0755 root bin
f none @libdir@/libfrr.a=$DESTDIR/@libdir@/libfrr.a 0644 root bin
f none @libdir@/libfrrospf.la=$DESTDIR/@libdir@/libfrrospf.la 0755 root bin
f none @libdir@/libfrrospf.a=$DESTDIR/@libdir@/libfrrospf.a 0644 root bin
f none @libdir@/libfrrospfapiclient.la=$DESTDIR/@libdir@/libfrrospfapiclient.la 0755 root bin
f none @libdir@/libfrrospfapiclient.a=$DESTDIR/@libdir@/libfrrospfapiclient.a 0644 root bin
d none @includedir@=$DESTDIR/@includedir@ 0755 root bin

View File

@ -5,9 +5,6 @@ d none @libdir@=$DESTDIR/@libdir@ 0755 root bin
s none @libdir@/libfrr.so.0=libfrr.so.0.0.0
f none @libdir@/libfrr.so.0.0.0=$DESTDIR/@libdir@/libfrr.so.0.0.0 0755 root bin
s none @libdir@/libfrr.so=libfrr.so.0.0.0
s none @libdir@/libfrrospf.so.0=libfrrospf.so.0.0.0
f none @libdir@/libfrrospf.so.0.0.0=$DESTDIR/@libdir@/libfrrospf.so.0.0.0 0755 root bin
s none @libdir@/libfrrospf.so=libfrrospf.so.0.0.0
f none @libdir@/libfrrospfapiclient.so.0.0.0=$DESTDIR/@libdir@/libfrrospfapiclient.so.0.0.0 0755 root bin
s none @libdir@/libfrrospfapiclient.so.0=libfrrospfapiclient.so.0.0.0
s none @libdir@/libfrrospfapiclient.so=libfrrospfapiclient.so.0.0.0