xref: /freebsd/sbin/ipf/libipf/dupmbt.c (revision 3e8eb5c7f4909209c042403ddee340b2ee7003a5)
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: dupmbt.c,v 1.3.2.2 2012/07/22 08:04:24 darren_r Exp $
7  */
8 
9 #include "ipf.h"
10 
11 mb_t *
12 dupmbt(mb_t *orig)
13 {
14 	mb_t *m;
15 
16 	m = (mb_t *)malloc(sizeof(mb_t));
17 	if (m == NULL)
18 		return (NULL);
19 	m->mb_len = orig->mb_len;
20 	m->mb_next = NULL;
21 	m->mb_data = (char *)m->mb_buf + (orig->mb_data - (char *)orig->mb_buf);
22 	bcopy(orig->mb_data, m->mb_data, m->mb_len);
23 	return (m);
24 }
25