summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-06-03 22:11:43 +0200
committerThomas Haller <thaller@redhat.com>2020-06-03 22:11:43 +0200
commit2a30e4b75b51b3248bf95a44788d5c8c1569510c (patch)
treeedd16071acdc2f84ba37e4b3352b4074bdaff47d
parent90a0edce0614aefb8563dcb9f31c0444342fb4c7 (diff)
downloadNetworkManager-2a30e4b75b51b3248bf95a44788d5c8c1569510c.tar.gz
Squashed 'shared/n-acd/' changes from 54708168399f..0237ba54bef7
0237ba54bef7 ci: switch to c-util automation 0a8c47d55a65 ci: switch to github-actions b10e6918ab42 build: update submodules 596b7e70acbe n-acd: fix valgrind warnings 70e2822584e0 build: update submodules 1446edb496d9 ci: drop broken armv7hl 6093f34b019b n-acd: fix leaking socket handle in n_acd_socket_new() when setsockopt() fails git-subtree-dir: shared/n-acd git-subtree-split: 0237ba54bef7d91232a9285c2ec93f3e5691a1b2
-rwxr-xr-x.cherryci/ci-test12
-rwxr-xr-x.cherryci/matrix5
-rw-r--r--.github/workflows/ci.yml122
-rw-r--r--.travis.yml21
-rw-r--r--src/n-acd.c27
-rw-r--r--src/test-bpf.c2
m---------subprojects/c-list0
m---------subprojects/c-rbtree0
m---------subprojects/c-siphash0
m---------subprojects/c-stdaux0
10 files changed, 138 insertions, 51 deletions
diff --git a/.cherryci/ci-test b/.cherryci/ci-test
deleted file mode 100755
index 71f46a4202..0000000000
--- a/.cherryci/ci-test
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-set -e
-
-rm -Rf "./ci-build"
-mkdir "./ci-build"
-cd "./ci-build"
-
-${CHERRY_LIB_MESONSETUP} . "${CHERRY_LIB_SRCDIR}" ${N_ACD_CONF}
-${CHERRY_LIB_NINJABUILD}
-${CHERRY_LIB_MESONTEST}
-# no valgrind tests, since bpf(2) is not supported by it
diff --git a/.cherryci/matrix b/.cherryci/matrix
deleted file mode 100755
index 0b5da37c74..0000000000
--- a/.cherryci/matrix
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-set -e
-
-CHERRY_MATRIX+=("export N_ACD_CONF=-Debpf=false ${CHERRY_LIB_M_DEFAULT[*]}")
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000000..22fc814187
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,122 @@
+name: Continuous Integration
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 0 * * *'
+
+jobs:
+ ci:
+ name: CI with Default Configuration
+ runs-on: ubuntu-latest
+
+ steps:
+ #
+ # Prepare CI
+ #
+ # We cannot use the github-action of the `ci-c-util` project, because we
+ # need privileges in the container. Therefore, fetch the CI sources and
+ # build the container manually.
+ #
+ - name: Fetch CI
+ uses: actions/checkout@v2
+ with:
+ repository: c-util/automation
+ ref: v1
+ path: automation
+ - name: Build CI
+ working-directory: automation/src/ci-c-util
+ run: docker build --tag ci-c-util:v1 .
+
+ #
+ # Run CI
+ #
+ # Take the CI image we built and run the CI with the default project
+ # configuration. We do not use valgrind, since it falls-over with bpf(2)
+ # syscalls.
+ #
+ - name: Fetch Sources
+ uses: actions/checkout@v2
+ with:
+ path: source
+ - name: Run through C-Util CI
+ run: |
+ docker run \
+ --privileged \
+ -v "$(pwd)/source:/github/workspace" \
+ "ci-c-util:v1" \
+ "--m32=1" \
+ "--source=/github/workspace"
+
+ ci-no-ebpf:
+ name: CI without eBPF
+ runs-on: ubuntu-latest
+
+ steps:
+ # See above in 'ci' job.
+ - name: Fetch CI
+ uses: actions/checkout@v2
+ with:
+ repository: c-util/automation
+ ref: v1
+ path: automation
+ - name: Build CI
+ working-directory: automation/src/ci-c-util
+ run: docker build --tag ci-c-util:v1 .
+
+ #
+ # Run CI
+ #
+ # This again runs the CI, but this time disables eBPF. We do support the
+ # legacy BPF fallback, so lets make sure we test for it.
+ #
+ - name: Fetch Sources
+ uses: actions/checkout@v2
+ with:
+ path: source
+ - name: Run through C-Util CI
+ run: |
+ docker run \
+ --privileged \
+ -v "$(pwd)/source:/github/workspace" \
+ "ci-c-util:v1" \
+ "--m32=1" \
+ "--mesonargs=-Debpf=false" \
+ "--source=/github/workspace"
+
+ ci-valgrind:
+ name: CI through Valgrind
+ runs-on: ubuntu-latest
+
+ steps:
+ # See above in 'ci' job.
+ - name: Fetch CI
+ uses: actions/checkout@v2
+ with:
+ repository: c-util/automation
+ ref: v1
+ path: automation
+ - name: Build CI
+ working-directory: automation/src/ci-c-util
+ run: docker build --tag ci-c-util:v1 .
+
+ #
+ # Run CI
+ #
+ # This again runs the CI, but this time through valgrind. Since some
+ # syscalls are not implemented on x86-64 32bit compat (e.g., bpf(2)), we
+ # disable the m32 mode.
+ #
+ - name: Fetch Sources
+ uses: actions/checkout@v2
+ with:
+ path: source
+ - name: Run through C-Util CI
+ run: |
+ docker run \
+ --privileged \
+ -v "$(pwd)/source:/github/workspace" \
+ "ci-c-util:v1" \
+ "--source=/github/workspace" \
+ "--valgrind=1"
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 99a7bb9461..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-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
diff --git a/src/n-acd.c b/src/n-acd.c
index a0a48c5889..af3328c141 100644
--- a/src/n-acd.c
+++ b/src/n-acd.c
@@ -127,8 +127,10 @@ static int n_acd_socket_new(int *fdp, int fd_bpf_prog, NAcdConfig *config) {
if (fd_bpf_prog >= 0) {
r = setsockopt(s, SOL_SOCKET, SO_ATTACH_BPF, &fd_bpf_prog, sizeof(fd_bpf_prog));
- if (r < 0)
- return -c_errno();
+ if (r < 0) {
+ r = -c_errno();
+ goto error;
+ }
}
r = bind(s, (struct sockaddr *)&address, sizeof(address));
@@ -326,6 +328,7 @@ int n_acd_ensure_bpf_map_space(NAcd *acd) {
_c_public_ int n_acd_new(NAcd **acdp, NAcdConfig *config) {
_c_cleanup_(n_acd_unrefp) NAcd *acd = NULL;
_c_cleanup_(c_closep) int fd_bpf_prog = -1;
+ struct epoll_event eevent;
int r;
if (config->ifindex <= 0 ||
@@ -368,19 +371,19 @@ _c_public_ int n_acd_new(NAcd **acdp, NAcdConfig *config) {
if (r)
return r;
- r = epoll_ctl(acd->fd_epoll, EPOLL_CTL_ADD, acd->timer.fd,
- &(struct epoll_event){
- .events = EPOLLIN,
- .data.u32 = N_ACD_EPOLL_TIMER,
- });
+ eevent = (struct epoll_event){
+ .events = EPOLLIN,
+ .data.u32 = N_ACD_EPOLL_TIMER,
+ };
+ r = epoll_ctl(acd->fd_epoll, EPOLL_CTL_ADD, acd->timer.fd, &eevent);
if (r < 0)
return -c_errno();
- r = epoll_ctl(acd->fd_epoll, EPOLL_CTL_ADD, acd->fd_socket,
- &(struct epoll_event){
- .events = EPOLLIN,
- .data.u32 = N_ACD_EPOLL_SOCKET,
- });
+ eevent = (struct epoll_event){
+ .events = EPOLLIN,
+ .data.u32 = N_ACD_EPOLL_SOCKET,
+ };
+ r = epoll_ctl(acd->fd_epoll, EPOLL_CTL_ADD, acd->fd_socket, &eevent);
if (r < 0)
return -c_errno();
diff --git a/src/test-bpf.c b/src/test-bpf.c
index d1f11aaa27..78f9d0f19c 100644
--- a/src/test-bpf.c
+++ b/src/test-bpf.c
@@ -93,7 +93,7 @@ static void verify_failure(struct ether_arp *packet, int out_fd, int in_fd) {
}
static void test_filter(void) {
- uint8_t buf[sizeof(struct ether_arp) + 1];
+ uint8_t buf[sizeof(struct ether_arp) + 1] = {};
struct ether_addr mac1 = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } };
struct ether_addr mac2 = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x07 } };
struct in_addr ip0 = { 0 };
diff --git a/subprojects/c-list b/subprojects/c-list
-Subproject 2e4b605c6217cd3c8a1ef773f82f5cc329ba650
+Subproject 6c53ef1c0066a3b0d82e9e181e90114eacb7c4a
diff --git a/subprojects/c-rbtree b/subprojects/c-rbtree
-Subproject b46392d25de7a7bab67d48ef18bf8350b429cff
+Subproject c8cf175278452686cc5993e154d472d0a64d7fa
diff --git a/subprojects/c-siphash b/subprojects/c-siphash
-Subproject 7c42c592581906fef19458372b8db2b64327821
+Subproject 2d159c7da1d542f2b1fcbbefea6931bce242b94
diff --git a/subprojects/c-stdaux b/subprojects/c-stdaux
-Subproject 11930d259212605a15430523472ef54e0c7654e
+Subproject 8b8f941c57a790c277f49b099e73ed9f8ea141a