static __inline struct m_tag *
m_tag_locate(struct mbuf *m, u_int32_t n, int x, struct m_tag *t)
{
- return NULL;
+ struct m_tag *tag;
+
+ tag = m_tag_first(m);
+ if (tag == NULL)
+ return NULL;
+
+ if (tag->m_tag_cookie != n || tag->m_tag_id != x)
+ return NULL;
+ else
+ return tag;
};
#define M_SETFIB(_m, _fib) /* nothing on linux */
+
static __inline void
m_freem(struct mbuf *m)
{
#define M_GETFIB(_m) 0
+/* macro used to create a new mbuf */
+#define MT_DATA 1 /* dynamic (data) allocation */
+#define MSIZE 256 /* size of an mbuf */
+#define MGETHDR(_m, _how, _type) ((_m) = m_gethdr((_how), (_type)))
+
+/* allocate and init a new mbuf using the same structure of FreeBSD */
+static __inline struct mbuf *
+m_gethdr(int how, short type)
+{
+ struct mbuf *m;
+
+ m = malloc(MSIZE, M_IPFW, M_NOWAIT);
+
+ if (m == NULL) {
+ return m;
+ }
+
+ /* here we have MSIZE - sizeof(struct mbuf) available */
+ m->m_data = m + 1;
+
+ return m;
+}
+
#endif /* __linux__ || _WIN32 */
/*