--- embedaddon/quagga/tests/bgp_capability_test.c 2013/07/21 23:54:40 1.1.1.3 +++ embedaddon/quagga/tests/bgp_capability_test.c 2016/11/02 10:09:12 1.1.1.4 @@ -1,9 +1,31 @@ +/* + * Copyright (C) 2007 Sun Microsystems, Inc. + * + * This file is part of Quagga. + * + * Quagga is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * Quagga is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Quagga; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + #include #include "vty.h" #include "stream.h" #include "privs.h" #include "memory.h" +#include "filter.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_open.h" @@ -290,7 +312,16 @@ static struct test_segment misc_segments[] = { 0x41, 0x4, 0xab, 0xcd, 0xef, 0x12 }, /* AS: 2882400018 */ 6, SHOULD_PARSE, 2882400018, }, - /* 20 */ + { "AS4", + "AS4 capability: short", + { 0x41, 0x4, 0xab, 0xcd, 0xef }, /* AS: 2882400018 */ + 5, SHOULD_ERR, + }, + { "AS4", + "AS4 capability: long", + { 0x41, 0x4, 0xab, 0xcd, 0xef, 0x12, 0x12 }, + 7, SHOULD_ERR, 2882400018, + }, { "GR", "GR capability", { /* hdr */ CAPABILITY_CODE_RESTART, 0xe, @@ -307,7 +338,6 @@ static struct test_segment misc_segments[] = }, 16, SHOULD_PARSE, }, - /* 21 */ { "GR-short", "GR capability, but header length too short", { /* hdr */ 0x40, 0xa, @@ -322,9 +352,8 @@ static struct test_segment misc_segments[] = /* safi */ 0x2, /* flags */ 0x1, }, - 16, SHOULD_PARSE, + 15 /* array is 16 though */, SHOULD_ERR, }, - /* 22 */ { "GR-long", "GR capability, but header length too long", { /* hdr */ 0x40, 0xf, @@ -337,6 +366,7 @@ static struct test_segment misc_segments[] = /* flags */ 0x0, /* afi */ 0x0, 0x2, /* safi */ 0x2, + /* flags */ 0x01, }, 16, SHOULD_ERR, },