Deleted Added
full compact
ng_base.c (69923) ng_base.c (70159)
1
2/*
3 * ng_base.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 23 unchanged lines hidden (view full) ---

32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Authors: Julian Elischer <julian@freebsd.org>
38 * Archie Cobbs <archie@freebsd.org>
39 *
1
2/*
3 * ng_base.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 23 unchanged lines hidden (view full) ---

32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Authors: Julian Elischer <julian@freebsd.org>
38 * Archie Cobbs <archie@freebsd.org>
39 *
40 * $FreeBSD: head/sys/netgraph/ng_base.c 69923 2000-12-12 18:59:09Z julian $
40 * $FreeBSD: head/sys/netgraph/ng_base.c 70159 2000-12-18 20:03:32Z julian $
41 * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $
42 */
43
44/*
45 * This file implements the base netgraph code.
46 */
47
48#include <sys/param.h>

--- 802 unchanged lines hidden (view full) ---

851 * Install a new netgraph type
852 */
853int
854ng_newtype(struct ng_type *tp)
855{
856 const size_t namelen = strlen(tp->name);
857
858 /* Check version and type name fields */
41 * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $
42 */
43
44/*
45 * This file implements the base netgraph code.
46 */
47
48#include <sys/param.h>

--- 802 unchanged lines hidden (view full) ---

851 * Install a new netgraph type
852 */
853int
854ng_newtype(struct ng_type *tp)
855{
856 const size_t namelen = strlen(tp->name);
857
858 /* Check version and type name fields */
859 if (tp->version != NG_VERSION || namelen == 0 || namelen > NG_TYPELEN) {
859 if ((tp->version != NG_ABI_VERSION)
860 || (namelen == 0)
861 || (namelen > NG_TYPELEN)) {
860 TRAP_ERROR;
861 return (EINVAL);
862 }
863
864 /* Check for name collision */
865 if (ng_findtype(tp->name) != NULL) {
866 TRAP_ERROR;
867 return (EEXIST);

--- 616 unchanged lines hidden (view full) ---

1484 binary = (struct ng_mesg *)msg->data;
1485 if (msg->header.arglen < sizeof(struct ng_mesg)
1486 || msg->header.arglen - sizeof(struct ng_mesg)
1487 < binary->header.arglen) {
1488 error = EINVAL;
1489 break;
1490 }
1491
862 TRAP_ERROR;
863 return (EINVAL);
864 }
865
866 /* Check for name collision */
867 if (ng_findtype(tp->name) != NULL) {
868 TRAP_ERROR;
869 return (EEXIST);

--- 616 unchanged lines hidden (view full) ---

1486 binary = (struct ng_mesg *)msg->data;
1487 if (msg->header.arglen < sizeof(struct ng_mesg)
1488 || msg->header.arglen - sizeof(struct ng_mesg)
1489 < binary->header.arglen) {
1490 error = EINVAL;
1491 break;
1492 }
1493
1494 /* Check response pointer */
1495 if (resp == NULL) {
1496 error = EINVAL;
1497 break;
1498 }
1499
1492 /* Get a response message with lots of room */
1493 NG_MKRESPONSE(rp, msg, sizeof(*ascii) + bufSize, M_NOWAIT);
1494 if (rp == NULL) {
1495 error = ENOMEM;
1496 break;
1497 }
1498 ascii = (struct ng_mesg *)rp->data;
1499

--- 60 unchanged lines hidden (view full) ---

1560 || ascii->header.arglen < 1
1561 || msg->header.arglen
1562 < sizeof(*ascii) + ascii->header.arglen) {
1563 error = EINVAL;
1564 break;
1565 }
1566 ascii->data[ascii->header.arglen - 1] = '\0';
1567
1500 /* Get a response message with lots of room */
1501 NG_MKRESPONSE(rp, msg, sizeof(*ascii) + bufSize, M_NOWAIT);
1502 if (rp == NULL) {
1503 error = ENOMEM;
1504 break;
1505 }
1506 ascii = (struct ng_mesg *)rp->data;
1507

--- 60 unchanged lines hidden (view full) ---

1568 || ascii->header.arglen < 1
1569 || msg->header.arglen
1570 < sizeof(*ascii) + ascii->header.arglen) {
1571 error = EINVAL;
1572 break;
1573 }
1574 ascii->data[ascii->header.arglen - 1] = '\0';
1575
1576 /* Check response pointer */
1577 if (resp == NULL) {
1578 error = EINVAL;
1579 break;
1580 }
1581
1568 /* Get a response message with lots of room */
1569 NG_MKRESPONSE(rp, msg, sizeof(*binary) + bufSize, M_NOWAIT);
1570 if (rp == NULL) {
1571 error = ENOMEM;
1572 break;
1573 }
1574 binary = (struct ng_mesg *)rp->data;
1575

--- 507 unchanged lines hidden ---
1582 /* Get a response message with lots of room */
1583 NG_MKRESPONSE(rp, msg, sizeof(*binary) + bufSize, M_NOWAIT);
1584 if (rp == NULL) {
1585 error = ENOMEM;
1586 break;
1587 }
1588 binary = (struct ng_mesg *)rp->data;
1589

--- 507 unchanged lines hidden ---