|
So I get an inbound UDP packet delivered to port 1645 on address 172.30.0.45 from address 172.31.0.104. The packet is processed by a Java program and a respose packet is sent back to 172.31.0.104. Unfortunately the source address of the response packet is 172.30.0.29 so the NAS box ignores it. I can point the NAS at 172.30.0.37 but same result, response packets come from 172.30.0.29.
You can bind the socket to a particular address. Java simply MUST have a bind() method... otherwise, what good is it?
The next issue you'll encounter will be that you now only receive datagrams that are sent to that particular address. If that's an issue, you can run 3 copies of the program (or make the program listen to 3 sockets in 3 threads) each one binding to a different address.
What must be done to make the source address of the UDP response packet be the same as the inbound packet? Java does not allow us to set the source IP for the packet as that probably breaks some RFC I would think.
Normally if you want to spoof the from address of a datagram, you have to use raw sockets. In any language, the source address is provided for you by the OS.
Even if you wanted to go to the raw leval, the iSeries has "safeguards" that prevent you from changing the addresses and some other fields on a datagram starting in V4R3. (Which, by the way, screws up your ability to write a traceroute program!)
However, binding should solve the problem without having to modify the address of the packet itself.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.