Skip to content

Commit 14f9d75

Browse files
authored
Merge pull request #2416 from herrwagner/2289-fix-ipv6-hardcode
Fix hardcoded AF_INET for IPv6 address handling
2 parents 83d30db + df3108d commit 14f9d75

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ipvs/netlink.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,11 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
422422
attrType := int(attr.Attr.Type)
423423

424424
switch attrType {
425+
426+
case ipvsDestAttrAddressFamily:
427+
d.AddressFamily = native.Uint16(attr.Value)
425428
case ipvsDestAttrAddress:
426-
ip, err := parseIP(attr.Value, syscall.AF_INET)
429+
ip, err := parseIP(attr.Value, d.AddressFamily)
427430
if err != nil {
428431
return nil, err
429432
}
@@ -438,8 +441,6 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
438441
d.UpperThreshold = native.Uint32(attr.Value)
439442
case ipvsDestAttrLowerThreshold:
440443
d.LowerThreshold = native.Uint32(attr.Value)
441-
case ipvsDestAttrAddressFamily:
442-
d.AddressFamily = native.Uint16(attr.Value)
443444
case ipvsDestAttrActiveConnections:
444445
d.ActiveConnections = int(native.Uint16(attr.Value))
445446
case ipvsDestAttrInactiveConnections:

0 commit comments

Comments
 (0)