svn commit: r368295 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib

2020-12-02 Thread Cy Schubert
Author: cy
Date: Thu Dec  3 05:56:42 2020
New Revision: 368295
URL: https://svnweb.freebsd.org/changeset/base/368295

Log:
  MFC r366286:
  
  ipfilter getifname ifdef cleanup.

Modified:
  stable/12/contrib/ipfilter/lib/getifname.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/lib/getifname.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/lib/getifname.c
==
--- stable/12/contrib/ipfilter/lib/getifname.c  Thu Dec  3 05:49:59 2020
(r368294)
+++ stable/12/contrib/ipfilter/lib/getifname.c  Thu Dec  3 05:56:42 2020
(r368295)
@@ -19,11 +19,9 @@
 char *getifname(ptr)
struct ifnet *ptr;
 {
-#if SOLARIS || defined(__hpux)
-# if SOLARIS
+#if SOLARIS
 #  include 
 #  include 
-# endif
 # include "../pfil/qif.h"
char *ifname;
qif_t qif;
@@ -42,13 +40,6 @@ char *getifname(ptr)
}
return ifname;
 #else
-# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
-defined(__OpenBSD__) || \
-(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
-#else
-   char buf[LIFNAMSIZ];
-   int len;
-# endif
struct ifnet netif;
 
if ((void *)ptr == (void *)-1)
@@ -58,24 +49,6 @@ char *getifname(ptr)
 
if (kmemcpy((char *), (u_long)ptr, sizeof(netif)) == -1)
return "X";
-# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
-defined(__OpenBSD__) || defined(linux) || \
-(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
return strdup(netif.if_xname);
-# else
-   if (kstrncpy(buf, (u_long)netif.if_name, sizeof(buf)) == -1)
-   return "X";
-   if (netif.if_unit < 10)
-   len = 2;
-   else if (netif.if_unit < 1000)
-   len = 3;
-   else if (netif.if_unit < 1)
-   len = 4;
-   else
-   len = 5;
-   buf[sizeof(buf) - len] = '\0';
-   sprintf(buf + strlen(buf), "%d", netif.if_unit % 1);
-   return strdup(buf);
-# endif
 #endif
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r368295 - in stable: 11/contrib/ipfilter/lib 12/contrib/ipfilter/lib

2020-12-02 Thread Cy Schubert
Author: cy
Date: Thu Dec  3 05:56:42 2020
New Revision: 368295
URL: https://svnweb.freebsd.org/changeset/base/368295

Log:
  MFC r366286:
  
  ipfilter getifname ifdef cleanup.

Modified:
  stable/11/contrib/ipfilter/lib/getifname.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/ipfilter/lib/getifname.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/lib/getifname.c
==
--- stable/11/contrib/ipfilter/lib/getifname.c  Thu Dec  3 05:49:59 2020
(r368294)
+++ stable/11/contrib/ipfilter/lib/getifname.c  Thu Dec  3 05:56:42 2020
(r368295)
@@ -19,11 +19,9 @@
 char *getifname(ptr)
struct ifnet *ptr;
 {
-#if SOLARIS || defined(__hpux)
-# if SOLARIS
+#if SOLARIS
 #  include 
 #  include 
-# endif
 # include "../pfil/qif.h"
char *ifname;
qif_t qif;
@@ -42,13 +40,6 @@ char *getifname(ptr)
}
return ifname;
 #else
-# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
-defined(__OpenBSD__) || \
-(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
-#else
-   char buf[LIFNAMSIZ];
-   int len;
-# endif
struct ifnet netif;
 
if ((void *)ptr == (void *)-1)
@@ -58,24 +49,6 @@ char *getifname(ptr)
 
if (kmemcpy((char *), (u_long)ptr, sizeof(netif)) == -1)
return "X";
-# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
-defined(__OpenBSD__) || defined(linux) || \
-(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
return strdup(netif.if_xname);
-# else
-   if (kstrncpy(buf, (u_long)netif.if_name, sizeof(buf)) == -1)
-   return "X";
-   if (netif.if_unit < 10)
-   len = 2;
-   else if (netif.if_unit < 1000)
-   len = 3;
-   else if (netif.if_unit < 1)
-   len = 4;
-   else
-   len = 5;
-   buf[sizeof(buf) - len] = '\0';
-   sprintf(buf + strlen(buf), "%d", netif.if_unit % 1);
-   return strdup(buf);
-# endif
 #endif
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"