Commit bc2fafa1 authored by zhifan huang's avatar zhifan huang

doc: add comment for iface name patch in fixnemu

parent a1b041a1
...@@ -75,7 +75,10 @@ get_addr_data.func_code = _get_addr_data.func_code ...@@ -75,7 +75,10 @@ get_addr_data.func_code = _get_addr_data.func_code
@staticmethod @staticmethod
def _gen_if_name(): def _gen_if_name():
n = Interface._gen_next_id() n = Interface._gen_next_id()
# Max 15 chars # The maximum size of the interface name is 15(char [IFNAMSIZ(16)])
# len(NETNSbr-) = 8, So we need to limit the part "%.4x%.3x" % (os.getpid(), n)
# to size 7. That means PID < 0xffff, n < 0xfff
# PID often exceeds 0xffff, so use mod 0xffff to limit it length.
return "NETNSif-%.4x%.3x" % (os.getpid() % 0xffff, n) return "NETNSif-%.4x%.3x" % (os.getpid() % 0xffff, n)
Interface._gen_if_name = _gen_if_name Interface._gen_if_name = _gen_if_name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment