nps: poci/nws_poci.c - jnet0 is just a peer-to-peer interface, we ...

baggins baggins at pld-linux.org
Mon Sep 12 17:20:29 CEST 2005


Author: baggins                      Date: Mon Sep 12 15:20:29 2005 GMT
Module: nps                           Tag: HEAD
---- Log message:
- jnet0 is just a peer-to-peer interface, we don't have to play with
  netmasks and prefixes, just set ip as peer to peer

---- Files affected:
nps/poci:
   nws_poci.c (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: nps/poci/nws_poci.c
diff -u nps/poci/nws_poci.c:1.6 nps/poci/nws_poci.c:1.7
--- nps/poci/nws_poci.c:1.6	Mon Sep 12 16:43:59 2005
+++ nps/poci/nws_poci.c	Mon Sep 12 17:20:24 2005
@@ -908,7 +908,8 @@
     int fd;
     int rc;
     int pref;
-    struct in_addr inp;
+    struct in_addr pl_ip, sp_ip;
+    char pl_addr[16], sp_addr[16];
     unsigned long platIp, spIp;
     char *drivername = JNET_DRIVERNAME;
     char command[BUFSIZE]; 
@@ -937,10 +938,13 @@
     }
     close(fd);
 
-    inp.s_addr = ntohl(platIp);
+    pl_ip.s_addr = ntohl(platIp);
+    sp_ip.s_addr = ntohl(spIp);
 fprintf(stderr, "%0x, %0x, %d\n", spIp, platIp, sizeof(spIp));
-    pref = calc_minimal_prefix(spIp, platIp);
-    snprintf(command,BUFSIZE,"/sbin/ip address flush jnet0 ; /sbin/ip address add %s/%d dev jnet0", inet_ntoa(inp), pref);
+    strncpy(pl_addr, inet_ntoa(pl_ip), 16);
+    strncpy(sp_addr, inet_ntoa(sp_ip), 16);
+    snprintf(command,BUFSIZE,"/sbin/ip address flush jnet0 ; /sbin/ip address add %s peer %s dev jnet0", pl_addr, sp_addr);
+fprintf(stderr, "%s\n", command);
 
     rc = system(command);
     if(rc != 0) {
@@ -1721,10 +1725,9 @@
 	close(fd1);
 
         //now bring restart the network at this new address.
-	pref = calc_minimal_prefix(inet_network(spIp), inet_network(platIp));
 	snprintf(command,BUFSIZE,"/sbin/ip address flush jnet0 ;"
-				 "/sbin/ip address add %s/%d dev jnet0",
-				 platIp, pref);
+				 "/sbin/ip address add %s peer %s dev jnet0",
+				 platIp, spIp);
 fprintf(stderr, "set: %s\n", command);
         if( system(command) != 0) {
             syslog(LOG_CRIT, "Jnet set ip failed\n");
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/nps/poci/nws_poci.c?r1=1.6&r2=1.7&f=u




More information about the pld-cvs-commit mailing list