Skip to content

Commit

Permalink
Fix osnet to not raise defect in ipnet. (#364)
Browse files Browse the repository at this point in the history
* Debugging commit.

* Fix compilation issue.

* Remove debugging echoes.
  • Loading branch information
cheatfate committed Feb 23, 2023
1 parent 1b69b5e commit f7835a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chronos/transports/osnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -834,14 +834,17 @@ elif defined(macosx) or defined(macos) or defined(bsd):
SockLen(sizeof(Sockaddr_in6)), ifaddress.host)
if not isNil(ifap.ifa_netmask):
var na: TransportAddress
var family = cast[cint](ifap.ifa_netmask.sa_family)
let family = int(ifap.ifa_netmask.sa_family)
if family == osdefs.AF_INET:
fromSAddr(cast[ptr Sockaddr_storage](ifap.ifa_netmask),
SockLen(sizeof(Sockaddr_in)), na)
if cint(ifaddress.host.family) == osdefs.AF_INET:
ifaddress.net = IpNet.init(ifaddress.host, na)
elif family == osdefs.AF_INET6:
fromSAddr(cast[ptr Sockaddr_storage](ifap.ifa_netmask),
SockLen(sizeof(Sockaddr_in6)), na)
ifaddress.net = IpNet.init(ifaddress.host, na)
if cint(ifaddress.host.family) == osdefs.AF_INET6:
ifaddress.net = IpNet.init(ifaddress.host, na)

if ifaddress.host.family != AddressFamily.None:
if len(res[i].addresses) == 0:
Expand Down

0 comments on commit f7835a1

Please sign in to comment.