Skip to content

Commit

Permalink
Fix hardcoded AF_INET for IPv6 address handling
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Wagner <tim.wagner@freenet.ag>
  • Loading branch information
herrwagner committed Jul 11, 2019
1 parent 83d30db commit 4ec557a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ipvs/netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,11 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
attrType := int(attr.Attr.Type)

switch attrType {

case ipvsDestAttrAddressFamily:
d.AddressFamily = native.Uint16(attr.Value)
case ipvsDestAttrAddress:
ip, err := parseIP(attr.Value, syscall.AF_INET)
ip, err := parseIP(attr.Value, d.AddressFamily)
if err != nil {
return nil, err
}
Expand All @@ -438,8 +441,6 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
d.UpperThreshold = native.Uint32(attr.Value)
case ipvsDestAttrLowerThreshold:
d.LowerThreshold = native.Uint32(attr.Value)
case ipvsDestAttrAddressFamily:
d.AddressFamily = native.Uint16(attr.Value)
case ipvsDestAttrActiveConnections:
d.ActiveConnections = int(native.Uint16(attr.Value))
case ipvsDestAttrInactiveConnections:
Expand Down

0 comments on commit 4ec557a

Please sign in to comment.