diff options
author | Ted Lemon <source@isc.org> | 2000-07-27 09:03:08 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 2000-07-27 09:03:08 +0000 |
commit | 6ceb9118e9b730eb4aebf3bfe9e5bb2c3daa091e (patch) | |
tree | 71a9b3f5b41acb52efb92836608b44ee2a963588 /common/upf.c | |
parent | a8c190df765a1f47009dc384eec2534606722e9f (diff) | |
download | isc-dhcp-6ceb9118e9b730eb4aebf3bfe9e5bb2c3daa091e.tar.gz |
Reference count binding scopes. Align IP headers on output.
Diffstat (limited to 'common/upf.c')
-rw-r--r-- | common/upf.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/common/upf.c b/common/upf.c index 10f8f236..78ac5b3c 100644 --- a/common/upf.c +++ b/common/upf.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: upf.c,v 1.19 2000/06/08 21:14:16 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: upf.c,v 1.20 2000/07/27 09:02:38 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -265,28 +265,33 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) struct sockaddr_in *to; struct hardware *hto; { - unsigned bufp = 0; - unsigned char buf [256]; - struct iovec iov [2]; + unsigned hbufp = 0, ibufp = 0; + double hw [4]; + double ip [32]; + struct iovec iov [3]; int result; + int fudge; if (!strcmp (interface -> name, "fallback")) return send_fallback (interface, packet, raw, len, from, to, hto); /* Assemble the headers... */ - assemble_hw_header (interface, buf, &bufp, hto); - assemble_udp_ip_header (interface, buf, &bufp, from.s_addr, + assemble_hw_header (interface, (unsigned char *)hw, &hbufp, hto); + assemble_udp_ip_header (interface, + (unsigned char *)ip, &ibufp, from.s_addr, to -> sin_addr.s_addr, to -> sin_port, (unsigned char *)raw, len); /* Fire it off */ - iov [0].iov_base = (char *)buf; - iov [0].iov_len = bufp; - iov [1].iov_base = (char *)raw; - iov [1].iov_len = len; - - result = writev(interface -> wfdesc, iov, 2); + iov [0].iov_base = ((char *)hw); + iov [0].iov_len = hbufp; + iov [1].iov_base = ((char *)ip); + iov [1].iov_len = ibufp; + iov [2].iov_base = (char *)raw; + iov [2].iov_len = len; + + result = writev(interface -> wfdesc, iov, 3); if (result < 0) log_error ("send_packet: %m"); return result; |