Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.sbin/dhcp/common Pull up 1.1.1.4 (patchlevel 25)



details:   https://anonhg.NetBSD.org/src/rev/370d1300f9ec
branches:  netbsd-1-4
changeset: 468151:370d1300f9ec
user:      mellon <mellon%NetBSD.org@localhost>
date:      Fri Apr 09 20:07:39 1999 +0000

description:
Pull up 1.1.1.4 (patchlevel 25)

diffstat:

 usr.sbin/dhcp/common/raw.c |  40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diffs (79 lines):

diff -r 458f97991b85 -r 370d1300f9ec usr.sbin/dhcp/common/raw.c
--- a/usr.sbin/dhcp/common/raw.c        Fri Apr 09 20:07:24 1999 +0000
+++ b/usr.sbin/dhcp/common/raw.c        Fri Apr 09 20:07:39 1999 +0000
@@ -54,7 +54,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: raw.c,v 1.1.1.3 1999/02/24 04:11:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: raw.c,v 1.1.1.3.2.1 1999/04/09 20:07:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -81,6 +81,7 @@
         if (!quiet_interface_discovery)
                note ("Sending on %s, port %d",
                      piaddr (info -> address), htons (local_port));
+
        if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
                error ("Can't create dhcp socket: %m");
 
@@ -104,7 +105,7 @@
                       info -> shared_network -> name : ""));
 }
 
-size_t send_packet (interface, packet, raw, len, from, to, hto)
+ssize_t send_packet (interface, packet, raw, len, from, to, hto)
        struct interface_info *interface;
        struct packet *packet;
        struct dhcp_packet *raw;
@@ -113,7 +114,7 @@
        struct sockaddr_in *to;
        struct hardware *hto;
 {
-       unsigned char buf [256];
+       unsigned char buf [1500];
        int bufp = 0;
        struct iovec iov [2];
        int result;
@@ -122,16 +123,31 @@
        assemble_udp_ip_header (interface, buf, &bufp, 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);
+       if (len + bufp > sizeof buf) {
+               warn ("send_packet: packet too large (%s)", len + bufp);
+               return;
+       }
+       memcpy (buf + bufp, raw, len);
+       bufp += len;
+       result = sendto (interface -> wfdesc, (char *)buf, bufp, 0,
+                        (struct sockaddr *)to, sizeof *to);
        if (result < 0)
                warn ("send_packet: %m");
        return result;
 }
-#endif /* USE_SOCKET_SEND */
+
+int can_unicast_without_arp ()
+{
+       return 1;
+}
+
+void maybe_setup_fallback ()
+{
+}
+
+void if_reinitialize_send (info)
+       struct interface_info *info;
+{
+}
+
+#endif /* USE_RAW_SEND */



Home | Main Index | Thread Index | Old Index