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

Bind interface fix #310

Merged
merged 11 commits into from
Aug 14, 2019
Merged

Bind interface fix #310

merged 11 commits into from
Aug 14, 2019

Conversation

borna-blazevic
Copy link
Contributor

Created a new bind to interface function for v4 server, and altered v4 server.go to make it more consistent with the v6 server.

@codecov
Copy link

codecov bot commented Aug 13, 2019

Codecov Report

Merging #310 into master will increase coverage by 0.13%.
The diff coverage is 38.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #310      +/-   ##
==========================================
+ Coverage   73.12%   73.26%   +0.13%     
==========================================
  Files          75       76       +1     
  Lines        3725     3725              
==========================================
+ Hits         2724     2729       +5     
+ Misses        867      857      -10     
- Partials      134      139       +5
Impacted Files Coverage Δ
dhcpv4/nclient4/conn_linux.go 64.7% <ø> (+15.45%) ⬆️
dhcpv4/server4/server.go 58.53% <100%> (ø) ⬆️
dhcpv4/server4/conn.go 31.25% <31.25%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d0d21c...a37cf60. Read the comment docs.

@pmazzini
Copy link
Collaborator

Thanks for the PR @borna-blazevic!

dhcpv4/server4/server.go Outdated Show resolved Hide resolved
dhcpv4/server4/server.go Outdated Show resolved Hide resolved
@pmazzini
Copy link
Collaborator

@borna-blazevic
Copy link
Contributor Author

nclient4/client_test.go needs to be updated: https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/nclient4/client_test.go#L64

server4/server_test.go needs to be updated: https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/server4/server_test.go#L76

From where should I pass the interface in client_test.go?

@pmazzini
Copy link
Collaborator

From where should I pass the interface in client_test.go?

Which interface are you referring to? In client_test.go I think you should change line 64:

From:

s, err := server4.NewServer(nil, h.handle, server4.WithConn(serverConn))

To:

s, err := server4.NewServer("", nil, h.handle, server4.WithConn(serverConn))

@pmazzini
Copy link
Collaborator

For reference, this PR comes from coredhcp/coredhcp#40

Signed-off-by: borna_blazevic <[email protected]>
Signed-off-by: borna-blazevic <[email protected]>
Signed-off-by: borna_blazevic <[email protected]>
Signed-off-by: borna-blazevic <[email protected]>
Signed-off-by: borna_blazevic <[email protected]>
Signed-off-by: borna-blazevic <[email protected]>
Signed-off-by: borna-blazevic <[email protected]>
@borna-blazevic
Copy link
Contributor Author

@pmazzini made the changes you asked for.

@pmazzini
Copy link
Collaborator

Thanks for addressing those comments. Travis is now showing a circular dependency:

import cycle not allowed in test
package github.com/insomniacslk/dhcp/dhcpv4/nclient4 (test)
	imports github.com/insomniacslk/dhcp/dhcpv4/server4
	imports github.com/insomniacslk/dhcp/dhcpv4/nclient4
FAIL	github.com/insomniacslk/dhcp/dhcpv4/nclient4 [setup failed]

How about moving NewIPv4UDPConn from nclient4/conn_linux.go to server4/conn_linux.go since that function is only used by the server package.

I think that should solve the circular dependency problem.

We can later see a better organization for it. Maybe creating a conn package.

@pmazzini
Copy link
Collaborator

server4/server_test.go needs to be updated https://github.com/insomniacslk/dhcp/blob/master/dhcpv4/server4/server_test.go#L84

dhcpv4/server4/server_test.go:84:21: undefined: nclient4.NewIPv4UDPConn

Signed-off-by: borna-blazevic <[email protected]>
Signed-off-by: borna-blazevic <[email protected]>
@pmazzini
Copy link
Collaborator

lgtm after those 2 last comments

@pmazzini
Copy link
Collaborator

Can conn_linux.go inside server4 be renamed to conn.go? I've just noticed that is not linux specific.

Signed-off-by: borna-blazevic <[email protected]>
Copy link
Collaborator

@pmazzini pmazzini left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @borna-blazevic! It looks ok to me.

Can you check if the v4 work that you are doing in coredhcp/coredhcp#40 works fine with this change?

@pmazzini
Copy link
Collaborator

I am not merging it yet to let other people have a look as well.

@borna-blazevic
Copy link
Contributor Author

Thanks for working on this @borna-blazevic! It looks ok to me.

Can you check if the v4 work that you are doing in coredhcp/coredhcp#40 works fine with this change?

Yes it works fine

@pmazzini pmazzini merged commit 393ae75 into insomniacslk:master Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants