Lines Matching refs:tunnel
534 tunnel = cls.INTERFACE_CLASS(iface, netid, underlying_netid, ifindex,
537 cls._SetupTunnelNetwork(tunnel, True)
540 cls.tunnelsV4[netid] = tunnel
542 cls.tunnelsV6[netid] = tunnel
548 for tunnel in cls.tunnelsV4.values() + cls.tunnelsV6.values():
549 cls._SetInboundMarking(tunnel.netid, tunnel.iface, False)
550 cls._SetupTunnelNetwork(tunnel, False)
551 tunnel.Teardown()
589 def _SetupTunnelNetwork(cls, tunnel, is_add): argument
611 "/proc/sys/net/ipv6/conf/%s/router_solicitations" % tunnel.iface, 0)
612 net_test.SetInterfaceUp(tunnel.iface)
615 ifindex = net_test.GetInterfaceIndex(tunnel.iface)
616 table = tunnel.netid
619 start, end = cls.UidRangeForNetid(tunnel.netid)
622 cls.iproute.OifRule(version, is_add, tunnel.iface, table, cls.PRIORITY_OIF)
623 cls.iproute.FwmarkRule(version, is_add, tunnel.netid, cls.NETID_FWMASK,
627 addr = cls._GetLocalAddress(version, tunnel.netid)
629 tunnel.addrs[version] = addr
637 def assertReceivedPacket(self, tunnel, sa_info): argument
638 tunnel.rx += 1
639 self.assertEquals((tunnel.rx, tunnel.tx),
640 self.iproute.GetRxTxPackets(tunnel.iface))
643 def assertSentPacket(self, tunnel, sa_info): argument
644 tunnel.tx += 1
645 self.assertEquals((tunnel.rx, tunnel.tx),
646 self.iproute.GetRxTxPackets(tunnel.iface))
649 def _CheckTunnelInput(self, tunnel, inner_version, local_inner, remote_inner, argument
653 sa_info = tunnel.in_sa
657 inner_version, remote_inner, tunnel.remote, _TEST_REMOTE_PORT,
658 local_inner, tunnel.local, local_port, sa_info.spi, sa_info.seq_num)
659 self.ReceivePacketOn(tunnel.underlying_netid, input_pkt)
666 self.assertReceivedPacket(tunnel, sa_info)
670 def _CheckTunnelOutput(self, tunnel, inner_version, local_inner, argument
674 sa_info = tunnel.out_sa
675 local_port = _SendPacket(self, tunnel.netid, inner_version, remote_inner,
680 pkt = self._ExpectEspPacketOn(tunnel.underlying_netid, sa_info.spi,
681 sa_info.seq_num, None, tunnel.local,
682 tunnel.remote)
697 inner_version, local_inner, tunnel.local, local_port, remote_inner,
698 tunnel.remote, _TEST_REMOTE_PORT, sa_info.spi, sa_info.seq_num,
703 self.assertSentPacket(tunnel, sa_info)
711 def _CheckTunnelEncryption(self, tunnel, inner_version, local_inner, argument
719 src_port = _SendPacket(self, tunnel.netid, inner_version, remote_inner,
723 pkt = self._ExpectEspPacketOn(tunnel.underlying_netid, tunnel.out_sa.spi,
724 tunnel.out_sa.seq_num, None, tunnel.local,
725 tunnel.remote)
731 self.assertEquals(tunnel.local, pkt.src)
732 self.assertEquals(tunnel.remote, pkt.dst)
735 self.assertSentPacket(tunnel, tunnel.out_sa)
740 tunnel.iface, new_addr=remote_inner, old_addr=local_inner)
747 self.ReceivePacketOn(tunnel.underlying_netid, pkt)
755 self.assertReceivedPacket(tunnel, tunnel.in_sa)
759 tunnel.iface, new_addr=local_inner, old_addr=remote_inner)
761 def _CheckTunnelIcmp(self, tunnel, inner_version, local_inner, remote_inner, argument
765 sa_info = tunnel.out_sa
771 }[tunnel.version]
773 local_port = _SendPacket(self, tunnel.netid, inner_version, remote_inner,
775 pkt = self._ExpectEspPacketOn(tunnel.underlying_netid, sa_info.spi,
776 sa_info.seq_num, None, tunnel.local,
777 tunnel.remote)
778 self.assertSentPacket(tunnel, sa_info)
780 myaddr = self.MyAddress(tunnel.version, tunnel.underlying_netid)
781 _, toobig = packets.ICMPPacketTooBig(tunnel.version, intermediate, myaddr,
783 self.ReceivePacketOn(tunnel.underlying_netid, toobig)
786 routes = self.iproute.GetRoutes(tunnel.remote, 0, tunnel.underlying_netid, None)
793 self.InvalidateDstCache(tunnel.version, tunnel.underlying_netid)
795 def _CheckTunnelEncryptionWithIcmp(self, tunnel, inner_version, local_inner, argument
798 self._CheckTunnelEncryption(tunnel, inner_version, local_inner,
800 self._CheckTunnelIcmp(tunnel, inner_version, local_inner, remote_inner)
801 self._CheckTunnelEncryption(tunnel, inner_version, local_inner,
806 tunnel = self.randomTunnel(outer_version)
822 tunnel.TeardownXfrm()
823 tunnel.SetupXfrm(use_null_crypt)
825 local_inner = tunnel.addrs[inner_version]
829 func(tunnel, inner_version, local_inner, remote_inner)
832 tunnel.TeardownXfrm()
833 tunnel.SetupXfrm(False)
835 def _CheckTunnelRekey(self, tunnel, inner_version, local_inner, remote_inner): argument
836 old_out_sa = tunnel.out_sa
837 old_in_sa = tunnel.in_sa
840 self._CheckTunnelInput(tunnel, inner_version, local_inner, remote_inner,
842 self._CheckTunnelOutput(tunnel, inner_version, local_inner, remote_inner,
846 outer_family = net_test.GetAddressFamily(tunnel.version)
854 tunnel.Rekey(outer_family, new_out_sa, new_in_sa)
857 self._CheckTunnelInput(tunnel, inner_version, local_inner, remote_inner,
861 self._CheckTunnelInput(tunnel, inner_version, local_inner, remote_inner,
863 self._CheckTunnelOutput(tunnel, inner_version, local_inner, remote_inner,
867 tunnel.DeleteOldSaInfo(outer_family, old_in_sa.spi, old_out_sa.spi)
870 self._CheckTunnelInput(tunnel, inner_version, local_inner, remote_inner,
872 self._CheckTunnelOutput(tunnel, inner_version, local_inner, remote_inner,
876 self._CheckTunnelInput(tunnel, inner_version, local_inner, remote_inner,
881 tunnel = self.randomTunnel(outer_version)
885 tunnel.TeardownXfrm()
886 tunnel.SetupXfrm(True)
888 local_inner = tunnel.addrs[inner_version]
891 self._CheckTunnelRekey(tunnel, inner_version, local_inner, remote_inner)
893 tunnel.TeardownXfrm()
894 tunnel.SetupXfrm(False)