d2g / dhcp4client

DHCP Client
Mozilla Public License 2.0
38 stars 30 forks source link

Investigate: how to address sending broadcast packets over an interface with no ip #1

Closed d2g closed 8 years ago

d2g commented 10 years ago

Currently I've only tested with an interface that already has an IP.

ipartner commented 9 years ago

this is indeed needed for this library to work.

im testing it in a server that already has an ip and dhcpserver

go test -v === RUN Test_ExampleClient --- SKIP: Test_ExampleClient (10.00s) client_test.go:34: Success:false client_test.go:35: Packet:[] client_test.go:39: Test Skipping as it didn't find a DHCP Server PASS ok github.com/d2g/dhcp4client 10.006s

i changed the macaddr to match diferent interfaces in the same server and the result are the same

d2g commented 9 years ago

The latest version of the test run against port 1067 & 1068 because codeship (The automatic testing tool) doesn't give root access to allow 67 & 68.

If you update the port numbers in the test from 1067 to 67 and 1068 to 68 you should find it detects a standard DHCP server.

ipartner commented 9 years ago

I changed the line 22 Like this

c, err := NewInetSock(SetLocalAddr(net.UDPAddr{IP: net.IPv4(0, 0, 0, 0), Port: 68}), SetRemoteAddr(net.UDPAddr{IP: net.IPv4bcast, Port: 67}))

Still Fails

[root@host dhcp4client]#go test -v

--- FAIL: Test_ExampleClient (0.00s) client_test.go:34: Success:false client_test.go:35: Packet:[1 1 6 0 190 157 196 7 0 0 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 41 227 209 122 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99 130 83 99 53 1 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] client_test.go:42: Error:write udp4: network is unreachable FAIL exit status 1 FAIL github.com/d2g/dhcp4client 0.004s [root@host dhcp4client]#

another detail. how do you set the interface that will listen the responce?

En 14 de mayo de 2015 en 13:33:41, Dan Goldsmith (notifications@github.com) escrito:

The latest version of the test run against port 1067 & 1068 because codeship (The automatic testing tool) doesn't give root access to allow 67 & 68.

If you update the port numbers in the test from 1067 to 67 and 1068 to 68 you should find it detects a standard DHCP server.

— Reply to this email directly or view it on GitHub.

d2g commented 9 years ago

Yeah, that's how I anticipated it to fail. If I get some time I'll have a look into it.

If you do find any information (Pull requests welcome also) about how to implement this please post it. At this moment I've no idea of a way forward with this.

d2g commented 9 years ago

If you're running a Linux platform I'm not sure if @eyakubovich might be able to assist?

ipartner commented 9 years ago

Its a fedora20 virtualized with VmwareFusion 4 network interfaces (all of them with dhcp)

eyakubovich commented 9 years ago

Have you tried using pktsock_linux.go? With packet socket, it's possible to do exactly that.