summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ipf/lib/common/getifname.c
diff options
context:
space:
mode:
authoryz155240 <none@none>2006-07-19 01:15:53 -0700
committeryz155240 <none@none>2006-07-19 01:15:53 -0700
commitab25eeb551a4be927a4b6ae2cf8aff7ed17decb4 (patch)
tree8f3a55a94fbaf0fdcbf3d0270606e4528a9dbb37 /usr/src/cmd/ipf/lib/common/getifname.c
parente32cd585e45b9f19db8e971dfa93046993fced0f (diff)
downloadillumos-joyent-ab25eeb551a4be927a4b6ae2cf8aff7ed17decb4.tar.gz
PSARC 2006/082 IP Filter Code Merge on ip_fil4.1.9
4912568 ipftest ipf ipfstat ipnat ippool need a non-name resolution flag 5040248 ipfs -W fails to save kernel state tables 5081834 syntax parser reports wrong error position and line number 5094575 keyword "netmask" is un-supported in ipnat.conf (4) 6181751 ipf parser fails on wrong subnet notations 6181773 ipf parser fails on wrong port ranges 6248745 ipnat drops packets if the IP header is not 32 bit aligned 6340621 RFE: IP Filter code merge on ip_fil4.1.9 6359805 ipf command incorrectly check options in rules and core dumps 6395837 ipnat tcpudp parsing is incomplete 6426469 IPFilter rejects IPv6 neighbour discovery packets 6447872 usr/src/common/ipf/ip_compat.h should not be CDDL --HG-- rename : usr/src/common/ipf/bpf-ipf.h => usr/src/uts/common/inet/ipf/bpf-ipf.h rename : usr/src/common/ipf/fil.c => usr/src/uts/common/inet/ipf/fil.c rename : usr/src/common/ipf/ip_auth.c => usr/src/uts/common/inet/ipf/ip_auth.c rename : usr/src/common/ipf/ip_fil_solaris.c => usr/src/uts/common/inet/ipf/ip_fil_solaris.c rename : usr/src/common/ipf/ip_frag.c => usr/src/uts/common/inet/ipf/ip_frag.c rename : usr/src/common/ipf/ip_htable.c => usr/src/uts/common/inet/ipf/ip_htable.c rename : usr/src/common/ipf/ip_log.c => usr/src/uts/common/inet/ipf/ip_log.c rename : usr/src/common/ipf/ip_lookup.c => usr/src/uts/common/inet/ipf/ip_lookup.c rename : usr/src/common/ipf/ip_nat.c => usr/src/uts/common/inet/ipf/ip_nat.c rename : usr/src/common/ipf/ip_pool.c => usr/src/uts/common/inet/ipf/ip_pool.c rename : usr/src/common/ipf/ip_proxy.c => usr/src/uts/common/inet/ipf/ip_proxy.c rename : usr/src/common/ipf/ip_state.c => usr/src/uts/common/inet/ipf/ip_state.c rename : usr/src/common/ipf/ipf.h => usr/src/uts/common/inet/ipf/ipf.h rename : usr/src/common/ipf/ipmon.h => usr/src/uts/common/inet/ipf/ipmon.h rename : usr/src/common/ipf/ipt.h => usr/src/uts/common/inet/ipf/ipt.h rename : usr/src/common/ipf/Makefile => usr/src/uts/common/inet/ipf/netinet/Makefile rename : usr/src/common/ipf/ip_auth.h => usr/src/uts/common/inet/ipf/netinet/ip_auth.h rename : usr/src/common/ipf/ip_compat.h => usr/src/uts/common/inet/ipf/netinet/ip_compat.h rename : usr/src/common/ipf/ip_fil.h => usr/src/uts/common/inet/ipf/netinet/ip_fil.h rename : usr/src/common/ipf/ip_frag.h => usr/src/uts/common/inet/ipf/netinet/ip_frag.h rename : usr/src/common/ipf/ip_ftp_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_ftp_pxy.c rename : usr/src/common/ipf/ip_h323_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_h323_pxy.c rename : usr/src/common/ipf/ip_htable.h => usr/src/uts/common/inet/ipf/netinet/ip_htable.h rename : usr/src/common/ipf/ip_ipsec_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_ipsec_pxy.c rename : usr/src/common/ipf/ip_irc_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_irc_pxy.c rename : usr/src/common/ipf/ip_lookup.h => usr/src/uts/common/inet/ipf/netinet/ip_lookup.h rename : usr/src/common/ipf/ip_nat.h => usr/src/uts/common/inet/ipf/netinet/ip_nat.h rename : usr/src/common/ipf/ip_netbios_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_netbios_pxy.c rename : usr/src/common/ipf/ip_pool.h => usr/src/uts/common/inet/ipf/netinet/ip_pool.h rename : usr/src/common/ipf/ip_proxy.h => usr/src/uts/common/inet/ipf/netinet/ip_proxy.h rename : usr/src/common/ipf/ip_raudio_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_raudio_pxy.c rename : usr/src/common/ipf/ip_rcmd_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_rcmd_pxy.c rename : usr/src/common/ipf/ip_rpcb_pxy.c => usr/src/uts/common/inet/ipf/netinet/ip_rpcb_pxy.c rename : usr/src/common/ipf/ip_state.h => usr/src/uts/common/inet/ipf/netinet/ip_state.h rename : usr/src/common/ipf/ipl.h => usr/src/uts/common/inet/ipf/netinet/ipl.h rename : usr/src/common/ipf/opts.h => usr/src/uts/common/inet/ipf/opts.h rename : usr/src/common/ipf/radix.c => usr/src/uts/common/inet/ipf/radix.c rename : usr/src/common/ipf/radix.h => usr/src/uts/common/inet/ipf/radix.h rename : usr/src/common/ipf/solaris.c => usr/src/uts/common/inet/ipf/solaris.c rename : usr/src/uts/common/inet/ipf/compat.h => usr/src/uts/common/inet/pfil/compat.h rename : usr/src/uts/common/inet/ipf/misc.c => usr/src/uts/common/inet/pfil/misc.c rename : usr/src/uts/common/inet/ipf/ndd.c => usr/src/uts/common/inet/pfil/ndd.c rename : usr/src/uts/common/inet/ipf/os.h => usr/src/uts/common/inet/pfil/os.h rename : usr/src/uts/common/inet/ipf/pfil.c => usr/src/uts/common/inet/pfil/pfil.c rename : usr/src/uts/common/inet/ipf/pfil.conf => usr/src/uts/common/inet/pfil/pfil.conf rename : usr/src/uts/common/inet/ipf/pfil.h => usr/src/uts/common/inet/pfil/pfil.h rename : usr/src/common/ipf/pfild.h => usr/src/uts/common/inet/pfil/pfild.h rename : usr/src/uts/common/inet/ipf/pfildrv.c => usr/src/uts/common/inet/pfil/pfildrv.c rename : usr/src/uts/common/inet/ipf/pfilstream.c => usr/src/uts/common/inet/pfil/pfilstream.c rename : usr/src/uts/common/inet/ipf/pkt.c => usr/src/uts/common/inet/pfil/pkt.c rename : usr/src/uts/common/inet/ipf/qif.c => usr/src/uts/common/inet/pfil/qif.c rename : usr/src/uts/common/inet/ipf/qif.h => usr/src/uts/common/inet/pfil/qif.h
Diffstat (limited to 'usr/src/cmd/ipf/lib/common/getifname.c')
-rw-r--r--usr/src/cmd/ipf/lib/common/getifname.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/usr/src/cmd/ipf/lib/common/getifname.c b/usr/src/cmd/ipf/lib/common/getifname.c
index 39d193dcc6..a42a4e089b 100644
--- a/usr/src/cmd/ipf/lib/common/getifname.c
+++ b/usr/src/cmd/ipf/lib/common/getifname.c
@@ -1,6 +1,16 @@
+/*
+ * Copyright (C) 2003 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
#include "ipf.h"
#include "qif.h"
-
#include "kmem.h"
/*
@@ -10,24 +20,34 @@
char *getifname(ptr)
struct ifnet *ptr;
{
-#if SOLARIS
+#if SOLARIS || defined(__hpux)
+# if SOLARIS
+# include <sys/mutex.h>
+# include <sys/condvar.h>
+# endif
+# ifdef __hpux
+# include "compat.h"
+# endif
char *ifname;
- s_ill_t ill;
+ qif_t qif;
if ((void *)ptr == (void *)-1)
return "!";
if (ptr == NULL)
return "-";
- if (kmemcpy((char *)&ill, (u_long)ptr, sizeof(ill)) == -1)
+ if (kmemcpy((char *)&qif, (u_long)ptr, sizeof(qif)) == -1)
return "X";
- ifname = malloc(sizeof(ill.ill_name) + 1);
- strncpy(ifname, ill.ill_name, sizeof(ill.ill_name));
- ifname[sizeof(ill.ill_name)] = '\0';
+ ifname = strdup(qif.qf_name);
+ if ((ifname != NULL) && (*ifname == '\0')) {
+ free(ifname);
+ return "!";
+ }
return ifname;
#else
# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
- defined(__OpenBSD__)
+ defined(__OpenBSD__) || \
+ (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
#else
char buf[32];
int len;
@@ -42,7 +62,8 @@ struct ifnet *ptr;
if (kmemcpy((char *)&netif, (u_long)ptr, sizeof(netif)) == -1)
return "X";
# if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
- defined(__OpenBSD__)
+ 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)