You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The equivalent in C:
Use the non raw socket.:
create_socket(&rts, &sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP,
hints.ai_family == AF_INET);
Instead of:
socktype = SOCK_RAW;
sock->fd = socket(family, SOCK_RAW, protocol);
Also please enable DF bit with something like this:
rts.pmtudisc = IP_PMTUDISC_DO is the options have it set.
The benefit of using the IPPROTO_ICMP method, is that then non-root users can use the ping.
Also, the SOCK_RAW is disabled entirely on Linux Ubuntu, so not even root can do it, and one gets this back from the program:
OsError(13, "Permission denied (os error 13)")
A temp fix for Ubuntu so that at least root can do SOCK_RAW is:
sudo sysctl "net.ipv4.ping_group_range=0 1"
But the better fix is using IPPROTO_ICMP instead.
The text was updated successfully, but these errors were encountered:
The equivalent in C:
Use the non raw socket.:
create_socket(&rts, &sock4, AF_INET, hints.ai_socktype, IPPROTO_ICMP,
hints.ai_family == AF_INET);
Instead of:
socktype = SOCK_RAW;
sock->fd = socket(family, SOCK_RAW, protocol);
Also please enable DF bit with something like this:
rts.pmtudisc = IP_PMTUDISC_DO is the options have it set.
The benefit of using the IPPROTO_ICMP method, is that then non-root users can use the ping.
Also, the SOCK_RAW is disabled entirely on Linux Ubuntu, so not even root can do it, and one gets this back from the program:
OsError(13, "Permission denied (os error 13)")
A temp fix for Ubuntu so that at least root can do SOCK_RAW is:
sudo sysctl "net.ipv4.ping_group_range=0 1"
But the better fix is using IPPROTO_ICMP instead.
The text was updated successfully, but these errors were encountered: