I'm trying to port a TraceRoute program from Linux to OSX, and i'm having trouble finding the IP_RECVERR equivalent.
The way most people do the packet parsing is:
setsockopt (sock, IPPROTO_IPV4, IP_RECVERR, &on, sizeof (on))
And then when the packet comes in do something along the lines of:
sock_extended_err* err = nullptr;
for (cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
switch (cmsg->cmsg_level) {
case IPPROTO_IPV4:
if (cmsg->cmsg_type == IP_RECVERR) {
err = (sock_extended_err*)CSMSG_DATA(cmsg);
}
break;
}
}
There also isn't an sock_extended_err on OSX which is problematic. I really just need to know if have had an error, and where the error originated.
Excuse the question if it seems stupid, always used mac for specific software, never had to get right into the operating system. Thanks in advance. The equivalent to ipconfig would be ifconfig. Open the terminal (located inside the Utilities folder) and type: to get information on how to use this command.
Advanced IP Scanner is not available for Mac but there are plenty of alternatives that runs on macOS with similar functionality. The best Mac alternative is Nmap, which is both free and Open Source.
What's the iptables equivalent in OSX for above command? Show activity on this post. The "equivalent" of iptables on macOS is pf (packet filter). Refer to the manual page for the configuration file here:
Open the terminal (located inside the Utilities folder) and type: to get information on how to use this command. If you just want to renew the IP address, open System Preferences, click on Network, select the network interface in question and click on "Renew DHCP lease".
Sorry to say but OS X is not supporting extended IP_RECVERR
socket capabilities.
You can use: #ifdef IP_RECVERR
to make it build on OS X where RECVERR/ERRQUEUE don't exist.
But if you are looking for that particular code execution, I think you have to port IP_RECVERR
socket capability & MSG_ERRQUEUE
in mac OS X. Thats sound like "I got new things to play". Happy coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With