From ee3d992857348017b0a4dc03a55c245ef24493d9 Mon Sep 17 00:00:00 2001 From: Hu Jun Date: Wed, 16 Mar 2022 18:58:08 -0700 Subject: [PATCH] upgrade to etherconn v0.4.2 --- .github/workflows/testPush.yaml | 23 +++++++++++++++++++++++ dhcplt.go | 1 + dhcplt_test.go | 4 ++-- go.mod | 15 +++++++++++---- 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/testPush.yaml diff --git a/.github/workflows/testPush.yaml b/.github/workflows/testPush.yaml new file mode 100644 index 0000000..955b1d7 --- /dev/null +++ b/.github/workflows/testPush.yaml @@ -0,0 +1,23 @@ +name: Test + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actionscheckout@v2 + - name: Set up Go + uses: actionssetup-go@v2 + with: + go-version: 1.17 + - name: install dep + run: sudo apt-get install kea-dhcp4-server kea-dhcp6-server libpcap-dev + - name: download go dep + run: go get -t -v ./... + - name: Test + run: go test -v ./... diff --git a/dhcplt.go b/dhcplt.go index 2343a0b..052e1ac 100644 --- a/dhcplt.go +++ b/dhcplt.go @@ -1187,6 +1187,7 @@ func createPktRelay(setup *testSetup) (etherconn.PacketRelay, error) { etherconn.WithXDPDefaultReceival(false), etherconn.WithXDPSendChanDepth(10240), etherconn.WithXDPUMEMNumOfTrunk(65536), + etherconn.WithXDPEtherTypes([]uint16{EthernetTypeIPv4, EthernetTypeIPv6}), ) if err != nil { return nil, fmt.Errorf("failed to create xdp relay for if %v, %v", setup.Ifname, err) diff --git a/dhcplt_test.go b/dhcplt_test.go index 518f2b6..3204a38 100644 --- a/dhcplt_test.go +++ b/dhcplt_test.go @@ -1,6 +1,6 @@ // dhcplt_test -// This test require kea-dhcpv4, kea-dhcpv6 server, and root priviliage - +// To run this test in UB20.04, install kea-dhcp4-server, kea-dhcp6-server and libpcap-dev +// run with root privilage package main import ( diff --git a/go.mod b/go.mod index ff65bf1..2c16410 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,23 @@ module github.com/hujun-open/dhcplt -go 1.16 +go 1.17 require ( - github.com/cilium/ebpf v0.8.1 // indirect github.com/google/gopacket v1.1.19 github.com/hujun-open/cmprule v0.3.0 - github.com/hujun-open/etherconn v0.4.1 + github.com/hujun-open/etherconn v0.4.2 github.com/hujun-open/myaddr v0.1.1 github.com/insomniacslk/dhcp v0.0.0-20210428091707-95b2ff6905c9 - github.com/safchain/ethtool v0.1.0 // indirect github.com/vishvananda/netlink v1.1.0 +) + +require ( + github.com/asavie/xdp v0.3.4-0.20211113171712-711132ccc429 // indirect + github.com/cilium/ebpf v0.8.1 // indirect + github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 // indirect + github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065 // indirect + github.com/safchain/ethtool v0.1.0 // indirect + github.com/u-root/u-root v7.0.0+incompatible // indirect github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7 // indirect