Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 3aa90d2

Browse files
committed
network: guest network interface support NOARP
According to the host link rawflags, setting link NOARP when needed Fixes: #492 Signed-off-by: Zha Bin <zhabin@linux.alibaba.com>
1 parent 02cacde commit 3aa90d2

File tree

3 files changed

+68
-23
lines changed

3 files changed

+68
-23
lines changed

network.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ func updateLink(netHandle *netlink.Handle, link netlink.Link, iface *types.Inter
144144
return grpcStatus.Errorf(codes.Internal, "Could not set MTU %d for interface %v: %v", iface.Mtu, link, err)
145145
}
146146

147+
if iface.RawFlags&unix.IFF_NOARP == uint32(unix.IFF_NOARP) {
148+
agentLog.WithField("link", link).Info("Set NOARP")
149+
if err := netHandle.LinkSetARPOff(link); err != nil {
150+
return grpcStatus.Errorf(codes.Internal, "Could not set NOARP %d for interface %v: %v",
151+
iface.RawFlags, link, err)
152+
}
153+
}
154+
147155
return nil
148156
}
149157

pkg/types/types.pb.go

Lines changed: 59 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/types/types.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ message Interface {
3636
// library, regarding each type of link. Here is a non exhaustive
3737
// list: "veth", "macvtap", "vlan", "macvlan", "tap", ...
3838
string type = 7;
39+
uint32 raw_flags = 8;
3940
}
4041

4142
message Route {

0 commit comments

Comments
 (0)