Skip to content
  • Salvatore Orlando's avatar
    NetNS: Allow full namespace path in constructor · b64aa4ec
    Salvatore Orlando authored
    If the netns argument to the NetNS constructor is the path of an
    existing file, that is interpreted as the full namespace path, and
    not appended to netns.NETNS_RUN_DIR.
    
    This patch add a setns_from_path function to the netns module.
    This function simply opens the namespace, perform the setns syscall,
    and returns the file descriptor. In order to avoid code duplication
    the setns function now calls setns_from_path
    
    A test has been added to validate creating a NetNS object using the
    path of an existing namespace.
    
    Creating or deleting namespaces using a full path has not been
    implemented as a part of this patch.
    b64aa4ec