dhclient - Use addr_eq() when possible.
authorAntonio Huete Jimenez <tuxillo@quantumachine.net>
Wed, 1 Aug 2012 19:07:59 +0000 (21:07 +0200)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Sun, 19 Aug 2012 14:30:22 +0000 (16:30 +0200)
Taken-from: OpenBSD

sbin/dhclient/clparse.c
sbin/dhclient/dhclient.c

index 20e57a6..74a657b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: src/sbin/dhclient/clparse.c,v 1.35 2009/05/27 15:04:34 stevesk Exp $  */
+/*     $OpenBSD: src/sbin/dhclient/clparse.c,v 1.36 2009/07/19 00:18:02 stevesk Exp $  */
 
 /* Parser for dhclient config and lease files... */
 
 
 /* Parser for dhclient config and lease files... */
 
@@ -440,9 +440,7 @@ parse_client_lease_statement(FILE *cfile, int is_static)
         */
        pl = NULL;
        for (lp = client->leases; lp; lp = lp->next) {
         */
        pl = NULL;
        for (lp = client->leases; lp; lp = lp->next) {
-               if (lp->address.len == lease->address.len &&
-                   !memcmp(lp->address.iabuf, lease->address.iabuf,
-                   lease->address.len)) {
+               if (addr_eq(lp->address, lease->address)) {
                        if (pl)
                                pl->next = lp->next;
                        else
                        if (pl)
                                pl->next = lp->next;
                        else
@@ -480,10 +478,7 @@ parse_client_lease_statement(FILE *cfile, int is_static)
        if (client->active) {
                if (client->active->expiry < cur_time)
                        free_client_lease(client->active);
        if (client->active) {
                if (client->active->expiry < cur_time)
                        free_client_lease(client->active);
-               else if (client->active->address.len ==
-                   lease->address.len &&
-                   !memcmp(client->active->address.iabuf,
-                   lease->address.iabuf, lease->address.len))
+               else if (addr_eq(client->active->address, lease->address))
                        free_client_lease(client->active);
                else {
                        client->active->next = client->leases;
                        free_client_lease(client->active);
                else {
                        client->active->next = client->leases;
index ff7e5b0..211981f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.130 2009/06/12 20:07:35 stevesk Exp $        */
+/*     $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.131 2009/07/19 00:18:02 stevesk Exp $        */
 
 /*
  * Copyright 2004 Henning Brauer <henning@openbsd.org>
 
 /*
  * Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -796,10 +796,7 @@ dhcpoffer(struct iaddr client_addr, struct option_data *options)
 
        /* If this is the lease we asked for, put it at the head of the
           list, and don't mess with the arp request timeout. */
 
        /* If this is the lease we asked for, put it at the head of the
           list, and don't mess with the arp request timeout. */
-       if (lease->address.len == client->requested_address.len &&
-           !memcmp(lease->address.iabuf,
-           client->requested_address.iabuf,
-           client->requested_address.len)) {
+       if (addr_eq(lease->address, client->requested_address)) {
                lease->next = client->offered_leases;
                client->offered_leases = lease;
        } else {
                lease->next = client->offered_leases;
                client->offered_leases = lease;
        } else {