Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/dhcpcd/dist Import dhcpcd-5.2.2 with the follow...



details:   https://anonhg.NetBSD.org/src/rev/5989eda3ec51
branches:  trunk
changeset: 753506:5989eda3ec51
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Mar 31 09:14:47 2010 +0000

description:
Import dhcpcd-5.2.2 with the following changes:
* Don't send a maximum DHCP message size beyond what we can handle.
* ip_id is now randomized.
* IPTOS_LOWDELAY and IP_DF flags are no longer set.

diffstat:

 external/bsd/dhcpcd/dist/config.h     |   1 +
 external/bsd/dhcpcd/dist/defs.h       |   2 +-
 external/bsd/dhcpcd/dist/dhcp.c       |   5 +++++
 external/bsd/dhcpcd/dist/dhcpcd.c     |   4 ++++
 external/bsd/dhcpcd/dist/if-bsd.c     |   7 +++++++
 external/bsd/dhcpcd/dist/if-options.c |   2 +-
 external/bsd/dhcpcd/dist/net.c        |  10 +++-------
 external/bsd/dhcpcd/dist/net.h        |   1 +
 8 files changed, 23 insertions(+), 9 deletions(-)

diffs (117 lines):

diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/config.h
--- a/external/bsd/dhcpcd/dist/config.h Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/config.h Wed Mar 31 09:14:47 2010 +0000
@@ -4,3 +4,4 @@
 #define LIBEXECDIR     "/libexec"
 #define DBDIR          "/var/db"
 #define RUNDIR         "/var/run"
+#include "compat/getline.h"
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h   Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h   Wed Mar 31 09:14:47 2010 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "5.2.1"
+#define VERSION                        "5.2.2"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c   Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c   Wed Mar 31 09:14:47 2010 +0000
@@ -925,6 +925,11 @@
                if (sz < MTU_MIN) {
                        if (set_mtu(iface->name, MTU_MIN) == 0)
                                sz = MTU_MIN;
+               } else if (sz > MTU_MAX) {
+                       /* Even though our MTU could be greater than
+                        * MTU_MAX (1500) dhcpcd does not presently
+                        * handle DHCP packets any bigger. */
+                       sz = MTU_MAX;
                }
                sz = htons(sz);
                memcpy(p, &sz, 2);
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Wed Mar 31 09:14:47 2010 +0000
@@ -38,6 +38,7 @@
 #include <net/route.h>
 
 #ifdef __linux__
+#  include <asm/types.h> /* for systems with broken headers */
 #  include <linux/rtnetlink.h>
 #endif
 
@@ -765,6 +766,9 @@
        uint8_t *duid;
        size_t len = 0, ifl;
 
+       /* Do any platform specific configuration */
+       if_conf(iface);
+
        if (iface->flags & IFF_POINTOPOINT && !(ifo->options & DHCPCD_INFORM))
                ifo->options |= DHCPCD_STATIC;
        if (iface->flags & IFF_NOARP ||
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/if-bsd.c
--- a/external/bsd/dhcpcd/dist/if-bsd.c Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/if-bsd.c Wed Mar 31 09:14:47 2010 +0000
@@ -80,6 +80,13 @@
 }
 
 int
+if_conf(_unused struct interface *iface)
+{
+       /* No extra checks needed on BSD */
+       return 0;
+}
+
+int
 init_sockets(void)
 {
        if ((socket_afnet = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c     Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c     Wed Mar 31 09:14:47 2010 +0000
@@ -798,7 +798,7 @@
                    VENDORCLASSID_MAX_LEN,
                    "%s-%s:%s-%s:%s%s%s", PACKAGE, VERSION,
                    utn.sysname, utn.release, utn.machine,
-                   platform ? ":" : "", platform);
+                   platform ? ":" : "", platform ? platform : "");
        else
                ifo->vendorclassid[0] = snprintf((char *)ifo->vendorclassid + 1,
                    VENDORCLASSID_MAX_LEN, "%s-%s", PACKAGE, VERSION);
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/net.c
--- a/external/bsd/dhcpcd/dist/net.c    Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/net.c    Wed Mar 31 09:14:47 2010 +0000
@@ -668,14 +668,10 @@
        udp->uh_sum = checksum(udpp, sizeof(*udpp));
 
        ip->ip_v = IPVERSION;
-       ip->ip_hl = 5;
-       ip->ip_id = 0;
-       ip->ip_tos = IPTOS_LOWDELAY;
-       ip->ip_len = htons (sizeof(*ip) + sizeof(*udp) + length);
-       ip->ip_id = 0;
-       ip->ip_off = htons(IP_DF); /* Don't fragment */
+       ip->ip_hl = sizeof(*ip) >> 2;
+       ip->ip_id = arc4random() & UINT16_MAX;
        ip->ip_ttl = IPDEFTTL;
-
+       ip->ip_len = htons(sizeof(*ip) + sizeof(*udp) + length);
        ip->ip_sum = checksum(ip, sizeof(*ip));
 
        *packet = (uint8_t *)udpp;
diff -r d450d7a67883 -r 5989eda3ec51 external/bsd/dhcpcd/dist/net.h
--- a/external/bsd/dhcpcd/dist/net.h    Wed Mar 31 07:31:15 2010 +0000
+++ b/external/bsd/dhcpcd/dist/net.h    Wed Mar 31 09:14:47 2010 +0000
@@ -105,6 +105,7 @@
 int inet_cidrtoaddr(int, struct in_addr *);
 
 int up_interface(struct interface *);
+int if_conf(struct interface *);
 int if_init(struct interface *);
 
 int do_address(const char *,



Home | Main Index | Thread Index | Old Index