sin_family is not network order
authorChas Williams (CONTRACTOR) <chas@cmf.nrl.navy.mil>
Sun, 3 Oct 2010 18:35:46 +0000 (14:35 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 3 Oct 2010 19:09:56 +0000 (12:09 -0700)
sin_family isnt sent over the network and therefore doesnt need
htons().  sin_family is essential the same as domain, and no one
does socket(htons(AF_INET), ...)

Change-Id: Ie0e2396f78e0934d49aeeacfc9c5ffe98df211b6
Reviewed-on: http://gerrit.openafs.org/2891
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afsmonitor/afsmonitor.c
src/fsprobe/fsprobe_test.c
src/scout/scout.c
src/xstat/xstat_cm_test.c
src/xstat/xstat_fs_test.c

index 45df72e..952a95d 100644 (file)
@@ -3847,12 +3847,8 @@ afsmon_execute(void)
            }
            strncpy(curr_CM->hostName, he->h_name, HOST_NAME_LEN);      /* complete name */
            memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4);
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-           curr_skt->sin_family = AF_INET;             /*Internet family */
-#else
-           curr_skt->sin_family = htons(AF_INET);      /*Internet family */
-#endif
-           curr_skt->sin_port = htons(7001);   /*Cache Manager port */
+           curr_skt->sin_family = AF_INET;
+           curr_skt->sin_port = htons(7001);   /* Cache Manager port */
 #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
            curr_skt->sin_len = sizeof(struct sockaddr_in);
 #endif
index 4bd825a..2481ed8 100644 (file)
@@ -156,12 +156,8 @@ main(int argc, char **argv)
     /*
      * Fill in the socket array for bigbird, vice1, and vice2.
      */
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-    FSSktArray[0].sin_family = AF_INET;                /*Internet family */
-#else
-    FSSktArray[0].sin_family = htons(AF_INET); /*Internet family */
-#endif
-    FSSktArray[0].sin_port = htons(7000);      /*FileServer port */
+    FSSktArray[0].sin_family = AF_INET;
+    FSSktArray[0].sin_port = htons(7000);      /* FileServer port */
     he = hostutil_GetHostByName("servername1");
     if (he == NULL) {
        fprintf(stderr, "[%s] Can't get host info for servername1\n", rn);
@@ -169,12 +165,8 @@ main(int argc, char **argv)
     }
     memcpy(&(FSSktArray[0].sin_addr.s_addr), he->h_addr, 4);
 
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-    FSSktArray[1].sin_family = AF_INET;                /*Internet address family */
-#else
-    FSSktArray[1].sin_family = htons(AF_INET); /*Internet address family */
-#endif
-    FSSktArray[1].sin_port = htons(7000);      /*FileServer port */
+    FSSktArray[1].sin_family = AF_INET;
+    FSSktArray[1].sin_port = htons(7000);      /* FileServer port */
     he = hostutil_GetHostByName("servername2");
     if (he == NULL) {
        fprintf(stderr, "[%s] Can't get host info for servername2\n", rn);
@@ -182,12 +174,8 @@ main(int argc, char **argv)
     }
     memcpy(&(FSSktArray[1].sin_addr.s_addr), he->h_addr, 4);
 
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-    FSSktArray[2].sin_family = AF_INET;                /*Internet address family */
-#else
-    FSSktArray[2].sin_family = htons(AF_INET); /*Internet address family */
-#endif
-    FSSktArray[2].sin_port = htons(7000);      /*FileServer port */
+    FSSktArray[2].sin_family = AF_INET;
+    FSSktArray[2].sin_port = htons(7000);      /* FileServer port */
     he = hostutil_GetHostByName("servername3");
     if (he == NULL) {
        fprintf(stderr, "[%s] Can't get host info for servername3\n", rn);
index 78e16d5..9877ae1 100644 (file)
@@ -1738,12 +1738,8 @@ execute_scout(int a_numservers, struct cmd_item *a_srvname, int a_pkg)
            return (-1);
        }
        memcpy(&(curr_skt->sin_addr.s_addr), he->h_addr, 4);
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       curr_skt->sin_family = AF_INET;         /*Internet family */
-#else
-       curr_skt->sin_family = htons(AF_INET);  /*Internet family */
-#endif
-       curr_skt->sin_port = htons(7000);       /*FileServer port */
+       curr_skt->sin_family = AF_INET;
+       curr_skt->sin_port = htons(7000);       /* FileServer port */
 
        /*
         * Bump our pointers.
index 38b4a46..9404d98 100644 (file)
@@ -1295,12 +1295,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock)
      */
     curr_item = a_s->parms[P_CM_NAMES].items;
     for (currCM = 0; currCM < numCMs; currCM++) {
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       CMSktArray[currCM].sin_family = AF_INET;        /*Internet family */
-#else
-       CMSktArray[currCM].sin_family = htons(AF_INET); /*Internet family */
-#endif
-       CMSktArray[currCM].sin_port = htons(7001);      /*Cache Manager port */
+       CMSktArray[currCM].sin_family = AF_INET;
+       CMSktArray[currCM].sin_port = htons(7001);      /* Cache Manager port */
        he = hostutil_GetHostByName(curr_item->data);
        if (he == NULL) {
            fprintf(stderr, "[%s] Can't get host info for '%s'\n", rn,
index 3765cee..4409e2a 100644 (file)
@@ -707,12 +707,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *dummy)
      */
     curr_item = a_s->parms[P_FS_NAMES].items;
     for (currFS = 0; currFS < numFSs; currFS++) {
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-       FSSktArray[currFS].sin_family = AF_INET;        /*Internet family */
-#else
-       FSSktArray[currFS].sin_family = htons(AF_INET); /*Internet family */
-#endif
-       FSSktArray[currFS].sin_port = htons(7000);      /*FileServer port */
+       FSSktArray[currFS].sin_family = AF_INET;
+       FSSktArray[currFS].sin_port = htons(7000);      /* FileServer port */
        he = hostutil_GetHostByName(curr_item->data);
        if (he == NULL) {
            fprintf(stderr, "[%s] Can't get host info for '%s'\n", rn,