]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Do not build mlag protobuf support if version 3 is not avail
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 10 Dec 2019 19:06:33 +0000 (14:06 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 15 Dec 2019 14:37:51 +0000 (09:37 -0500)
Older versions of protobuf-c do not support version 3 of the
protocol.  Add a check into the system to see if we have
version 3 available and if so, compile it in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
configure.ac
mlag/subdir.am
zebra/subdir.am
zebra/zebra_mlag.c
zebra/zebra_mlag.h
zebra/zebra_mlag_vty.c
zebra/zebra_mlag_vty.h [new file with mode: 0644]

index 34c8bb6932f709771d5c6e90e9dc1a1debf7320a..0bfcc833fafe357f954306c216043fa94937716e 100755 (executable)
@@ -1159,6 +1159,7 @@ dnl ##########################################################################
 #
 # Logic for protobuf support.
 #
+PROTO3=false
 if test "$enable_protobuf" = "yes"; then
   # Check for protoc & protoc-c
 
@@ -1173,9 +1174,15 @@ if test "$enable_protobuf" = "yes"; then
   PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c >= 0.14],, [
     AC_MSG_FAILURE([protobuf requested but libprotobuf-c not found.  Install protobuf-c.])
   ])
-  AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h], [], [
-    AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found.  Install protobuf-c.])
-  ])
+
+  PROTO3=true
+  AC_CHECK_HEADER([google/protobuf-c/protobuf-c.h],
+                  [AC_CHECK_DECLS(PROTOBUF_C_LABEL_NONE,
+                                  AC_DEFINE([HAVE_PROTOBUF_VERSION_3],
+                                            [1], [Have Protobuf version 3]),
+                                  [PROTO3=false],
+                                  [#include <google/protobuf-c/protobuf-c.h>])],
+                  [PROTO3=false && AC_MSG_FAILURE([protobuf requested but protobuf-c.h not found.  Install protobuf-c.])])
 
   AC_DEFINE([HAVE_PROTOBUF], [1], [protobuf])
 fi
@@ -2271,6 +2278,7 @@ AM_CONDITIONAL([SNMP], [test "x$SNMP_METHOD" = "xagentx"])
 AM_CONDITIONAL([IRDP], [$IRDP])
 AM_CONDITIONAL([FPM], [test "x$enable_fpm" = "xyes"])
 AM_CONDITIONAL([HAVE_PROTOBUF], [test "x$enable_protobuf" = "xyes"])
+AM_CONDITIONAL([HAVE_PROTOBUF3], [$PROTO3])
 dnl daemons
 AM_CONDITIONAL([VTYSH], [test "x$VTYSH" = "xvtysh"])
 AM_CONDITIONAL([ZEBRA], [test "${enable_zebra}" != "no"])
index 9fab662860884325fe7d5649aa25ade200806d3e..49d176150557a81a4a3bccc01e8a1c1fe69d1a7b 100644 (file)
@@ -1,4 +1,4 @@
-if HAVE_PROTOBUF
+if HAVE_PROTOBUF3
 lib_LTLIBRARIES += mlag/libmlag_pb.la
 endif
 
index 99e3643088b12984bc3661cede88f1198432deaa..916f6cb5d1f1e7af575afefa200fc9368d3f3e40 100644 (file)
@@ -41,7 +41,7 @@ man8 += $(MANBUILD)/zebra.8
 endif
 
 zebra_zebra_LDADD = lib/libfrr.la $(LIBCAP)
-if HAVE_PROTOBUF
+if HAVE_PROTOBUF3
 zebra_zebra_LDADD += mlag/libmlag_pb.la $(PROTOBUF_C_LIBS)
 endif
 zebra_zebra_SOURCES = \
@@ -137,6 +137,7 @@ noinst_HEADERS += \
        zebra/rtadv.h \
        zebra/rule_netlink.h \
        zebra/zebra_mlag.h \
+       zebra/zebra_mlag_vty.h \
        zebra/zebra_fpm_private.h \
        zebra/zebra_l2.h \
        zebra/zebra_dplane.h \
index 021a52c3a5fb1cc342edc9be7425d83692c9841d..f6bd5f458647be6a8ba05beff7efc61d0206499d 100644 (file)
@@ -27,6 +27,7 @@
 #include "mlag.h"
 
 #include "zebra/zebra_mlag.h"
+#include "zebra/zebra_mlag_vty.h"
 #include "zebra/zebra_router.h"
 #include "zebra/zebra_memory.h"
 #include "zebra/zapi_msg.h"
@@ -653,7 +654,7 @@ void zebra_mlag_terminate(void)
  *  ProtoBuf Encoding APIs
  */
 
-#ifdef HAVE_PROTOBUF
+#ifdef HAVE_PROTOBUF_VERSION_3
 
 DEFINE_MTYPE_STATIC(ZEBRA, MLAG_PBUF, "ZEBRA MLAG PROTOBUF")
 
index b95f5a5d50eda4a4868ad5a034912aa97e84861b..c35fa15561c6745671e7e97c980684d7de766bc0 100644 (file)
@@ -26,7 +26,7 @@
 #include "zclient.h"
 #include "zebra/zserv.h"
 
-#ifdef HAVE_PROTOBUF
+#ifdef HAVE_PROTOBUF_VERSION_3
 #include "mlag/mlag.pb-c.h"
 #endif
 
@@ -64,8 +64,6 @@ void zebra_mlag_send_register(void);
 void zebra_mlag_send_deregister(void);
 void zebra_mlag_handle_process_state(enum zebra_mlag_state state);
 void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len);
-int32_t zebra_mlag_test_mlag_internal(const char *none, const char *primary,
-                                     const char *secondary);
 
 /*
  * ProtoBuffer Api's
@@ -74,5 +72,4 @@ int zebra_mlag_protobuf_encode_client_data(struct stream *s,
                                           uint32_t *msg_type);
 int zebra_mlag_protobuf_decode_message(struct stream *s, uint8_t *data,
                                       uint32_t len);
-void zebra_mlag_vty_init(void);
 #endif
index 0eb3be5011c52ff0b1508fb76cdbb0c1897b0aeb..ebaaf03dabc8d8bf37cdf913bd4a5a6a1b716873 100644 (file)
@@ -25,7 +25,7 @@
 #include "command.h"
 
 #include "zebra_router.h"
-#include "zebra_mlag.h"
+#include "zebra_mlag_vty.h"
 #include "debug.h"
 #include "zapi_msg.h"
 
diff --git a/zebra/zebra_mlag_vty.h b/zebra/zebra_mlag_vty.h
new file mode 100644 (file)
index 0000000..c3dfdf7
--- /dev/null
@@ -0,0 +1,31 @@
+/* Zebra Mlag vty Code.
+ * Copyright (C) 2019 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 __ZEBRA_MLAG_VTY_CODE__
+#define __ZEBRA_MLAG_VTY_CODE__
+
+extern int32_t zebra_mlag_test_mlag_internal(const char *none,
+                                            const char *primary,
+                                            const char *secondary);
+
+extern void zebra_mlag_vty_init(void);
+
+#endif