Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bg/n-acd-update: update n-acd code from upstream #195

Merged
merged 8 commits into from Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -48,7 +48,7 @@ addons:
coverity_scan:
project:
name: NetworkManager/NetworkManager
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs --without-ebpf
build_command: make -j4
branch_pattern: .*coverity.*

Expand Down Expand Up @@ -114,6 +114,7 @@ script:
-D ifcfg_rh=false \
-D ibft=true \
-D ifupdown=true \
-D ebpf=false \
&&
ninja -C build &&
ninja -C build test
Expand All @@ -136,6 +137,7 @@ script:
--enable-more-warnings=no \
--enable-tests=yes \
--with-crypto=$CRYPTO \
--without-ebpf \
\
--with-libnm-glib=yes \
--with-iwd=yes \
Expand Down
34 changes: 32 additions & 2 deletions Makefile.am
Expand Up @@ -1347,20 +1347,50 @@ shared_libcsiphash_la_SOURCES = \

###############################################################################

noinst_LTLIBRARIES += shared/libcrbtree.la

shared_libcrbtree_la_CFLAGS = $(AM_CFLAGS) -std=c11

shared_libcrbtree_la_CPPFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
$(NULL)

shared_libcrbtree_la_SOURCES = \
shared/c-rbtree/src/c-rbtree.c \
shared/c-rbtree/src/c-rbtree.h \
shared/c-rbtree/src/c-rbtree-private.h

###############################################################################

noinst_LTLIBRARIES += shared/libnacd.la

shared_libnacd_la_CFLAGS = -std=gnu99
shared_libnacd_la_CFLAGS = $(AM_CFLAGS) -std=c11 -Wno-pointer-arith -Wno-vla
shared_libnacd_la_LIBADD = shared/libcrbtree.la

shared_libnacd_la_CPPFLAGS = \
-D_GNU_SOURCE \
-DSO_ATTACH_BPF=50 \
$(CODE_COVERAGE_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
-I$(srcdir)/shared/c-list/src \
-I$(srcdir)/shared/c-siphash/src \
-I$(srcdir)/shared/c-rbtree/src \
$(NULL)

shared_libnacd_la_SOURCES = \
shared/n-acd/src/n-acd.c \
shared/n-acd/src/n-acd.h
shared/n-acd/src/n-acd.h \
shared/n-acd/src/n-acd-private.h \
shared/n-acd/src/n-acd-probe.c \
shared/n-acd/src/util/timer.c \
shared/n-acd/src/util/timer.h

if WITH_EBPF
shared_libnacd_la_SOURCES += shared/n-acd/src/n-acd-bpf.c
else
shared_libnacd_la_SOURCES += shared/n-acd/src/n-acd-bpf-fallback.c
endif

EXTRA_DIST += shared/c-list/src/c-list.h

Expand Down
15 changes: 13 additions & 2 deletions configure.ac
Expand Up @@ -518,6 +518,15 @@ case $with_suspend_resume in
;;
esac

# eBPF support
AC_ARG_WITH(ebpf,
AS_HELP_STRING([--with-ebpf=yes|no], [Build with eBPF support (default: yes)]),
[], [with_ebpf=yes])
if test "$with_ebpf" != "yes" -a "$with_ebpf" != "no"; then
AC_MSG_ERROR(--with-ebpf must be one of [yes, no])
fi
AM_CONDITIONAL(WITH_EBPF, test "${with_ebpf}" = "yes")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we autodetect support, and only provide the --with-ebpf option if somebody needs to change the autodetection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ebpf is supported since kernel 3.19, which is more than 3 years old.
I think defaulting to yes is fine, while still allowing to disable it explicitly.


# SELinux support
AC_ARG_WITH(selinux,
AS_HELP_STRING([--with-selinux=yes|no|auto], [Build with SELinux (default: auto)]),
Expand Down Expand Up @@ -1043,15 +1052,15 @@ else
more_logging_default=no
fi

NM_COMPILER_WARNINGS(CFLAGS, ${more_warnings_default})
NM_COMPILER_WARNINGS(AM_CFLAGS, ${more_warnings_default})

NM_COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end")
AC_SUBST(LIBSYSTEMD_NM_CFLAGS)

CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-fno-strict-aliasing \
])
CFLAGS="$CFLAGS $with_cflags"
AM_CFLAGS="$AM_CFLAGS $with_cflags"

AC_ARG_ENABLE(more-asserts,
AS_HELP_STRING([--enable-more-asserts],
Expand Down Expand Up @@ -1248,6 +1257,7 @@ fi

AM_CONDITIONAL(BUILD_DOCS, test "$build_docs" = "yes")
AM_CONDITIONAL(HAVE_DOCS, test "$build_docs" = "yes" -o "$use_pregen_docs" = "yes")
AC_SUBST(AM_CFLAGS)

AC_CONFIG_FILES([
Makefile
Expand Down Expand Up @@ -1352,4 +1362,5 @@ echo " JSON validation for libnm: $enable_json_validation"
echo " crypto: $with_crypto (have-gnutls: $have_crypto_gnutls, have-nss: $have_crypto_nss)"
echo " sanitizers: $sanitizers"
echo " Mozilla Public Suffix List: $with_libpsl"
echo " eBPF: $with_ebpf"
echo
10 changes: 5 additions & 5 deletions m4/compiler_options.m4
Expand Up @@ -31,7 +31,7 @@ AC_DEFUN([NM_COMPILER_FLAG], [

dnl Check whether a particular warning is not emitted with code provided,
dnl append an option to disable the warning to a specified variable if the check fails.
dnl NM_COMPILER_WARNING([ENV-VAR], [C-SNIPPET], [WARNING]])
dnl NM_COMPILER_WARNING([ENV-VAR], [WARNING], [C-SNIPPET])
AC_DEFUN([NM_COMPILER_WARNING], [
_NM_COMPILER_FLAG([-W$2], [$3], [eval "AS_TR_SH([$1])='$$1 -W$2'"], [eval "AS_TR_SH([$1])='$$1 -Wno-$2'"])
])
Expand All @@ -47,10 +47,10 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then

dnl This is enabled in clang by default, makes little sense,
dnl and causes the build to abort with -Werror.
CFLAGS_SAVED="$$1"
eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], [], eval "AS_TR_SH([$1])='$CFLAGS_SAVED'")
unset CFLAGS_SAVED
CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS -Qunused-arguments"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'", [])
CFLAGS="$CFLAGS_SAVED"

dnl clang only warns about unknown warnings, unless
dnl called with "-Werror=unknown-warning-option"
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Expand Up @@ -41,6 +41,7 @@ option('libnm_glib', type: 'boolean', value: false, description: 'build legacy l
option('nmcli', type: 'boolean', value: true, description: 'Build nmcli')
option('nmtui', type: 'boolean', value: true, description: 'Build nmtui')
option('bluez5_dun', type: 'boolean', value: false, description: 'enable Bluez5 DUN support')
option('ebpf', type: 'boolean', value: true, description: 'Enable or disable eBPF support')

# configuration plugins
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
Expand Down
12 changes: 12 additions & 0 deletions shared/c-rbtree/.cherryci/ci-test
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

rm -Rf "./ci-build"
mkdir "./ci-build"
cd "./ci-build"

${CHERRY_LIB_MESONSETUP} . "${CHERRY_LIB_SRCDIR}"
${CHERRY_LIB_NINJABUILD}
CRBTREE_TEST_PTRACE=1 ${CHERRY_LIB_MESONTEST}
(( ! CHERRY_LIB_VALGRIND )) || ${CHERRY_LIB_MESONTEST} "--wrapper=${CHERRY_LIB_VALGRINDWRAP}"
11 changes: 11 additions & 0 deletions shared/c-rbtree/.editorconfig
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{c,h}]
indent_style = space
indent_size = 8
21 changes: 21 additions & 0 deletions shared/c-rbtree/.travis.yml
@@ -0,0 +1,21 @@
os: linux
dist: trusty
language: c

services:
- docker

before_install:
- curl -O -L "https://raw.githubusercontent.com/cherry-pick/cherry-images/v1/scripts/vmrun"
- curl -O -L "https://raw.githubusercontent.com/cherry-pick/cherry-ci/v1/scripts/cherryci"
- chmod +x "./vmrun" "./cherryci"

jobs:
include:
- stage: test
script:
- ./vmrun -- ../src/cherryci -d ../src/.cherryci -s c-util -m
- script:
- ./vmrun -T armv7hl -- ../src/cherryci -d ../src/.cherryci -s c-util
- script:
- ./vmrun -T i686 -- ../src/cherryci -d ../src/.cherryci -s c-util
37 changes: 37 additions & 0 deletions shared/c-rbtree/AUTHORS
@@ -0,0 +1,37 @@
LICENSE:
This project is dual-licensed under both the Apache License, Version
2.0, and the GNU Lesser General Public License, Version 2.1+.

AUTHORS-ASL:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

AUTHORS-LGPL:
This program 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.

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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.

COPYRIGHT: (ordered alphabetically)
Copyright (C) 2015-2018 Red Hat, Inc.

AUTHORS: (ordered alphabetically)
David Herrmann <dh.herrmann@gmail.com>
Tom Gundersen <teg@jklm.no>