Fix OpenFlow compilation with modern GCC/glibc and improve install.sh -fw support
code-check / Mininet Code Check (push) Waiting to run
mininet-tests / Mininet Tests (ubuntu-20.04, python2) (push) Waiting to run
mininet-tests / Mininet Tests (ubuntu-20.04, python3) (push) Waiting to run
mininet-tests / Mininet Tests (ubuntu-22.04, python2) (push) Waiting to run
mininet-tests / Mininet Tests (ubuntu-22.04, python3) (push) Waiting to run

This commit is contained in:
2026-08-27 14:09:11 +00:00
parent 6eb8973c0b
commit d9c8f86889
2 changed files with 117 additions and 14 deletions
+23 -8
View File
@@ -242,15 +242,22 @@ function of {
fi fi
# was: git clone git://openflowswitch.org/openflow.git # was: git clone git://openflowswitch.org/openflow.git
# Use our own fork on github for now: # Use our own fork on github for now:
if [ ! -d "openflow" ]; then
git clone https://github.com/mininet/openflow git clone https://github.com/mininet/openflow
fi
cd $BUILD_DIR/openflow cd $BUILD_DIR/openflow
# Patch controller to handle more than 16 switches # Patch controller to handle more than 16 switches and fix modern gcc/glibc issues
patch -p1 < $MININET_DIR/mininet/util/openflow-patches/controller.patch if [ -f "$MININET_DIR/mininet/util/openflow-patches/controller.patch" ]; then
patch -p1 -N -r - < "$MININET_DIR/mininet/util/openflow-patches/controller.patch" || true
fi
if [ -f "$MININET_DIR/mininet/util/openflow-patches/gcc-glibc.patch" ]; then
patch -p1 -N -r - < "$MININET_DIR/mininet/util/openflow-patches/gcc-glibc.patch" || true
fi
# Resume the install: # Resume the install:
./boot.sh ./boot.sh
./configure CFLAGS="-g -O2 -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -Wno-error=format -Wno-error=implicit-function-declaration -Wno-error=address-of-packed-member -Wno-error=discarded-qualifiers" ./configure
make make
sudo make install sudo make install
cd $BUILD_DIR cd $BUILD_DIR
@@ -300,7 +307,7 @@ function of13 {
function install_wireshark { function install_wireshark {
if ! which wireshark; then if ! which wireshark &>/dev/null && ! which tshark &>/dev/null; then
echo "Installing Wireshark" echo "Installing Wireshark"
if [ "$DIST" = "Fedora" -o "$DIST" = "RedHatEnterpriseServer" ]; then if [ "$DIST" = "Fedora" -o "$DIST" = "RedHatEnterpriseServer" ]; then
$install wireshark wireshark-gnome $install wireshark wireshark-gnome
@@ -313,29 +320,37 @@ function install_wireshark {
# Copy coloring rules: OF is white-on-blue: # Copy coloring rules: OF is white-on-blue:
echo "Optionally installing wireshark color filters" echo "Optionally installing wireshark color filters"
mkdir -p $HOME/.wireshark mkdir -p $HOME/.wireshark $HOME/.config/wireshark
cp -n $MININET_DIR/mininet/util/colorfilters $HOME/.wireshark [ -f $MININET_DIR/mininet/util/colorfilters ] && cp -n $MININET_DIR/mininet/util/colorfilters $HOME/.wireshark/ || true
[ -f $MININET_DIR/mininet/util/colorfilters ] && cp -n $MININET_DIR/mininet/util/colorfilters $HOME/.config/wireshark/ || true
echo "Checking Wireshark version" echo "Checking Wireshark version"
WSVER=`wireshark -v | egrep -o '[0-9\.]+' | head -1` WSVER=`(wireshark -v 2>/dev/null || tshark -v 2>/dev/null || true) | grep -i -E 'wireshark|tshark' | egrep -o '[0-9\.]+' | head -1`
if version_ge $WSVER 1.12; then if [ -n "$WSVER" ] && version_ge "$WSVER" 1.12; then
echo "Wireshark version $WSVER >= 1.12 - returning" echo "Wireshark version $WSVER >= 1.12 - returning"
return return
elif which wireshark &>/dev/null || which tshark &>/dev/null; then
echo "Wireshark/TShark is already installed and modern versions include OpenFlow dissectors natively - returning"
return
fi fi
echo "Cloning LoxiGen and building openflow.lua dissector" echo "Cloning LoxiGen and building openflow.lua dissector"
cd $BUILD_DIR cd $BUILD_DIR
if [ ! -d "loxigen" ]; then
git clone https://github.com/floodlight/loxigen.git git clone https://github.com/floodlight/loxigen.git
fi
cd loxigen cd loxigen
make wireshark make wireshark
# Copy into plugin directory # Copy into plugin directory
# libwireshark0/ on 11.04; libwireshark1/ on later # libwireshark0/ on 11.04; libwireshark1/ on later
WSDIR=`find /usr/lib -type d -name 'libwireshark*' | head -1` WSDIR=`find /usr/lib -type d -name 'libwireshark*' | head -1`
if [ -n "$WSDIR" ]; then
WSPLUGDIR=$WSDIR/plugins/ WSPLUGDIR=$WSDIR/plugins/
PLUGIN=loxi_output/wireshark/openflow.lua PLUGIN=loxi_output/wireshark/openflow.lua
sudo cp $PLUGIN $WSPLUGDIR sudo cp $PLUGIN $WSPLUGDIR
echo "Copied openflow plugin $PLUGIN to $WSPLUGDIR" echo "Copied openflow plugin $PLUGIN to $WSPLUGDIR"
fi
cd $BUILD_DIR cd $BUILD_DIR
} }
+88
View File
@@ -0,0 +1,88 @@
diff --git a/lib/backtrace.c b/lib/backtrace.c
index 5b61ffe..f77e489 100644
--- a/lib/backtrace.c
+++ b/lib/backtrace.c
@@ -123,6 +123,6 @@ backtrace_capture(struct backtrace *bt)
}
bt->n_frames = n;
#else
- bt->n_frames = backtrace(bt->frames, BACKTRACE_MAX_FRAMES);
+ bt->n_frames = backtrace((void **)bt->frames, BACKTRACE_MAX_FRAMES);
#endif
}
diff --git a/lib/flow.c b/lib/flow.c
index 523eff0..4a1bf7b 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -44,11 +44,10 @@
#include "vlog.h"
#define THIS_MODULE VLM_flow
-static struct arp_header *
+static struct arp_eth_header *
pull_arp(struct ofpbuf *packet)
{
if (packet->size >= ARP_ETH_HEADER_LEN) {
- struct arp_eth_header *arp = packet->data;
return ofpbuf_pull(packet, ARP_ETH_HEADER_LEN);
}
return NULL;
diff --git a/lib/socket-util.c b/lib/socket-util.c
index c7b5d6d..5b3d602 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/resource.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
#include "fatal-signal.h"
diff --git a/lib/stp.c b/lib/stp.c
index b638311..b81ae53 100644
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -34,6 +34,7 @@
/* Based on sample implementation in 802.1D-1998. Above copyright and license
* applies to all modifications. */
+#include <config.h>
#include "stp.h"
#include <arpa/inet.h>
#include <assert.h>
diff --git a/lib/util.c b/lib/util.c
index 21cc28d..1f341b1 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -138,6 +138,7 @@ xasprintf(const char *format, ...)
return s;
}
+#ifndef HAVE_STRLCPY
void
strlcpy(char *dst, const char *src, size_t size)
{
@@ -148,6 +149,7 @@ strlcpy(char *dst, const char *src, size_t size)
dst[n_copy] = '\0';
}
}
+#endif
void
ofp_fatal(int err_no, const char *format, ...)
diff --git a/lib/util.h b/lib/util.h
index fde681f..dc4e71f 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -34,6 +34,10 @@
#ifndef UTIL_H
#define UTIL_H 1
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>