[Bug 235704] [net] [patch] tun(4) can't be destroyed on a VNET jail if it's renamed

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Feb 28 15:27:52 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235704

--- Comment #9 from genneko217 at gmail.com ---
Sorry to bother you again and again, but let me ask one more thing.

Because some interface types (tap, vxlan etc.) still don't have
virtualized cloners, I think similar problems could occur to them.
(I know this is truly a corner case, though.) 

if_clone_destroy() in sys/net/if_clone.c has the following code to
find the cloner for an interface to destroy.

What I was wondering is why the line 263-267 (the first loop) and
the line 271-278 (the second loop) use different code.
Can't they be the same?
(My original patch came from this question.)

   261          /* Find the cloner for this interface */
   262          IF_CLONERS_LOCK();
   263          LIST_FOREACH(ifc, &V_if_cloners, ifc_list) {
-> 264                  if (strcmp(ifc->ifc_name, ifp->if_dname) == 0) {
   265                          break;
   266                  }
   267          }
   268  #ifdef VIMAGE
   269          if (ifc == NULL && !IS_DEFAULT_VNET(curvnet)) {
   270                  CURVNET_SET_QUIET(vnet0);
   271                  LIST_FOREACH(ifc, &V_if_cloners, ifc_list)
   272                          if (ifc->ifc_type == SIMPLE) {
-> 273                                  if (ifc_simple_match(ifc, name))
   274                                          break;
   275                          } else {
-> 276                                  if (ifc->ifc_match(ifc, name))
   277                                          break;
   278                          }
   279                  CURVNET_RESTORE();
   280          }
   281  #endif

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-net mailing list