Pull up following revision(s) (requested by yamaguchi in ticket #420):
sys/net/if_vlan.c: revision 1.148 tests/net/if_vlan/t_vlan.sh: revision 1.16 Fix a bug that vlan(4) fragments IPv6 packets even the MTU > packet length. The bug is appeared when the mtu is increased on SIOCSETVLAN. From t-kusaba@IIJ atf: add test cases for MTU that is increased on SIOCSETVLAN From t-kusaba@IIJ, thanks
This commit is contained in:
parent
bdffcb999e
commit
0479512316
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_vlan.c,v 1.141.2.2 2019/10/23 19:28:49 martin Exp $ */
|
||||
/* $NetBSD: if_vlan.c,v 1.141.2.3 2019/11/13 12:50:30 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -78,7 +78,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.141.2.2 2019/10/23 19:28:49 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.141.2.3 2019/11/13 12:50:30 martin Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -119,6 +119,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.141.2.2 2019/10/23 19:28:49 martin Exp
|
|||
#ifdef INET6
|
||||
#include <netinet6/in6_ifattach.h>
|
||||
#include <netinet6/in6_var.h>
|
||||
#include <netinet6/nd6.h>
|
||||
#endif
|
||||
|
||||
#include "ioconf.h"
|
||||
|
@ -540,6 +541,12 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag)
|
|||
nmib->ifvm_p = p;
|
||||
nmib->ifvm_tag = vid;
|
||||
ifv->ifv_if.if_mtu = p->if_mtu - nmib->ifvm_mtufudge;
|
||||
#ifdef INET6
|
||||
KERNEL_LOCK_UNLESS_NET_MPSAFE();
|
||||
if (in6_present)
|
||||
nd6_setmtu(ifp);
|
||||
KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
|
||||
#endif
|
||||
ifv->ifv_if.if_flags = p->if_flags &
|
||||
(IFF_UP | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_vlan.sh,v 1.15 2018/12/11 03:47:51 ozaki-r Exp $
|
||||
# $NetBSD: t_vlan.sh,v 1.15.2.1 2019/11/13 12:50:30 martin Exp $
|
||||
#
|
||||
# Copyright (c) 2016 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -33,9 +33,9 @@ IP_LOCAL1=10.0.1.1
|
|||
IP_REMOTE0=10.0.0.2
|
||||
IP_REMOTE1=10.0.1.2
|
||||
IP_MCADDR0=224.0.0.10
|
||||
IP6_LOCAL0=fc00:0::1
|
||||
IP6_LOCAL0=fc00::1
|
||||
IP6_LOCAL1=fc00:1::1
|
||||
IP6_REMOTE0=fc00:0::2
|
||||
IP6_REMOTE0=fc00::2
|
||||
IP6_REMOTE1=fc00:1::2
|
||||
IP6_MCADDR0=ff11::10
|
||||
ETH_IP_MCADDR0=01:00:5e:00:00:0a
|
||||
|
@ -255,6 +255,133 @@ vlan_basic6_cleanup()
|
|||
cleanup
|
||||
}
|
||||
|
||||
vlan_auto_follow_mtu_body_common()
|
||||
{
|
||||
local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
|
||||
local outfile=./out
|
||||
local af=inet
|
||||
local prefix=24
|
||||
local local0=$IP_LOCAL0
|
||||
local remote0=$IP_REMOTE0
|
||||
local ping_cmd="rump.ping -D -n -w 1 -c 1"
|
||||
local mtu=1500
|
||||
local vlan_mtu=`expr $mtu - 4`
|
||||
# ipv4 header=20bytes, icmp header=8bytes
|
||||
local padding=`expr $vlan_mtu - 20 - 8`
|
||||
local over_padding=`expr $vlan_mtu - 20 - 8 + 1`
|
||||
local nonfrag_msg="$local0 > $remote0: ICMP echo request"
|
||||
# unused for ipv4
|
||||
local frag_msg=""
|
||||
|
||||
if [ x"$1" = x"inet6" ]; then
|
||||
af="inet6"
|
||||
prefix=64
|
||||
local0=$IP6_LOCAL0
|
||||
remote0=$IP6_REMOTE0
|
||||
# ipv6 header=40bytes, icmpv6 header=8bytes
|
||||
padding=`expr $vlan_mtu - 40 - 8`
|
||||
over_padding=`expr $vlan_mtu - 40 - 8 + 1`
|
||||
ping_cmd="rump.ping6 -mm -n -c 1 -i 1"
|
||||
nonfrag_msg="$local0 > $remote0: ICMP6, echo request"
|
||||
frag_msg="$local0 > $remote0: frag .* ICMP6, echo request"
|
||||
fi
|
||||
|
||||
rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
|
||||
rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
|
||||
|
||||
export RUMP_SERVER=$SOCK_LOCAL
|
||||
$atf_ifconfig shmif0 up
|
||||
export RUMP_SERVER=$SOCK_REMOTE
|
||||
$atf_ifconfig shmif0 up
|
||||
|
||||
export RUMP_SERVER=$SOCK_LOCAL
|
||||
$atf_ifconfig vlan0 create
|
||||
|
||||
# since upper bound of shmif's mtu is 1500,
|
||||
# so we lower vlan's mtu instead of raising shmif's.
|
||||
# to do this, we change the interface's parameter
|
||||
# such as ND_IFINFO(ifp)->maxmtu that is changed by SIOCSIFMTU.
|
||||
|
||||
# $atf_config shmif0 mtu 1600
|
||||
$atf_ifconfig vlan0 vlan 10 vlanif shmif0
|
||||
$atf_ifconfig vlan0 mtu 1400
|
||||
$atf_ifconfig vlan0 -vlanif shmif0
|
||||
|
||||
$atf_ifconfig vlan0 vlan 10 vlanif shmif0
|
||||
$atf_ifconfig vlan0 $af $local0/$prefix
|
||||
$atf_ifconfig vlan0 up
|
||||
$atf_ifconfig -w 10
|
||||
|
||||
export RUMP_SERVER=$SOCK_REMOTE
|
||||
$atf_ifconfig vlan0 create
|
||||
$atf_ifconfig vlan0 vlan 10 vlanif shmif0
|
||||
$atf_ifconfig vlan0 $af $remote0/$prefix
|
||||
$atf_ifconfig vlan0 up
|
||||
$atf_ifconfig -w 10
|
||||
|
||||
extract_new_packets $BUS > $outfile
|
||||
export RUMP_SERVER=$SOCK_LOCAL
|
||||
|
||||
atf_check -s exit:0 -o ignore $ping_cmd -s $padding $remote0
|
||||
extract_new_packets $BUS > $outfile
|
||||
atf_check -s exit:0 -o match:"$nonfrag_msg" cat $outfile
|
||||
|
||||
if [ x"$1" = x"inet6" ]; then
|
||||
atf_check -s exit:0 -o ignore $ping_cmd -s $over_padding $remote0
|
||||
extract_new_packets $BUS > $outfile
|
||||
atf_check -s exit:0 -o match:"$frag_msg" cat $outfile
|
||||
else
|
||||
atf_check -s not-exit:0 -o ignore -e match:"Message too long" \
|
||||
$ping_cmd -s $over_padding $remote0
|
||||
fi
|
||||
}
|
||||
|
||||
atf_test_case vlan_auto_follow_mtu cleanup
|
||||
vlan_auto_follow_mtu_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "tests of setting vlan mtu using IPv4"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
vlan_auto_follow_mtu_body()
|
||||
{
|
||||
rump_server_start $SOCK_LOCAL vlan
|
||||
rump_server_start $SOCK_REMOTE vlan
|
||||
|
||||
vlan_auto_follow_mtu_body_common inet
|
||||
}
|
||||
|
||||
vlan_auto_follow_mtu_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case vlan_auto_follow_mtu6 cleanup
|
||||
vlan_auto_follow_mtu6_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "tests of setting vlan mtu using IPv6"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
vlan_auto_follow_mtu6_body()
|
||||
{
|
||||
rump_server_start $SOCK_LOCAL vlan netinet6
|
||||
rump_server_start $SOCK_REMOTE vlan netinet6
|
||||
|
||||
vlan_auto_follow_mtu_body_common inet6
|
||||
}
|
||||
|
||||
vlan_auto_follow_mtu6_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
vlanid_config_and_ping()
|
||||
{
|
||||
local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
|
||||
|
@ -738,6 +865,7 @@ atf_init_test_cases()
|
|||
|
||||
atf_add_test_case vlan_create_destroy
|
||||
atf_add_test_case vlan_basic
|
||||
atf_add_test_case vlan_auto_follow_mtu
|
||||
atf_add_test_case vlan_vlanid
|
||||
atf_add_test_case vlan_configs
|
||||
atf_add_test_case vlan_bridge
|
||||
|
@ -745,6 +873,7 @@ atf_init_test_cases()
|
|||
|
||||
atf_add_test_case vlan_create_destroy6
|
||||
atf_add_test_case vlan_basic6
|
||||
atf_add_test_case vlan_auto_follow_mtu6
|
||||
atf_add_test_case vlan_vlanid6
|
||||
atf_add_test_case vlan_configs6
|
||||
atf_add_test_case vlan_bridge6
|
||||
|
|
Loading…
Reference in New Issue