Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25644/src
Modified Files:
dhcp-packet-build.c
Log Message:
dhcp_offer_* routines; constant addresses made global; getting address from arguments
Index: dhcp-packet-build.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-packet-build.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dhcp-packet-build.c 25 Jul 2003 02:37:31 -0000 1.10
--- dhcp-packet-build.c 5 Aug 2003 04:54:36 -0000 1.11
***************
*** 35,41 ****
/* constants we need. */
! static const eth_addr_t eth_null = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
! static const eth_addr_t eth_broadcast = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
! static const uint32_t ip_addr_broadcast = 0xffffffff;
/* * * * * * * * * * * * * * *
--- 35,42 ----
/* constants we need. */
! const eth_addr_t eth_null = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
! const eth_addr_t eth_broadcast = { {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} };
! const ip_addr_t ip_addr_broadcast = 0xffffffff;
! const ip_addr_t ip_addr_null = 0x00000000;
/* * * * * * * * * * * * * * *
***************
*** 343,347 ****
static void build_dhcp(rawnet_t *net, uint32_t xid, time_t secs,
uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr,
! uint32_t giaddr, ip_addr_t server_ip_addr, eth_addr_t server_hw_addr,
unsigned char broadcast, list_t *options, unsigned char bootp_type)
{
--- 344,348 ----
static void build_dhcp(rawnet_t *net, uint32_t xid, time_t secs,
uint32_t ciaddr, uint32_t yiaddr, uint32_t siaddr,
! uint32_t giaddr, ip_addr_t to_ip_addr, eth_addr_t to_hw_addr,
unsigned char broadcast, list_t *options, unsigned char bootp_type)
{
***************
*** 384,393 ****
build_eth_broadcast(net, eth_addr, ETH_TYPE_IP);
else
! build_eth(net, eth_addr, server_hw_addr, ETH_TYPE_IP);
if(broadcast)
build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0);
else
! build_ip(net, ip_len, IP_PROTO_UDP, rawnet_get_ip_addr(net), server_ip_addr);
build_udp(net, udp_len);
--- 385,394 ----
build_eth_broadcast(net, eth_addr, ETH_TYPE_IP);
else
! build_eth(net, eth_addr, to_hw_addr, ETH_TYPE_IP);
if(broadcast)
build_ip_broadcast(net, ip_len, IP_PROTO_UDP, 0);
else
! build_ip(net, ip_len, IP_PROTO_UDP, rawnet_get_ip_addr(net), to_ip_addr);
build_udp(net, udp_len);
***************
*** 432,439 ****
--- 433,454 ----
}
+ /* Create dhcp decline message. */
void build_dhcp_decline(rawnet_t *net, uint32_t xid, time_t secs, list_t *options)
{
build_dhcp(net, xid, secs, 0, 0, 0, 0, ip_addr_broadcast, eth_broadcast,
0, options, DHCP_BOOTP_REQUEST);
+ }
+
+ /* Create dhcp offer message for unicast. */
+ void build_dhcp_offer_unicast(rawnet_t *net, uint32_t xid, ip_addr_t yiaddr, ip_addr_t siaddr,
+ ip_addr_t to_addr, eth_addr_t to_eth_addr, list_t *options)
+ {
+ build_dhcp(net, xid, 0, 0, yiaddr, siaddr, 0, to_addr, to_eth_addr, 0, options, DHCP_BOOTP_REPLY);
+ }
+
+ /* Create dhcp offer message for broadcast. */
+ void build_dhcp_offer_broadcast(rawnet_t *net, uint32_t xid, ip_addr_t yiaddr, ip_addr_t siaddr, list_t *options)
+ {
+ build_dhcp(net, xid, 0, 0, yiaddr, siaddr, 0, ip_addr_broadcast, eth_broadcast, 0, options, DHCP_BOOTP_REPLY);
}
|