Lines Matching refs:version
66 def MakePktInfo(version, addr, ifindex): argument
67 family = {4: AF_INET, 6: AF_INET6}[version]
69 addr = {4: "0.0.0.0", 6: "::"}[version]
72 if version == 6:
159 def _RouterAddress(netid, version): argument
160 if version == 6:
162 elif version == 4:
165 raise ValueError("Don't support IPv%s" % version)
176 def MyAddress(cls, version, netid): argument
179 6: cls._MyIPv6Address(netid)}[version]
182 def MySocketAddress(cls, version, netid): argument
183 addr = cls.MyAddress(version, netid)
184 return "::ffff:" + addr if version == 5 else addr
191 def OnlinkPrefixLen(version): argument
192 return {4: 24, 6: 64}[version]
195 def OnlinkPrefix(version, netid): argument
197 6: "2001:db8:%02x::" % netid}[version]
207 def GetProtocolFamily(self, version): argument
208 return {4: AF_INET, 6: AF_INET6}[version]
263 for version in [4, 6]:
268 router = cls._RouterAddress(netid, version)
273 cls.iproute.UidRangeRule(version, is_add, start, end, table,
275 cls.iproute.OifRule(version, is_add, iface, table, cls.PRIORITY_OIF)
276 cls.iproute.FwmarkRule(version, is_add, netid, cls.NETID_FWMASK, table,
292 do_routing = (version == 4 or cls.AUTOCONF_TABLE_OFFSET is None)
294 if version == 4:
297 cls.iproute.AddNeighbour(version, router, macaddr, ifindex)
299 cls.iproute.AddRoute(version, table,
300 cls.OnlinkPrefix(version, netid),
301 cls.OnlinkPrefixLen(version), None, ifindex)
302 cls.iproute.AddRoute(version, table, "default", 0, router, ifindex)
305 cls.iproute.DelRoute(version, table, "default", 0, router, ifindex)
306 cls.iproute.DelRoute(version, table,
307 cls.OnlinkPrefix(version, netid),
308 cls.OnlinkPrefixLen(version), None, ifindex)
309 if version == 4:
310 cls.iproute.DelNeighbour(version, router, macaddr, ifindex)
322 for version in [4, 6]:
325 iptables = {4: "iptables", 6: "ip6tables"}[version]
328 if net_test.RunIptablesCommand(version, args):
339 for version in [4, 6]:
341 cls.iproute.DefaultRule(version, is_add, table, cls.PRIORITY_DEFAULT)
376 def _ICMPRatelimitFilename(cls, version): argument
378 6: "ipv6/icmp/ratelimit"}[version]
381 def _SetICMPRatelimit(cls, version, limit): argument
382 cls.SetSysctl(cls._ICMPRatelimitFilename(version), limit)
399 for version in [4, 6]:
400 cls._SetICMPRatelimit(version, 0)
402 for version in [4, 6]:
403 cls.iproute.UnreachableRule(version, True, cls.PRIORITY_UNREACHABLE)
429 for version in [4, 6]:
431 cls.iproute.UnreachableRule(version, False, cls.PRIORITY_UNREACHABLE)
471 def GetRemoteAddress(self, version): argument
474 6: self.IPV6_ADDR}[version]
476 def GetRemoteSocketAddress(self, version): argument
477 addr = self.GetRemoteAddress(version)
478 return "::ffff:" + addr if version == 5 else addr
480 def GetOtherRemoteSocketAddress(self, version): argument
483 6: self.IPV6_ADDR2}[version]
498 def BuildSocket(self, version, constructor, netid, routing_mode): argument
499 if version == 5: version = 6
500 s = constructor(self.GetProtocolFamily(version))
522 def SendOnNetid(self, version, s, dstaddr, dstport, netid, payload, cmsgs): argument
524 pktinfo = MakePktInfo(version, None, self.ifindices[netid])
527 6: (net_test.SOL_IPV6, csocket.IPV6_PKTINFO)}[version]
576 def InvalidateDstCache(self, version, netid): argument
596 self.iproute._Route(version, iproute.RTPROT_STATIC, action, table,
717 def Combinations(self, version): argument
724 myaddr = self.MyAddress(version, dest_ip_netid)
725 prefix = {4: "172.22.", 6: "2001:db8:aaaa::"}[version]