Skip to contentSkip to conversation

IPUtils and uClibc

PATCH Applied Rafał Bilski 2 participants 2 messages Jul 29, 2007 – Oct 12, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Today I was trying to update my router based on Gentoo and uClibc. Unfortunatly build fails because of b* functions. Linker can't find them later. At first gcc is complaining that b* functions are impilicity declared. Acording to man pages these functions are deprecated anyway. Patch is for Gentoo's iputils-20070202.

---

clockdiff.c   |    4 ++--
ping.c        |   13 +++++++------
rdisc.c       |    6 +++---
traceroute6.c |    6 +++---
4 files changed, 15 insertions(+), 14 deletions(-)
clockdiff.c +0 -0
index e17e0b8..ee7bb76 100644
@@ -594,7 +594,7 @@ main(int argc, char *argv[])
 
	memset(&server, 0, sizeof(server));
	server.sin_family = hp->h_addrtype;

- bcopy(hp->h_addr, &(server.sin_addr.s_addr), 4); + memcpy(&(server.sin_addr.s_addr), hp->h_addr, 4);

	if (connect(sock_raw, (struct sockaddr*)&server, sizeof(server)) == -1) {
		perror("connect");
@@ -605,7 +605,7 @@ main(int argc, char *argv[])
		socklen_t addrlen = sizeof(myaddr);
		unsigned char rspace[ip_opt_len];

- bzero(rspace, sizeof(rspace));

+	        memset(rspace, 0, sizeof(rspace));
		rspace[0] = IPOPT_TIMESTAMP;
		rspace[1] = ip_opt_len;
		rspace[2] = 5;
ping.c +1 -0
index 561e71a..6148fd9 100644
@@ -58,6 +58,7 @@ char copyright[] =
 *	This program has to run SUID to ROOT to access the ICMP socket.
 */
 
+#include <string.h>

#include "ping_common.h"

#include <netinet/ip.h>
@@ -235,7 +236,7 @@ main(int argc, char **argv)

	while (argc > 0) {
		target = *argv;

- bzero((char *)&whereto, sizeof(whereto));

+		memset((char *)&whereto, 0, sizeof(whereto));
		whereto.sin_family = AF_INET;
		if (inet_aton(target, &whereto.sin_addr) == 1) {
			hostname = target;

@@ -393,7 +394,7 @@ main(int argc, char **argv)

	/* record route option */
	if (options & F_RROUTE) {
-	        bzero(rspace, sizeof(rspace));
+	        memset(rspace, 0, sizeof(rspace));
		rspace[0] = IPOPT_NOP;
		rspace[1+IPOPT_OPTVAL] = IPOPT_RR;
		rspace[1+IPOPT_OLEN] = sizeof(rspace)-1;
@@ -405,7 +406,7 @@ main(int argc, char **argv)
		}
	}
	if (options & F_TIMESTAMP) {
-	        bzero(rspace, sizeof(rspace));
+	        memset(rspace, 0, sizeof(rspace));
		rspace[0] = IPOPT_TIMESTAMP;
		rspace[1] = (ts_type==IPOPT_TS_TSONLY ? 40 : 36);
		rspace[2] = 5;
@@ -427,7 +428,7 @@ main(int argc, char **argv)
	}
	if (options & F_SOURCEROUTE) {
	        int i;
-	        bzero(rspace, sizeof(rspace));
+	        memset(rspace, 0, sizeof(rspace));
		rspace[0] = IPOPT_NOOP;
		rspace[1+IPOPT_OPTVAL] = (options & F_SO_DONTROUTE) ? IPOPT_SSRR
			: IPOPT_LSRR;
@@ -1009,7 +1010,7 @@ void pr_options(unsigned char * cp, int hlen)
			if (i <= 0)
				continue;
			if (i == old_rrlen
-			    && !bcmp((char *)cp, old_rr, i)
+			    && !strncmp((char *)cp, old_rr, i)
			    && !(options & F_FLOOD)) {
				printf("\t(same route)");
				i = ((i + 3) / 4) * 4;
@@ -1017,7 +1018,7 @@ void pr_options(unsigned char * cp, int hlen)
				break;
			}
			old_rrlen = i;
-			bcopy((char *)cp, old_rr, i);
+			memcpy(old_rr, (char *)cp, i);
			printf("\nRR: ");
			cp++;
			for (;;) {
rdisc.c +0 -0
index bb223bc..b1eab40 100644
@@ -409,11 +409,11 @@ next:
		forever = 1;
	}

- bzero( (char *)&whereto, sizeof(struct sockaddr_in) );

+	memset( (char *)&whereto, 0, sizeof(struct sockaddr_in) );
	to->sin_family = AF_INET;
	to->sin_addr.s_addr = inet_addr(sendaddress);

- bzero( (char *)&joinaddr, sizeof(struct sockaddr_in) );

+	memset( (char *)&joinaddr, 0, sizeof(struct sockaddr_in) );
	joinaddr.sin_family = AF_INET;
	joinaddr.sin_addr.s_addr = inet_addr(recvaddress);

@@ -1468,7 +1468,7 @@ rtioctl(struct in_addr addr, int op)

	struct rtentry rt;
	struct sockaddr_in *sin;

- bzero((char *)&rt, sizeof(struct rtentry));

+	memset((char *)&rt, 0, sizeof(struct rtentry));
	rt.rt_dst.sa_family = AF_INET;
	rt.rt_gateway.sa_family = AF_INET;
	rt.rt_genmask.sa_family = AF_INET;
traceroute6.c +0 -0
index 114cb0a..2dd5c42 100644
@@ -276,7 +276,7 @@ char copyright[] =
#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))

-#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
+#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
#endif

#define Fprintf (void)fprintf
@@ -422,7 +422,7 @@ int main(int argc, char *argv[])

	setlinebuf (stdout);

- (void) bzero((char *)&whereto, sizeof(whereto));
+ (void) memset((char *)&whereto, 0, sizeof(whereto));

	to->sin6_family = AF_INET6;
	to->sin6_port = htons(port);
@@ -534,7 +534,7 @@ int main(int argc, char *argv[])
		saddr.sin6_port = 0;
		close(probe_fd);
	} else {
-		(void) bzero((char *)&saddr, sizeof(saddr));
+		(void) memset((char *)&saddr, 0, sizeof(saddr));
		saddr.sin6_family = AF_INET6;
		if (inet_pton(AF_INET6, source, &saddr.sin6_addr) <= 0)
		{
Signature · 2 lines
----------------------------------------------------------------------
Wszystko czego potrzebujesz latem: kremy do opalania, stroje kapielowe, maly romans 
Quoted 1 line
Quoted 1 line
Quoted 1 line

http://link.interia.pl/f1b15

#1 lore raw

In article <[email protected]> (at Mon, 30 Jul 2007 00:50:39 +0200), Rafał Bilski <[email protected]> says:

Quoted 6 lines

Today I was trying to update my router based on Gentoo and uClibc. Unfortunatly build fails because of b* functions. Linker can't find them later. At first gcc is complaining that b* functions are impilicity declared. Acording to man pages these functions are deprecated anyway.
Patch is for Gentoo's iputils-20070202.

:

Applied, thanks.

--yoshfuji