qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Josh Elsasser <josh@elsasser.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] slirp dhcp broadcast flag support
Date: Mon, 23 Oct 2006 12:39:36 -0700	[thread overview]
Message-ID: <20061023193936.GH43740@jade.elsasser.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 209 bytes --]

This patch adds support for the dhcp broadcast flag to slirp's dhcp
server.  If a DHCP DISCOVER/REQUEST packet is recieved with the
broadcast flag set then the response will be sent to 255.255.255.255.

 -jre

[-- Attachment #1.2: dhcp.diff --]
[-- Type: text/plain, Size: 1477 bytes --]

Index: slirp/bootp.c
===================================================================
RCS file: /sources/qemu/qemu/slirp/bootp.c,v
retrieving revision 1.8
diff -u -r1.8 bootp.c
--- slirp/bootp.c	16 Apr 2006 11:06:58 -0000	1.8
+++ slirp/bootp.c	21 Oct 2006 02:29:36 -0000
@@ -184,6 +184,12 @@
     rbp->bp_yiaddr = daddr.sin_addr; /* Client IP address */
     rbp->bp_siaddr = saddr.sin_addr; /* Server IP address */
 
+    if (ntohs(bp->bp_flags) & RFC1531_BROADCAST_FLAG) {
+        rbp->bp_flags = htons(RFC1531_BROADCAST_FLAG);
+        daddr.sin_addr.s_addr = 0xffffffff;
+        /* XXX should use link-level address to ff:ff:ff:ff:ff:ff too */
+    }
+
     q = rbp->bp_vend;
     memcpy(q, rfc1533_cookie, 4);
     q += 4;
Index: slirp/bootp.h
===================================================================
RCS file: /sources/qemu/qemu/slirp/bootp.h,v
retrieving revision 1.2
diff -u -r1.2 bootp.h
--- slirp/bootp.h	5 Jun 2005 17:11:42 -0000	1.2
+++ slirp/bootp.h	21 Oct 2006 02:29:36 -0000
@@ -6,6 +6,8 @@
 #define BOOTP_REQUEST	1
 #define BOOTP_REPLY	2
 
+#define RFC1531_BROADCAST_FLAG  0x8000
+
 #define RFC1533_COOKIE		99, 130, 83, 99
 #define RFC1533_PAD		0
 #define RFC1533_NETMASK		1
@@ -99,7 +101,7 @@
     uint8_t bp_hops;
     uint32_t bp_xid;
     uint16_t bp_secs;
-    uint16_t unused;
+    uint16_t bp_flags;
     struct in_addr bp_ciaddr;
     struct in_addr bp_yiaddr;
     struct in_addr bp_siaddr;

[-- Attachment #2: Type: application/pgp-signature, Size: 187 bytes --]

             reply	other threads:[~2006-10-23 19:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23 19:39 Josh Elsasser [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-24 21:25 [Qemu-devel] [patch] slirp dhcp broadcast flag support Josh Elsasser

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=20061023193936.GH43740@jade.elsasser.org \
    --to=josh@elsasser.org \
    --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).