[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclinux-dev
Subject:    Re: [uClinux-dev] [patch] use memcmp() rather than bcmp()
From:       Greg Ungerer <gerg () snapgear ! com>
Date:       2007-06-27 6:10:42
Message-ID: 4681FF62.3070000 () snapgear ! com
[Download RAW message or body]

Hi Mike,

Mike Frysinger wrote:
> bcmp() is deprecated in SUSV3 so ive changed dhcpcd to use memcmp().
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Applied, thanks.

Regards
Greg



> ---
> Index: user/dhcpcd/arp.c
> ===================================================================
> RCS file: /var/cvs/uClinux-dist/user/dhcpcd/arp.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 arp.c
> --- user/dhcpcd/arp.c	19 Sep 2002 04:24:19 -0000	1.1.1.1
> +++ user/dhcpcd/arp.c	27 May 2007 07:42:22 -0000
> @@ -77,7 +77,7 @@ arpCheck(u_long inaddr, struct ifinfo *i
> 				rv = 0;
> 			}
> 			if ( arp.operation == htons(ARPOP_REPLY) &&
> -				bcmp(arp.tHaddr, ifbuf->haddr, 6) == 0 &&
> +				memcmp(arp.tHaddr, ifbuf->haddr, 6) == 0 &&
> 				*((u_int *)arp.sInaddr) == inaddr ) {
> 				rv = 0;
> 				break;
> Index: user/dhcpcd/llip_utils.c
> ===================================================================
> RCS file: /var/cvs/uClinux-dist/user/dhcpcd/llip_utils.c,v
> retrieving revision 1.1.1.2
> diff -u -p -r1.1.1.2 llip_utils.c
> --- user/dhcpcd/llip_utils.c	26 Feb 2003 01:51:10 -0000	1.1.1.2
> +++ user/dhcpcd/llip_utils.c	27 May 2007 07:42:23 -0000
> @@ -131,7 +131,7 @@ int llip_arpCheck(char* device_name, u_l
> 			}
> 
> 			/* Receive response to our arp probe from a host configured with the IP  */
> -			if(arp.operation == htons(ARPOP_REPLY) && bcmp(arp.tHaddr, source_hw_addr, 6) \
> == 0 && *((u_int *)arp.sInaddr) == test_addr ) { +			if(arp.operation == \
> htons(ARPOP_REPLY) && memcmp(arp.tHaddr, source_hw_addr, 6) == 0 && *((u_int \
> *)arp.sInaddr) == test_addr ) {  rv = 0; /* address used */
> 				break;
> 			}
> @@ -141,7 +141,7 @@ int llip_arpCheck(char* device_name, u_l
> 			   where two or more hosts by chance attempt to configure the same IP address.
> 			   If we receive an ARP probe for the same IP address from another hardware \
> address  then we return the fact the address is used */
> -			if(arp.operation == htons(ARPOP_REPLY) && bcmp(arp.ethhdr.h_dest, \
> MAC_BCAST_ADDR, 6) == 0 && *((u_int *)arp.tInaddr) == test_addr && *((u_int *) \
> arp.sInaddr) == 0 ) { +			if(arp.operation == htons(ARPOP_REPLY) && \
> memcmp(arp.ethhdr.h_dest, MAC_BCAST_ADDR, 6) == 0 && *((u_int *)arp.tInaddr) == \
> test_addr && *((u_int *) arp.sInaddr) == 0 ) {  rv = 0;  /* address used - race \
> condition caught */  break;
> 			}
> @@ -238,7 +238,7 @@ int llip_CheckCollision(int collision_so
> 			}
> 
> 			/* Receive response to our arp probe from a host configured with the IP  */
> -			if(arp.operation == htons(ARPOP_REPLY) && bcmp(arp.tHaddr, source_hw_addr, 6) \
> == 0 && *((u_int *)arp.sInaddr) == test_addr ) { +			if(arp.operation == \
> htons(ARPOP_REPLY) && memcmp(arp.tHaddr, source_hw_addr, 6) == 0 && *((u_int \
> *)arp.sInaddr) == test_addr ) {  rv = 0; /* address used */
> 				break;
> 			}
> @@ -248,7 +248,7 @@ int llip_CheckCollision(int collision_so
> 			   where two or more hosts by chance attempt to configure the same IP address.
> 			   If we receive an ARP probe for the same IP address from another hardware \
> address  then we return the fact the address is used */
> -			if(arp.operation == htons(ARPOP_REPLY) && bcmp(arp.ethhdr.h_dest, \
> MAC_BCAST_ADDR, 6) == 0 && *((u_int *)arp.tInaddr) == test_addr && *((u_int *) \
> arp.sInaddr) == 0 ) { +			if(arp.operation == htons(ARPOP_REPLY) && \
> memcmp(arp.ethhdr.h_dest, MAC_BCAST_ADDR, 6) == 0 && *((u_int *)arp.tInaddr) == \
> test_addr && *((u_int *) arp.sInaddr) == 0 ) {  rv = 0;  /* address used - race \
> condition caught */  break;
> 			}
> Index: user/dhcpcd/options.c
> ===================================================================
> RCS file: /var/cvs/uClinux-dist/user/dhcpcd/options.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 options.c
> --- user/dhcpcd/options.c	19 Sep 2002 04:24:19 -0000	1.1.1.1
> +++ user/dhcpcd/options.c	27 May 2007 07:42:23 -0000
> @@ -156,7 +156,7 @@ parseDhcpMsg(u_char *optp[], dhcpMessage
> 	if ( msg->xid != DhcpMsgSend.xid ) {
> 		return 0;				/* NG */
> 	}
> -	if ( bcmp(msg->chaddr, DhcpMsgSend.chaddr, DhcpMsgSend.hlen) ) {
> +	if ( memcmp(msg->chaddr, DhcpMsgSend.chaddr, DhcpMsgSend.hlen) ) {
> 		return 0;				/* NG */
> 	}
> 	bzero((char *)opt, sizeof(opt));
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev@uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev@uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
> 

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg@snapgear.com
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic