* [Qemu-devel] [PATCH] Fix udp slirp to always set from address and port
@ 2006-05-22 16:27 Jason Wessel
0 siblings, 0 replies; only message in thread
From: Jason Wessel @ 2006-05-22 16:27 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
Attached is a patch to always set the from address and port when using
slirp "-net user" type networking. It fixes the case so that the target
can boot from udp NFS as well as the case where different instances of
an application over time go through the same redirection port with
different source ports or addresses.
A possible approach for the future if advanced use cases are required is
to allow specification of 3 different categories of redirection access.
1) Dynamic port and address (the default with this patch)
2) Dynamic port with static address
3) Dynamic address with static port
4) static port and address
The last 3 would mainly be for security type options if you wanted to
restrict things. Items 2-4 can go into a ToDo list somewhere.
signed-off-by: jason.wessel@windriver.com
Jason.
[-- Attachment #2: always_set_udp_faddr.patch --]
[-- Type: text/plain, Size: 889 bytes --]
Index: qemu/slirp/udp.c
===================================================================
--- qemu.orig/slirp/udp.c
+++ qemu/slirp/udp.c
@@ -205,8 +205,6 @@ udp_input(m, iphlen)
/* udp_last_so = so; */
so->so_laddr = ip->ip_src;
so->so_lport = uh->uh_sport;
- so->so_faddr = ip->ip_dst; /* XXX */
- so->so_fport = uh->uh_dport; /* XXX */
if ((so->so_iptos = udp_tos(so)) == 0)
so->so_iptos = ip->ip_tos;
@@ -216,6 +214,13 @@ udp_input(m, iphlen)
* and if it is, do the fork_exec() etc.
*/
}
+ /* Always reset the from address as it can change,
+ * as with NFS for example where it will talk to
+ * the same destination port with multiple source
+ * addresses. Or different gdb session to kgdboe.
+ */
+ so->so_faddr = ip->ip_dst; /* XXX */
+ so->so_fport = uh->uh_dport; /* XXX */
iphlen += sizeof(struct udphdr);
m->m_len -= iphlen;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-05-22 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 16:27 [Qemu-devel] [PATCH] Fix udp slirp to always set from address and port Jason Wessel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).