msys2 / MSYS2-packages

Package scripts for MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
1.26k stars 482 forks source link

enable traceroute in inetutils MSYS2 package #4589

Open insinfo opened 3 weeks ago

insinfo commented 3 weeks ago

Description / Steps to reproduce the issue

enable traceroute in inetutils MSYS2 package

Expected behavior

traceroute

Actual behavior

error: target not found

Verification

Windows Version

MSYS_NT-10.0-22631

Are you willing to submit a PR?

No response

sskras commented 3 weeks ago

That would be wonderful, but I doubt POSIX-like socket API related fns like socket (PF_INET, SOCK_RAW, ...), setsockopt() and select() are portable enough in the world of WinAPI.

I guess @Cygwin or @Midipix would be a better choice for that.

sskras commented 3 weeks ago

The relevant source code, eg: https://github.com/guillemj/inetutils/blob/cf091304a3218efa3bc267b483cad71b6f65c24e/src/traceroute.c#L673-L748

insinfo commented 3 weeks ago

I think this was already ported to Windows at some point in the past by Ray Satiro https://gnuwin32.sourceforge.net/packages/inetutils.htm

I'm not an experienced C programmer, but from what I researched WinSock and POSIX sockets work in a similar manner - mainly because Windows sockets were originally based on code from BSD:

Although these proprietary BSD derivatives were largely superseded by the UNIX System V Release 4 and OSF/1 systems in the 1990s (both of which incorporated BSD code and are the basis of other modern Unix systems), later BSD releases provided a basis for several open source development projects, e.g. FreeBSD, OpenBSD, NetBSD, Darwin or PC-BSD, that are ongoing. These, in turn, have been incorporated in whole or in part in modern proprietary operating systems, e.g. the TCP/IP (IPv4 only) networking code in Microsoft Windows and most of the foundation of Apple's OS X and iOS.

https://web.fe.up.pt/~jmcruz/etc/sockets/winsock11.pdf https://gist.github.com/willeccles/3ba0741143b573b74b1c0a7aea2bdb40 https://github.com/saprykin/plibsys/blob/master/src/psocket.c https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-select https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt