[BACK]Return to route.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / netstat

Diff for /src/usr.bin/netstat/route.c between version 1.37 and 1.38

version 1.37, 2000/05/18 01:32:12 version 1.38, 2000/09/19 03:18:46
Line 268 
Line 268 
                 printf("%-*s ", PLEN, "Address");                  printf("%-*s ", PLEN, "Address");
         printf("%-18s %-5s %-18s %-5s %-5s %-22s\n",          printf("%-18s %-5s %-18s %-5s %-5s %-22s\n",
             "Source", "Port", "Destination",              "Source", "Port", "Destination",
             "Port", "Proto", "SA(Address/SPI/Proto)");              "Port", "Proto", "SA(Address/Proto/Type/Direction)");
 }  }
   
 static struct sockaddr *  static struct sockaddr *
Line 985 
Line 985 
         register struct rtentry *rt;          register struct rtentry *rt;
 {  {
         struct sockaddr_encap sen1, sen2, sen3;          struct sockaddr_encap sen1, sen2, sen3;
           struct ipsec_policy ipo;
   
 #ifdef INET6  #ifdef INET6
         struct sockaddr_in6 s61, s62;          struct sockaddr_in6 s61, s62;
         char ip6addr[64];          char ip6addr[64];
Line 1031 
Line 1033 
 #endif /* INET6 */  #endif /* INET6 */
   
         if (sen3.sen_type == SENT_IPSP)          if (sen3.sen_type == SENT_IPSP)
           printf("%s/%08x/%-u\n", inet_ntoa(sen3.sen_ipsp_dst),          {
                  ntohl(sen3.sen_ipsp_spi), sen3.sen_ipsp_sproto);              char hostn[NI_MAXHOST];
   
 #ifdef INET6              kget(sen3.sen_ipsp, ipo);
         if (sen3.sen_type == SENT_IPSP6)  
         {              getnameinfo(&ipo.ipo_dst.sa, ipo.ipo_dst.sa.sa_len,
             inet_ntop(AF_INET6, &sen3.sen_ipsp6_dst,                          hostn, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
                       ip6addr, sizeof(ip6addr));              printf("%s", hostn);
             printf("%s/%08x/%-u\n", ip6addr, ntohl(sen3.sen_ipsp6_spi),  
                    sen3.sen_ipsp6_sproto);              printf("/%-u", ipo.ipo_sproto);
         }  
 #endif /* INET6 */              switch (ipo.ipo_type)
               {
                   case IPSP_IPSEC_REQUIRE:
                       printf("/require");
                       break;
   
                   case IPSP_IPSEC_ACQUIRE:
                       printf("/acquire");
                       break;
   
                   case IPSP_IPSEC_USE:
                       printf("/use");
                       break;
   
                   case IPSP_IPSEC_DONTACQ:
                       printf("/dontacq");
                       break;
   
                   case IPSP_PERMIT:
                       printf("/permit");
                       break;
   
                   case IPSP_DENY:
                       printf("/deny");
                       break;
   
                   default:
                       printf("/<unknown type!>");
               }
   
               if ((ipo.ipo_addr.sen_type == SENT_IP4 &&
                    ipo.ipo_addr.sen_direction == IPSP_DIRECTION_IN) ||
                   (ipo.ipo_addr.sen_type == SENT_IP6 &&
                    ipo.ipo_addr.sen_ip6_direction == IPSP_DIRECTION_IN))
                 printf("/in\n");
               else
                 if ((ipo.ipo_addr.sen_type == SENT_IP4 &&
                      ipo.ipo_addr.sen_direction == IPSP_DIRECTION_OUT) ||
                     (ipo.ipo_addr.sen_type == SENT_IP6 &&
                      ipo.ipo_addr.sen_ip6_direction == IPSP_DIRECTION_OUT))
                   printf("/out\n");
                 else
                   printf("/<unknown>\n");
           }
 }  }
   
 void  void

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38