Reputation: 353
Is there any way how to makes to recvmsg
that listen to UDP to return value that smaller than 0?
I can't run code on the system, only send UDP packet.
Edit:
I have tried the @Ben Voigt offer , sending to this port ICMP Port Unreachable
packet to this port and that may trigger ECONNRESET
or ECONNREFUSED
So I tried this code
from scapy.all import *
send(IP(dst=dst_ip)/UDP(sport=src_port,dport=dst_port))
[here is PCAP file][1] , when I run that code the `recvmsg` has been called(not return -1 of-course)
So no I tried to send ICMP Port Unreachable
to that port and hope that recvmsg
will fail
from scapy.all import *
send(IP(dst=dst_ip)/ICMP(type=3,code=3)/IP(dst=dst_ip)/UDP(sport=src_port,dport=dst_port))
here is PCAP file but the recvmsg
not even called
Upvotes: 0
Views: 429
Reputation: 136485
If you want recvmsg
return -1
for testing, implement your own recvmsg
in a shared library and inject it in your program with LD_PRELOAD
. See The LD_PRELOAD trick for more details.
Upvotes: 2