summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorDarren Reed <Darren.Reed@Sun.COM>2008-09-08 14:46:50 -0700
committerDarren Reed <Darren.Reed@Sun.COM>2008-09-08 14:46:50 -0700
commit7ddc9b1afd18f260b9fb78ec7732facd91769131 (patch)
tree1a305ae7471e9362c1ba0ea3d32834448059eb00 /usr/src/cmd
parent7739299d04f7910358ca2ad79106f174022a9ab2 (diff)
downloadillumos-joyent-7ddc9b1afd18f260b9fb78ec7732facd91769131.tar.gz
PSARC/2008/219 Committed API for packet interception
PSARC/2008/335 Corrections for Committed API for packet interception PSARC/2008/557 Revision to net instance notification API 4844507 Solaris needs stable interface for packet filtering software 6705155 ipf_stack_init() assumes kmem_alloc with KM_NOSLEEP never fails
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/ipf/tools/ip_fil.c7
-rw-r--r--usr/src/cmd/ipf/tools/ipftest.c18
-rw-r--r--usr/src/cmd/mdb/common/modules/hook/hook.c48
-rw-r--r--usr/src/cmd/mdb/common/modules/neti/neti.c12
4 files changed, 37 insertions, 48 deletions
diff --git a/usr/src/cmd/ipf/tools/ip_fil.c b/usr/src/cmd/ipf/tools/ip_fil.c
index 29d69a8b07..a9824140d8 100644
--- a/usr/src/cmd/ipf/tools/ip_fil.c
+++ b/usr/src/cmd/ipf/tools/ip_fil.c
@@ -7,8 +7,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#if !defined(lint)
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)$Id: ip_fil.c,v 2.133.2.9 2005/01/08 14:22:18 darrenr Exp $";
@@ -175,9 +173,8 @@ static int write_output __P((struct ifnet *, struct mbuf *,
#endif
-int iplattach(ifs, ns)
+int iplattach(ifs)
ipf_stack_t *ifs;
-netstack_t *ns;
{
ifs->ifs_fr_running = 1;
return 0;
@@ -311,7 +308,7 @@ int mode;
if (error)
break;
if (tmp)
- error = iplattach(ifs, NULL);
+ error = iplattach(ifs);
else
error = ipldetach(ifs);
}
diff --git a/usr/src/cmd/ipf/tools/ipftest.c b/usr/src/cmd/ipf/tools/ipftest.c
index 4463e132de..04e1322acf 100644
--- a/usr/src/cmd/ipf/tools/ipftest.c
+++ b/usr/src/cmd/ipf/tools/ipftest.c
@@ -3,12 +3,10 @@
*
* See the IPFILTER.LICENCE file for details on licencing.
*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ipf.h"
#include "ipt.h"
#include <sys/ioctl.h>
@@ -40,7 +38,6 @@ void drain_log __P((char *, ipf_stack_t *ifs));
void fixv4sums __P((mb_t *, ip_t *));
ipf_stack_t *get_ifs __P((void));
ipf_stack_t *create_ifs __P((void));
-netstack_t *create_ns __P((void));
#if defined(__NetBSD__) || defined(__OpenBSD__) || SOLARIS || \
@@ -84,7 +81,6 @@ char *argv[];
mb_t mb, *m;
ip_t *ip;
ipf_stack_t *ifs;
- netstack_t *ns;
m = &mb;
dir = 0;
@@ -99,8 +95,6 @@ char *argv[];
initparse();
ifs = create_ifs();
- ns = create_ns();
- ifs->ifs_netstack = ns;
#if defined(IPFILTER_DEFAULT_BLOCK)
ifs->ifs_fr_pass = FR_BLOCK|FR_NOMATCH;
@@ -829,13 +823,3 @@ get_ifs()
{
return (gifs);
}
-
-netstack_t *
-create_ns()
-{
- netstack_t *ns;
-
- KMALLOCS(ns, netstack_t *, sizeof (*ns));
- bzero(ns, sizeof (*ns));
- return (ns);
-}
diff --git a/usr/src/cmd/mdb/common/modules/hook/hook.c b/usr/src/cmd/mdb/common/modules/hook/hook.c
index ec9679b2f9..353a592c64 100644
--- a/usr/src/cmd/mdb/common/modules/hook/hook.c
+++ b/usr/src/cmd/mdb/common/modules/hook/hook.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/rwlock.h>
#include <mdb/mdb_modapi.h>
@@ -47,6 +45,8 @@ hooklist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
char hrstr[MAX_LENGTH];
GElf_Sym sym;
char buf[MDB_SYM_NAMLEN + 1];
+ char *hintname;
+ hook_t *h;
if (argc)
return (DCMD_USAGE);
@@ -56,8 +56,9 @@ hooklist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_ERR);
}
- mdb_printf("%<u>%?s %10s %20s %?s%</u>\n",
- "ADDR", "FLAG", "FUNC", "NAME");
+ mdb_printf("%<u>%?s %8s %20s %4s %24s %24s%</u>\n",
+ "ADDR", "FLAG", "FUNC", "HINT", "NAME", "HINTVALUE");
+ h = &hl.hi_hook;
hlp = TAILQ_FIRST(&hr.hei_head);
while (hlp) {
if (mdb_vread((void *)&hl, sizeof (hl),
@@ -66,30 +67,39 @@ hooklist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
hlp);
return (DCMD_ERR);
}
- if (!hl.hi_hook.h_name) {
- mdb_warn("hook list at %p has null role",
- hl.hi_hook);
+ if (!h->h_name) {
+ mdb_warn("hook list at %p has null role", h);
return (DCMD_ERR);
}
if (mdb_readstr((char *)hrstr, sizeof (hrstr),
- (uintptr_t)hl.hi_hook.h_name) == -1) {
- mdb_warn("couldn't read list role at %p",
- hl.hi_hook.h_name);
+ (uintptr_t)h->h_name) == -1) {
+ mdb_warn("couldn't read list role at %p", h->h_name);
return (DCMD_ERR);
}
- if (mdb_lookup_by_addr((uintptr_t)hl.hi_hook.h_func,
+ switch (h->h_hint) {
+ case HH_BEFORE :
+ case HH_AFTER :
+ hintname = h->h_hintvalue ?
+ (char *)h->h_hintvalue : "";
+ break;
+ default :
+ hintname = "";
+ break;
+ }
+ if (mdb_lookup_by_addr((uintptr_t)h->h_func,
MDB_SYM_EXACT, buf, sizeof (buf), &sym) == -1)
- mdb_printf("%0?p %10x %0?p %10s\n",
- hlp, hl.hi_hook.h_flags, hl.hi_hook.h_func, hrstr);
+ mdb_printf("%0?p %8x %0?p %4d %24s %24s\n",
+ hlp, h->h_flags, h->h_func,
+ h->h_hint, hrstr, hintname);
else
- mdb_printf("%0?p %10x %20s %10s\n",
- hlp, hl.hi_hook.h_flags, buf, hrstr);
+ mdb_printf("%0?p %8x %20s %4d %24s %24s\n",
+ hlp, h->h_flags, buf,
+ h->h_hint, hrstr, hintname);
hlp = TAILQ_NEXT(&hl, hi_entry);
}
return (DCMD_OK);
}
-
/*
* List pfhooks event information.
* List the hooks information in verbose mode as well.
@@ -217,7 +227,7 @@ hookevent_stack_walk_init(mdb_walk_state_t *wsp)
}
wsp->walk_addr = (uintptr_t)SLIST_FIRST(&hf.hfi_head);
return (wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
- wsp->walk_cbdata));
+ wsp->walk_cbdata));
}
static int
@@ -234,7 +244,7 @@ hookevent_stack_walk_step(mdb_walk_state_t *wsp)
if (wsp->walk_addr == NULL)
return (WALK_DONE);
return (wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
- wsp->walk_cbdata));
+ wsp->walk_cbdata));
}
static const mdb_dcmd_t dcmds[] = {
diff --git a/usr/src/cmd/mdb/common/modules/neti/neti.c b/usr/src/cmd/mdb/common/modules/neti/neti.c
index e58fa42f0b..e18110997f 100644
--- a/usr/src/cmd/mdb/common/modules/neti/neti.c
+++ b/usr/src/cmd/mdb/common/modules/neti/neti.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/rwlock.h>
#include <mdb/mdb_modapi.h>
@@ -72,15 +70,15 @@ netinfolist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
mdb_warn("couldn't read netinfo at %p", p);
return (DCMD_ERR);
}
- if (!nd.netd_info.neti_protocol) {
+ if (!nd.netd_info.netp_name) {
mdb_warn("netinfo at %p has null protocol",
- nd.netd_info.neti_protocol);
+ nd.netd_info.netp_name);
return (DCMD_ERR);
}
if (mdb_readstr((char *)str, sizeof (str),
- (uintptr_t)nd.netd_info.neti_protocol) == -1) {
+ (uintptr_t)nd.netd_info.netp_name) == -1) {
mdb_warn("couldn't read protocol at %p",
- nd.netd_info.neti_protocol);
+ nd.netd_info.netp_name);
return (DCMD_ERR);
}