summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-06-26 22:24:16 +0000
committerjulian <julian@FreeBSD.org>2004-06-26 22:24:16 +0000
commit5a269c8a7e26638b8f896d1601618e5253776958 (patch)
tree5db990cf15727892f404908f26b492b9f1b8a509 /sys/netgraph
parentcb255821c823542b64070fb2864196922202a027 (diff)
downloadFreeBSD-src-5a269c8a7e26638b8f896d1601618e5253776958.zip
FreeBSD-src-5a269c8a7e26638b8f896d1601618e5253776958.tar.gz
Having moved metadata usage to mbuf tags, remove code that supports
the old way of doing it. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_bridge.c15
-rw-r--r--sys/netgraph/ng_etf.c8
-rw-r--r--sys/netgraph/ng_ether.c21
-rw-r--r--sys/netgraph/ng_gif.c12
-rw-r--r--sys/netgraph/ng_hub.c12
-rw-r--r--sys/netgraph/ng_iface.c3
-rw-r--r--sys/netgraph/ng_l2tp.c3
-rw-r--r--sys/netgraph/ng_one2many.c13
-rw-r--r--sys/netgraph/ng_ppp.c71
-rw-r--r--sys/netgraph/ng_pppoe.c4
-rw-r--r--sys/netgraph/ng_sample.c20
-rw-r--r--sys/netgraph/ng_tee.c15
12 files changed, 55 insertions, 142 deletions
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index e9a6340..2f20b3d 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -520,7 +520,6 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
int error = 0, linkNum, linksSeen;
int manycast;
struct mbuf *m;
- meta_p meta;
struct ng_bridge_link *firstLink;
NGI_GET_M(item, m);
@@ -666,11 +665,9 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
}
/* Distribute unknown, multicast, broadcast pkts to all other links */
- meta = NGI_META(item); /* peek.. */
firstLink = NULL;
for (linkNum = linksSeen = 0; linksSeen <= priv->numLinks; linkNum++) {
struct ng_bridge_link *destLink;
- meta_p meta2 = NULL;
struct mbuf *m2 = NULL;
/*
@@ -705,7 +702,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
/*
* It's usable link but not the reserved (first) one.
- * Copy mbuf and meta info for sending.
+ * Copy mbuf info for sending.
*/
m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */
if (m2 == NULL) {
@@ -714,14 +711,6 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
NG_FREE_M(m);
return (ENOBUFS);
}
- if (meta != NULL
- && (meta2 = ng_copy_meta(meta)) == NULL) {
- link->stats.memoryFailures++;
- m_freem(m2);
- NG_FREE_ITEM(item);
- NG_FREE_M(m);
- return (ENOMEM);
- }
}
/* Update stats */
@@ -747,7 +736,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
NG_FWD_NEW_DATA(error, item, destLink->hook, m);
break; /* always done last - not really needed. */
} else {
- NG_SEND_DATA(error, destLink->hook, m2, meta2);
+ NG_SEND_DATA_ONLY(error, destLink->hook, m2);
}
}
return (error);
diff --git a/sys/netgraph/ng_etf.c b/sys/netgraph/ng_etf.c
index ad4b712..f41746c 100644
--- a/sys/netgraph/ng_etf.c
+++ b/sys/netgraph/ng_etf.c
@@ -351,12 +351,12 @@ ng_etf_rcvmsg(node_p node, item_p item, hook_p lasthook)
/*
* Receive data, and do something with it.
* Actually we receive a queue item which holds the data.
- * If we free the item it wil also froo the data and metadata unless
- * we have previously disassociated them using the NGI_GET_etf() macros.
+ * If we free the item it will also free the data unless we have previously
+ * disassociated it using the NGI_GET_etf() macro.
* Possibly send it out on another link after processing.
* Possibly do something different if it comes from different
- * hooks. the caller will never free m or meta, so
- * if we use up this data or abort we must free BOTH of these.
+ * hooks. The caller will never free m , so if we use up this data
+ * or abort we must free it.
*
* If we want, we may decide to force this data to be queued and reprocessed
* at the netgraph NETISR time.
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 9b95d6a..8d9b765 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -94,8 +94,8 @@ static void ng_ether_attach(struct ifnet *ifp);
static void ng_ether_detach(struct ifnet *ifp);
/* Other functions */
-static int ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta);
-static int ng_ether_rcv_upper(node_p node, struct mbuf *m, meta_p meta);
+static int ng_ether_rcv_lower(node_p node, struct mbuf *m);
+static int ng_ether_rcv_upper(node_p node, struct mbuf *m);
/* Netgraph node methods */
static ng_constructor_t ng_ether_constructor;
@@ -485,15 +485,14 @@ ng_ether_rcvdata(hook_p hook, item_p item)
const node_p node = NG_HOOK_NODE(hook);
const priv_p priv = NG_NODE_PRIVATE(node);
struct mbuf *m;
- meta_p meta;
NGI_GET_M(item, m);
- NGI_GET_META(item, meta);
NG_FREE_ITEM(item);
+
if (hook == priv->lower || hook == priv->orphan)
- return ng_ether_rcv_lower(node, m, meta);
+ return ng_ether_rcv_lower(node, m);
if (hook == priv->upper)
- return ng_ether_rcv_upper(node, m, meta);
+ return ng_ether_rcv_upper(node, m);
panic("%s: weird hook", __func__);
#ifdef RESTARTABLE_PANICS /* so we don't get an error msg in LINT */
return NULL;
@@ -504,14 +503,11 @@ ng_ether_rcvdata(hook_p hook, item_p item)
* Handle an mbuf received on the "lower" or "orphan" hook.
*/
static int
-ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta)
+ng_ether_rcv_lower(node_p node, struct mbuf *m)
{
const priv_p priv = NG_NODE_PRIVATE(node);
struct ifnet *const ifp = priv->ifp;
- /* Discard meta info */
- NG_FREE_META(meta);
-
/* Check whether interface is ready for packets */
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
NG_FREE_M(m);
@@ -549,13 +545,10 @@ ng_ether_rcv_lower(node_p node, struct mbuf *m, meta_p meta)
* Handle an mbuf received on the "upper" hook.
*/
static int
-ng_ether_rcv_upper(node_p node, struct mbuf *m, meta_p meta)
+ng_ether_rcv_upper(node_p node, struct mbuf *m)
{
const priv_p priv = NG_NODE_PRIVATE(node);
- /* Discard meta info */
- NG_FREE_META(meta);
-
m->m_pkthdr.rcvif = priv->ifp;
/* Route packet back in */
diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c
index 4ed3875..9ef3cc9 100644
--- a/sys/netgraph/ng_gif.c
+++ b/sys/netgraph/ng_gif.c
@@ -106,7 +106,7 @@ static void ng_gif_detach(struct ifnet *ifp);
/* Other functions */
static void ng_gif_input2(node_p node, struct mbuf **mp, int af);
static int ng_gif_glue_af(struct mbuf **mp, int af);
-static int ng_gif_rcv_lower(node_p node, struct mbuf *m, meta_p meta);
+static int ng_gif_rcv_lower(node_p node, struct mbuf *m);
/* Netgraph node methods */
static ng_constructor_t ng_gif_constructor;
@@ -441,13 +441,12 @@ ng_gif_rcvdata(hook_p hook, item_p item)
const node_p node = NG_HOOK_NODE(hook);
const priv_p priv = NG_NODE_PRIVATE(node);
struct mbuf *m;
- meta_p meta;
NGI_GET_M(item, m);
- NGI_GET_META(item, meta);
NG_FREE_ITEM(item);
+
if (hook == priv->lower)
- return ng_gif_rcv_lower(node, m, meta);
+ return ng_gif_rcv_lower(node, m);
panic("%s: weird hook", __func__);
}
@@ -455,16 +454,13 @@ ng_gif_rcvdata(hook_p hook, item_p item)
* Handle an mbuf received on the "lower" hook.
*/
static int
-ng_gif_rcv_lower(node_p node, struct mbuf *m, meta_p meta)
+ng_gif_rcv_lower(node_p node, struct mbuf *m)
{
struct sockaddr dst;
const priv_p priv = NG_NODE_PRIVATE(node);
bzero(&dst, sizeof(dst));
- /* We don't process metadata. */
- NG_FREE_META(meta);
-
/* Make sure header is fully pulled up */
if (m->m_pkthdr.len < sizeof(sa_family_t)) {
NG_FREE_M(m);
diff --git a/sys/netgraph/ng_hub.c b/sys/netgraph/ng_hub.c
index dd25f2a..ba298e5 100644
--- a/sys/netgraph/ng_hub.c
+++ b/sys/netgraph/ng_hub.c
@@ -64,8 +64,6 @@ ng_hub_rcvdata(hook_p hook, item_p item)
int error = 0;
hook_p hook2;
struct mbuf * const m = NGI_M(item), *m2;
- meta_p const meta = NGI_META(item);
- meta_p meta2;
int nhooks;
if ((nhooks = NG_NODE_NUMHOOKS(node)) == 1) {
@@ -82,15 +80,7 @@ ng_hub_rcvdata(hook_p hook, item_p item)
NG_FREE_ITEM(item);
return (ENOBUFS);
}
- if (meta != NULL) {
- if ((meta2 = ng_copy_meta(meta)) == NULL) {
- m_freem(m2);
- NG_FREE_ITEM(item);
- return (ENOMEM);
- }
- } else
- meta2 = NULL;
- NG_SEND_DATA(error, hook2, m2, meta2);
+ NG_SEND_DATA_ONLY(error, hook2, m2);
if (error)
continue; /* don't give up */
}
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index c25477a..c200191 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -428,7 +428,6 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m,
{
const priv_p priv = (priv_p) ifp->if_softc;
const iffam_p iffam = get_iffam_from_af(dst->sa_family);
- meta_p meta = NULL;
int len, error = 0;
/* Check interface flags */
@@ -462,7 +461,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m,
len = m->m_pkthdr.len;
/* Send packet; if hook is not connected, mbuf will get freed. */
- NG_SEND_DATA(error, *get_hook_from_iffam(priv, iffam), m, meta);
+ NG_SEND_DATA_ONLY(error, *get_hook_from_iffam(priv, iffam), m);
/* Update stats */
if (error == 0) {
diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c
index d9c7771..995d64c 100644
--- a/sys/netgraph/ng_l2tp.c
+++ b/sys/netgraph/ng_l2tp.c
@@ -1378,7 +1378,6 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns)
{
struct l2tp_seq *const seq = &priv->seq;
u_int16_t session_id = 0;
- meta_p meta = NULL;
int error;
/* If no mbuf passed, send an empty packet (ZLB) */
@@ -1431,7 +1430,7 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns)
seq->xack = seq->nr;
/* Send packet */
- NG_SEND_DATA(error, priv->lower, m, meta);
+ NG_SEND_DATA_ONLY(error, priv->lower, m);
return (error);
}
diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c
index 4c9720e..83f39d6 100644
--- a/sys/netgraph/ng_one2many.c
+++ b/sys/netgraph/ng_one2many.c
@@ -381,7 +381,6 @@ ng_one2many_rcvdata(hook_p hook, item_p item)
int linkNum;
int i;
struct mbuf *m;
- meta_p meta;
m = NGI_M(item); /* just peaking, mbuf still owned by item */
/* Get link number */
@@ -411,7 +410,6 @@ ng_one2many_rcvdata(hook_p hook, item_p item)
priv->nextMany = (priv->nextMany + 1) % priv->numActiveMany;
break;
case NG_ONE2MANY_XMIT_ALL:
- meta = NGI_META(item); /* peek.. */
/* no need to copy data for the 1st one */
dst = &priv->many[priv->activeMany[0]];
@@ -419,7 +417,6 @@ ng_one2many_rcvdata(hook_p hook, item_p item)
* except the first one, which we'll do last
*/
for (i = 1; i < priv->numActiveMany; i++) {
- meta_p meta2 = NULL;
struct mbuf *m2;
struct ng_one2many_link *mdst;
@@ -431,18 +428,10 @@ ng_one2many_rcvdata(hook_p hook, item_p item)
NG_FREE_M(m);
return (ENOBUFS);
}
- if (meta != NULL
- && (meta2 = ng_copy_meta(meta)) == NULL) {
- mdst->stats.memoryFailures++;
- m_freem(m2);
- NG_FREE_ITEM(item);
- NG_FREE_M(m);
- return (ENOMEM);
- }
/* Update transmit stats */
mdst->stats.xmitPackets++;
mdst->stats.xmitOctets += m->m_pkthdr.len;
- NG_SEND_DATA(error, mdst->hook, m2, meta2);
+ NG_SEND_DATA_ONLY(error, mdst->hook, m2);
}
break;
#ifdef INVARIANTS
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c
index d5d0e52..26be68f 100644
--- a/sys/netgraph/ng_ppp.c
+++ b/sys/netgraph/ng_ppp.c
@@ -138,7 +138,6 @@ struct ng_ppp_frag {
u_char last; /* Last in packet? */
struct timeval timestamp; /* time of reception */
struct mbuf *data; /* Fragment data */
- meta_p meta; /* Fragment meta */
TAILQ_ENTRY(ng_ppp_frag) f_qent; /* Fragment queue */
};
@@ -227,13 +226,13 @@ static int ng_ppp_output(node_p node, int bypass, int proto,
int linkNum, item_p item);
static int ng_ppp_mp_input(node_p node, int linkNum, item_p item);
static int ng_ppp_check_packet(node_p node);
-static void ng_ppp_get_packet(node_p node, struct mbuf **mp, meta_p *metap);
+static void ng_ppp_get_packet(node_p node, struct mbuf **mp);
static int ng_ppp_frag_process(node_p node);
static int ng_ppp_frag_trim(node_p node);
static void ng_ppp_frag_timeout(void *arg);
static void ng_ppp_frag_checkstale(node_p node);
static void ng_ppp_frag_reset(node_p node);
-static int ng_ppp_mp_output(node_p node, struct mbuf *m, meta_p meta);
+static int ng_ppp_mp_output(node_p node, struct mbuf *m);
static void ng_ppp_mp_strategy(node_p node, int len, int *distrib);
static int ng_ppp_intcmp(const void *v1, const void *v2);
static struct mbuf *ng_ppp_addproto(struct mbuf *m, int proto, int compOK);
@@ -1003,12 +1002,9 @@ ng_ppp_output(node_p node, int bypass,
/* Special handling for the MP virtual link */
if (linkNum == NG_PPP_BUNDLE_LINKNUM) {
- meta_p meta;
-
- /* strip off and discard the queue item */
- NGI_GET_META(item, meta);
+ /* discard the queue item */
NG_FREE_ITEM(item);
- return ng_ppp_mp_output(node, m, meta);
+ return ng_ppp_mp_output(node, m);
}
/* Prepend address and control field (unless compressed) */
@@ -1094,10 +1090,8 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
struct ng_ppp_frag *qent;
int i, diff, inserted;
struct mbuf *m;
- meta_p meta;
NGI_GET_M(item, m);
- NGI_GET_META(item, meta);
NG_FREE_ITEM(item);
/* Stats */
priv->bundleStats.recvFrames++;
@@ -1110,13 +1104,11 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
if (m->m_pkthdr.len < 2) {
link->stats.runts++;
NG_FREE_M(m);
- NG_FREE_META(meta);
return (EINVAL);
}
- if (m->m_len < 2 && (m = m_pullup(m, 2)) == NULL) {
- NG_FREE_META(meta);
+ if (m->m_len < 2 && (m = m_pullup(m, 2)) == NULL)
return (ENOBUFS);
- }
+
shdr = ntohs(*mtod(m, u_int16_t *));
frag->seq = MP_SHORT_EXTEND(shdr);
frag->first = (shdr & MP_SHORT_FIRST_FLAG) != 0;
@@ -1129,13 +1121,11 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
if (m->m_pkthdr.len < 4) {
link->stats.runts++;
NG_FREE_M(m);
- NG_FREE_META(meta);
return (EINVAL);
}
- if (m->m_len < 4 && (m = m_pullup(m, 4)) == NULL) {
- NG_FREE_META(meta);
+ if (m->m_len < 4 && (m = m_pullup(m, 4)) == NULL)
return (ENOBUFS);
- }
+
lhdr = ntohl(*mtod(m, u_int32_t *));
frag->seq = MP_LONG_EXTEND(lhdr);
frag->first = (lhdr & MP_LONG_FIRST_FLAG) != 0;
@@ -1144,7 +1134,6 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
m_adj(m, 4);
}
frag->data = m;
- frag->meta = meta;
getmicrouptime(&frag->timestamp);
/* If sequence number is < MSEQ, we've already declared this
@@ -1152,7 +1141,6 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
if (diff < 0) {
link->stats.dropFragments++;
NG_FREE_M(m);
- NG_FREE_META(meta);
return (0);
}
@@ -1170,7 +1158,6 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
MALLOC(frag, struct ng_ppp_frag *, sizeof(*frag), M_NETGRAPH_PPP, M_NOWAIT);
if (frag == NULL) {
NG_FREE_M(m);
- NG_FREE_META(meta);
ng_ppp_frag_process(node);
return (ENOMEM);
}
@@ -1187,7 +1174,6 @@ ng_ppp_mp_input(node_p node, int linkNum, item_p item)
} else if (diff == 0) { /* should never happen! */
link->stats.dupFragments++;
NG_FREE_M(frag->data);
- NG_FREE_META(frag->meta);
FREE(frag, M_NETGRAPH_PPP);
return (EINVAL);
}
@@ -1239,7 +1225,7 @@ ng_ppp_check_packet(node_p node)
* This assumes there is a completed packet there to pull off.
*/
static void
-ng_ppp_get_packet(node_p node, struct mbuf **mp, meta_p *metap)
+ng_ppp_get_packet(node_p node, struct mbuf **mp)
{
const priv_p priv = NG_NODE_PRIVATE(node);
struct ng_ppp_frag *qent, *qnext;
@@ -1253,13 +1239,11 @@ ng_ppp_get_packet(node_p node, struct mbuf **mp, meta_p *metap)
KASSERT(!TAILQ_EMPTY(&priv->frags),
("%s: empty q", __func__));
TAILQ_REMOVE(&priv->frags, qent, f_qent);
- if (tail == NULL) {
+ if (tail == NULL)
tail = m = qent->data;
- *metap = qent->meta; /* inherit first frag's meta */
- } else {
+ else {
m->m_pkthdr.len += qent->data->m_pkthdr.len;
tail->m_next = qent->data;
- NG_FREE_META(qent->meta); /* drop other frags' metas */
}
while (tail->m_next != NULL)
tail = tail->m_next;
@@ -1314,7 +1298,6 @@ ng_ppp_frag_trim(node_p node)
priv->bundleStats.dropFragments++;
TAILQ_REMOVE(&priv->frags, qent, f_qent);
NG_FREE_M(qent->data);
- NG_FREE_META(qent->meta);
FREE(qent, M_NETGRAPH_PPP);
priv->qlen--;
removed = 1;
@@ -1331,21 +1314,20 @@ ng_ppp_frag_process(node_p node)
{
const priv_p priv = NG_NODE_PRIVATE(node);
struct mbuf *m;
- meta_p meta;
item_p item;
/* Deliver any deliverable packets */
while (ng_ppp_check_packet(node)) {
- ng_ppp_get_packet(node, &m, &meta);
- item = ng_package_data(m, meta);
+ ng_ppp_get_packet(node, &m);
+ item = ng_package_data(m, NULL);
ng_ppp_input(node, 0, NG_PPP_BUNDLE_LINKNUM, item);
}
/* Delete dead fragments and try again */
if (ng_ppp_frag_trim(node)) {
while (ng_ppp_check_packet(node)) {
- ng_ppp_get_packet(node, &m, &meta);
- item = ng_package_data(m, meta);
+ ng_ppp_get_packet(node, &m);
+ item = ng_package_data(m, NULL);
ng_ppp_input(node, 0, NG_PPP_BUNDLE_LINKNUM, item);
}
}
@@ -1380,7 +1362,6 @@ ng_ppp_frag_process(node_p node)
priv->bundleStats.dropFragments++;
TAILQ_REMOVE(&priv->frags, qent, f_qent);
NG_FREE_M(qent->data);
- NG_FREE_META(qent->meta);
FREE(qent, M_NETGRAPH_PPP);
priv->qlen--;
@@ -1411,7 +1392,6 @@ ng_ppp_frag_checkstale(node_p node)
struct ng_ppp_frag *qent, *beg, *end;
struct timeval now, age;
struct mbuf *m;
- meta_p meta;
int i, seq;
item_p item;
int endseq;
@@ -1459,14 +1439,13 @@ ng_ppp_frag_checkstale(node_p node)
priv->bundleStats.dropFragments++;
TAILQ_REMOVE(&priv->frags, qent, f_qent);
NG_FREE_M(qent->data);
- NG_FREE_META(qent->meta);
FREE(qent, M_NETGRAPH_PPP);
priv->qlen--;
}
/* Extract completed packet */
endseq = end->seq;
- ng_ppp_get_packet(node, &m, &meta);
+ ng_ppp_get_packet(node, &m);
/* Bump MSEQ if necessary */
if (MP_RECV_SEQ_DIFF(priv, priv->mseq, endseq) < 0) {
@@ -1482,7 +1461,7 @@ ng_ppp_frag_checkstale(node_p node)
}
/* Deliver packet */
- item = ng_package_data(m, meta);
+ item = ng_package_data(m, NULL);
ng_ppp_input(node, 0, NG_PPP_BUNDLE_LINKNUM, item);
}
}
@@ -1523,7 +1502,7 @@ ng_ppp_frag_timeout(void *arg)
* the frame across the individual PPP links and do so.
*/
static int
-ng_ppp_mp_output(node_p node, struct mbuf *m, meta_p meta)
+ng_ppp_mp_output(node_p node, struct mbuf *m)
{
const priv_p priv = NG_NODE_PRIVATE(node);
const int hdr_len = priv->conf.xmitShortSeq ? 2 : 4;
@@ -1535,7 +1514,6 @@ ng_ppp_mp_output(node_p node, struct mbuf *m, meta_p meta)
/* At least one link must be active */
if (priv->numActiveLinks == 0) {
NG_FREE_M(m);
- NG_FREE_META(meta);
return (ENETDOWN);
}
@@ -1581,7 +1559,6 @@ deliver:
for ( ; distrib[activeLinkNum] > 0; firstFragment = 0) {
int len, lastFragment, error;
struct mbuf *m2;
- meta_p meta2;
/* Calculate fragment length; don't exceed link MTU */
len = distrib[activeLinkNum];
@@ -1597,7 +1574,6 @@ deliver:
if (n == NULL) {
NG_FREE_M(m);
- NG_FREE_META(meta);
return (ENOMEM);
}
m = n;
@@ -1632,21 +1608,15 @@ deliver:
if (m2 == NULL) {
if (!lastFragment)
m_freem(m);
- NG_FREE_META(meta);
return (ENOBUFS);
}
- /* Copy the meta information, if any */
- meta2 = lastFragment ? meta : ng_copy_meta(meta);
-
/* Send fragment */
- item = ng_package_data(m2, meta2);
+ item = ng_package_data(m2, NULL);
error = ng_ppp_output(node, 0, PROT_MP, linkNum, item);
if (error != 0) {
- if (!lastFragment) {
+ if (!lastFragment)
NG_FREE_M(m);
- NG_FREE_META(meta);
- }
return (error);
}
}
@@ -2056,7 +2026,6 @@ ng_ppp_frag_reset(node_p node)
for (qent = TAILQ_FIRST(&priv->frags); qent; qent = qnext) {
qnext = TAILQ_NEXT(qent, f_qent);
NG_FREE_M(qent->data);
- NG_FREE_META(qent->meta);
FREE(qent, M_NETGRAPH_PPP);
}
TAILQ_INIT(&priv->frags);
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 5a7a3f2..31287da 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -942,8 +942,8 @@ send_sessionid(sessp sp)
/*
* Receive data, and do something with it.
- * The caller will never free m or meta, so
- * if we use up this data or abort we must free BOTH of these.
+ * The caller will never free m, so if we use up this data
+ * or abort we must free it.
*/
static int
ng_pppoe_rcvdata(hook_p hook, item_p item)
diff --git a/sys/netgraph/ng_sample.c b/sys/netgraph/ng_sample.c
index 20a3056..48b58c7 100644
--- a/sys/netgraph/ng_sample.c
+++ b/sys/netgraph/ng_sample.c
@@ -310,12 +310,12 @@ ng_xxx_rcvmsg(node_p node, item_p item, hook_p lasthook)
/*
* Receive data, and do something with it.
* Actually we receive a queue item which holds the data.
- * If we free the item it wil also froo the data and metadata unless
- * we have previously disassociated them using the NGI_GET_xxx() macros.
+ * If we free the item it will also free the data unless we have
+ * previously disassociated it using the NGI_GET_M() macro.
* Possibly send it out on another link after processing.
* Possibly do something different if it comes from different
- * hooks. the caller will never free m or meta, so
- * if we use up this data or abort we must free BOTH of these.
+ * hooks. The caller will never free m, so if we use up this data or
+ * abort we must free it.
*
* If we want, we may decide to force this data to be queued and reprocessed
* at the netgraph NETISR time.
@@ -358,15 +358,15 @@ ng_xxx_rcvdata(hook_p hook, item_p item )
return (ENETUNREACH);
}
/* If we were called at splnet, use the following:
- * NG_SEND_DATA(error, otherhook, m, meta); if this
+ * NG_SEND_DATA_ONLY(error, otherhook, m); if this
* node is running at some SPL other than SPLNET
* then you should use instead: error =
- * ng_queueit(otherhook, m, meta); m = NULL: meta =
- * NULL; this queues the data using the standard
- * NETISR system and schedules the data to be picked
+ * ng_queueit(otherhook, m, NULL); m = NULL;
+ * This queues the data using the standard NETISR
+ * system and schedules the data to be picked
* up again once the system has moved to SPLNET and
- * the processing of the data can continue. after
- * these are run 'm' and 'meta' should be considered
+ * the processing of the data can continue. After
+ * these are run 'm' should be considered
* as invalid and NG_SEND_DATA actually zaps them. */
NG_FWD_NEW_DATA(error, item,
xxxp->channel[chan].hook, m);
diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c
index 67762d0..c9d57cd 100644
--- a/sys/netgraph/ng_tee.c
+++ b/sys/netgraph/ng_tee.c
@@ -291,10 +291,8 @@ ngt_rcvdata(hook_p hook, item_p item)
struct hookinfo *dup;
int error = 0;
struct mbuf *m;
- meta_p meta;
m = NGI_M(item);
- meta = NGI_META(item); /* leave these owned by the item */
/* Which hook? */
if (hinfo == &sc->left) {
dup = &sc->left2right;
@@ -327,26 +325,17 @@ ngt_rcvdata(hook_p hook, item_p item)
dup = NULL;
}
- /* Duplicate packet and meta info if requried */
+ /* Duplicate packet if requried */
if (dup && dup->hook) {
struct mbuf *m2;
- meta_p meta2;
/* Copy packet (failure will not stop the original)*/
m2 = m_dup(m, M_DONTWAIT);
if (m2) {
-
- /* Copy meta info */
- /* If we can't get a copy, tough.. */
- if (meta != NULL) {
- meta2 = ng_copy_meta(meta);
- } else
- meta2 = NULL;
-
/* Deliver duplicate */
dup->stats.outOctets += m->m_pkthdr.len;
dup->stats.outFrames++;
- NG_SEND_DATA(error, dup->hook, m2, meta2);
+ NG_SEND_DATA_ONLY(error, dup->hook, m2);
}
}
/* Deliver frame out destination hook */
OpenPOWER on IntegriCloud