Byte order in IP addresses in udebug?

Love lha at stacken.kth.se
Sun Aug 29 22:16:34 CEST 1999


Dr A V Le Blanc <LeBlanc at mcc.ac.uk> writes:

> I'm running arla 0.27 on a PII with linux-2.2.12.  I notice udebug
> produces this output:
> 
[..]
> 
> Note that the first IP address is correct (130.88.203.12) but that
> the ones in 'Last yes vote' and in the two Server lines are wrong,
> reversed from their correct order.

This might do.

Love


Index: udebug.c
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/appl/udebug/udebug.c,v
retrieving revision 1.6
diff -u -w -u -w -r1.6 udebug.c
--- udebug.c	1999/06/11 01:18:45	1.6
+++ udebug.c	1999/08/29 20:14:15
@@ -130,7 +130,7 @@
 	printf("Localtime is %s, differ %d seconds\n", 
 	       myctime((time_t) tv.tv_sec),
 	       abs(db.now - tv.tv_sec));
-	server.s_addr = db.syncHost;
+	server.s_addr = htonl(db.syncHost);
 	printf("Last yes vote for %s secs was %d ago (at %s)\n",
 	       inet_ntoa(server),
 	       ABS_COMP_DB(db,lastYesTime),
@@ -170,7 +170,7 @@
 		    continue;
 		}
 
-		server.s_addr = sdb.addr;
+		server.s_addr = htonl(sdb.addr);
 		printf("Server %s: (db %u.%u)\n",
 		       inet_ntoa(server),
 		       sdb.remoteVersion.epoch,
@@ -190,7 +190,7 @@
 
 	    }
 	} else {
-	    server.s_addr = db.syncHost;
+	    server.s_addr = htonl(db.syncHost);
 	    printf("I'm not the synchost, but %s is.\n",
 		   inet_ntoa(server));    
 	}





More information about the Arla-drinkers mailing list