There are two patches in this file.

The first will stop "from any to sppp0/32" panic'ing on Solaris.

The second makes ipfstat print it out properly.

Darren

Index: ip_fil_solaris.c
===================================================================
RCS file: /devel/CVS/IP-Filter/ip_fil_solaris.c,v
retrieving revision 2.62.2.2
diff -c -r2.62.2.2 ip_fil_solaris.c
*** ip_fil_solaris.c    2004/03/22 12:18:11     2.62.2.2
--- ip_fil_solaris.c    2004/03/29 15:11:23
***************
*** 800,805 ****
--- 800,808 ----
        struct sockaddr_in sin, mask;
        qif_t *qif;
  
+       if ((qifptr == NULL) || (qifptr == (void *)-1))
+               return -1;
+ 
        qif = qifptr;
  
  #ifdef        USE_INET6
Index: lib/printfr.c
===================================================================
RCS file: /devel/CVS/IP-Filter/lib/printfr.c,v
retrieving revision 1.43.2.1
diff -c -r1.43.2.1 printfr.c
*** printfr.c   2004/03/06 14:33:29     1.43.2.1
--- printfr.c   2004/03/29 14:53:33
***************
*** 31,36 ****
--- 31,89 ----
  }
  
  
+ static void printaddr(v, type, ifname, addr, mask)
+ int v, type;
+ char *ifname;
+ u_32_t *addr, *mask;
+ {
+       char *suffix;
+ 
+       switch (type)
+       {
+       case FRI_BROADCAST :
+               suffix = "/bcast";
+               break;
+ 
+       case FRI_DYNAMIC :
+               printf("%s", ifname);
+               printmask(mask);
+               suffix = NULL;
+               break;
+ 
+       case FRI_NETWORK :
+               suffix = "/net";
+               break;
+ 
+       case FRI_NETMASKED :
+               suffix = "/netmasked";
+               break;
+ 
+       case FRI_PEERADDR :
+               suffix = "/peer";
+               break;
+ 
+       case FRI_LOOKUP :
+               suffix = NULL;
+               printlookup((i6addr_t *)addr, (i6addr_t *)mask);
+               break;
+ 
+       case FRI_NORMAL :
+               printhostmask(v, addr, mask);
+               suffix = NULL;
+               break;
+       default :
+               printf("<%d>", type);
+               printmask(mask);
+               suffix = NULL;
+               break;
+       }
+ 
+       if (suffix != NULL) {
+               printf("%s/%s", ifname, suffix);
+       }
+ }
+ 
+ 
  /*
   * print the filter structure in a useful way
   */
***************
*** 161,204 ****
                printf("all");
        } else if (type == FR_T_IPF) {
                printf("from %s", fp->fr_flags & FR_NOTSRCIP ? "!" : "");
!               if (fp->fr_satype != FRI_NORMAL) {
!                       if (fp->fr_satype == FRI_BROADCAST)
!                               printf("%s/bcast", fp->fr_ifname);
!                       else if (fp->fr_satype == FRI_NETWORK)
!                               printf("%s/net", fp->fr_ifname);
!                       else if (fp->fr_satype == FRI_NETMASKED)
!                               printf("%s/netmasked", fp->fr_ifname);
!                       else if (fp->fr_satype == FRI_PEERADDR)
!                               printf("%s/peer", fp->fr_ifname);
!                       else if (fp->fr_satype == FRI_LOOKUP)
!                               printlookup(&fp->fr_ip.fi_src,
!                                           &fp->fr_mip.fi_src);
!                       else
!                               printmask((u_32_t *)&fp->fr_smsk.s_addr);
!               } else
!                       printhostmask(fp->fr_v, (u_32_t *)&fp->fr_src.s_addr,
!                                     (u_32_t *)&fp->fr_smsk.s_addr);
                if (fp->fr_scmp)
                        printportcmp(pr, &fp->fr_tuc.ftu_src);
  
                printf(" to %s", fp->fr_flags & FR_NOTDSTIP ? "!" : "");
!               if (fp->fr_datype != FRI_NORMAL) {
!                       if (fp->fr_datype == FRI_BROADCAST)
!                               printf("%s/bcast", fp->fr_ifname);
!                       else if (fp->fr_datype == FRI_NETWORK)
!                               printf("%s/net", fp->fr_ifname);
!                       else if (fp->fr_datype == FRI_NETMASKED)
!                               printf("%s/netmasked", fp->fr_ifname);
!                       else if (fp->fr_datype == FRI_PEERADDR)
!                               printf("%s/peer", fp->fr_ifname);
!                       else if (fp->fr_datype == FRI_LOOKUP)
!                               printlookup(&fp->fr_ip.fi_dst,
!                                           &fp->fr_mip.fi_dst);
!                       else
!                               printmask((u_32_t *)&fp->fr_dmsk.s_addr);
!               } else
!                       printhostmask(fp->fr_v, (u_32_t *)&fp->fr_dst.s_addr,
!                                     (u_32_t *)&fp->fr_dmsk.s_addr);
                if (fp->fr_dcmp)
                        printportcmp(pr, &fp->fr_tuc.ftu_dst);
  
--- 214,227 ----
                printf("all");
        } else if (type == FR_T_IPF) {
                printf("from %s", fp->fr_flags & FR_NOTSRCIP ? "!" : "");
!               printaddr(fp->fr_v, fp->fr_satype, fp->fr_ifname,
!                         &fp->fr_src.s_addr, &fp->fr_smsk.s_addr);
                if (fp->fr_scmp)
                        printportcmp(pr, &fp->fr_tuc.ftu_src);
  
                printf(" to %s", fp->fr_flags & FR_NOTDSTIP ? "!" : "");
!               printaddr(fp->fr_v, fp->fr_datype, fp->fr_ifname,
!                         &fp->fr_dst.s_addr, &fp->fr_dmsk.s_addr);
                if (fp->fr_dcmp)
                        printportcmp(pr, &fp->fr_tuc.ftu_dst);
  

Reply via email to