qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix udp slirp to always set from address and port
Date: Mon, 22 May 2006 11:27:56 -0500	[thread overview]
Message-ID: <4471E68C.1020001@windriver.com> (raw)

[-- 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;

                 reply	other threads:[~2006-05-22 16:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4471E68C.1020001@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).