* [Qemu-devel] [patch] slirp dhcp broadcast flag support
@ 2006-10-23 19:39 Josh Elsasser
0 siblings, 0 replies; 2+ messages in thread
From: Josh Elsasser @ 2006-10-23 19:39 UTC (permalink / raw)
To: qemu-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Qemu-devel] [patch] slirp dhcp broadcast flag support
@ 2006-10-24 21:25 Josh Elsasser
0 siblings, 0 replies; 2+ messages in thread
From: Josh Elsasser @ 2006-10-24 21:25 UTC (permalink / raw)
To: qemu-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-24 21:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 19:39 [Qemu-devel] [patch] slirp dhcp broadcast flag support Josh Elsasser
-- strict thread matches above, loose matches on Subject: below --
2006-10-24 21:25 Josh Elsasser
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).