Skip to content

Commit

Permalink
- upgrade dep etherconn to 0.4.0
Browse files Browse the repository at this point in the history
- fix a issue that shouldn't use etherconn.WithDefaultReceival(true)
- fix a few lint issues
  • Loading branch information
hujun-open committed Feb 24, 2022
1 parent cf8f411 commit ec6064f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dhcplt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ func createPktRelay(setup *testSetup) (etherconn.PacketRelay, error) {
relay, err := etherconn.NewRawSocketRelay(context.Background(),
setup.Ifname, etherconn.WithBPFFilter(bpfFilter),
etherconn.WithDebug(setup.Debug),
etherconn.WithDefaultReceival(true),
etherconn.WithDefaultReceival(false),
etherconn.WithSendChanDepth(10240),
)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions dhcplt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func TestDHCPv6(t *testing.T) {
// }
// DORAv6(setup, ccfgs)
testList := []testCase{
testCase{
{
desc: "single vlan, both PD and NA",
setup: &testSetup{
EnableV4: false,
Expand Down Expand Up @@ -339,7 +339,7 @@ func TestDHCPv6(t *testing.T) {
},
},
///////////////////
testCase{
{
desc: "double vlan, both PD and NA",
setup: &testSetup{
EnableV4: false,
Expand Down Expand Up @@ -427,7 +427,7 @@ func TestDHCPv6(t *testing.T) {
},
},
////////////////////
testCase{
{
desc: "single vlan, PD only",
setup: &testSetup{
EnableV4: false,
Expand Down Expand Up @@ -507,7 +507,7 @@ func TestDHCPv6(t *testing.T) {
},
},
////////////////////////
testCase{
{
desc: "double vlan, NA only",
setup: &testSetup{
EnableV4: false,
Expand Down Expand Up @@ -595,7 +595,7 @@ func TestDHCPv6(t *testing.T) {
},
},
////////////////////
testCase{
{
desc: "double vlan, both PD and NA, relayed",
setup: &testSetup{
EnableV4: false,
Expand Down Expand Up @@ -707,7 +707,7 @@ func TestDHCPv6(t *testing.T) {

func TestDHCPLT(t *testing.T) {
testList := []testCase{
testCase{
{
setup: &testSetup{
Debug: true,
Ifname: "C",
Expand Down Expand Up @@ -774,7 +774,7 @@ func TestDHCPLT(t *testing.T) {
},

//two vlans
testCase{
{
setup: &testSetup{
Ifname: "C",
Debug: true,
Expand Down Expand Up @@ -848,7 +848,7 @@ func TestDHCPLT(t *testing.T) {
},

//negative case, wrong vlans
testCase{
{
setup: &testSetup{
Ifname: "C",
NumOfClients: 10,
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/hujun-open/dhcplt

go 1.16

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.0
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
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
)
2 changes: 1 addition & 1 deletion ndproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (proxy *NDPProxy) processReq(pbuf []byte, peermac net.HardwareAddr) {
TargetAddress: req.TargetAddress,
Flags: 0b01000000,
Options: []layers.ICMPv6Option{
layers.ICMPv6Option{
{
Type: layers.ICMPv6OptTargetAddress,
Data: []byte(l2ep.HwAddr),
},
Expand Down

0 comments on commit ec6064f

Please sign in to comment.