Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-106254

Jail MAC ADDRESS validation fails in "Advanced Jail Creation"

    XMLWordPrintable

    Details

      Description

      Mac Address validation fails when I try to create a Jail in Advanced Jail Creation, while the Jail is created in standard mode.

      MAC prefix for both jail: f4ce46

      Py Exception from Middleware and Iocage at console:

      Error: Traceback (most recent call last):
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_create.py", line 495, in _create_jail
          value, config = iocjson.json_check_prop(key, value, config)
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_json.py", line 2440, in json_check_prop
          silent=self.silent
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_common.py", line 103, in logit
          callback(content, exception)
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_common.py", line 76, in callback
          raise callback_exception(message)
      RuntimeError: Invalid mac_prefix. Must match `?X????` where ? can be any valid hex digit (0-9, A-F) and X is one of 2, 6, A or E.
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/usr/local/lib/python3.7/site-packages/middlewared/job.py", line 349, in run
          await self.future
        File "/usr/local/lib/python3.7/site-packages/middlewared/job.py", line 388, in __run_body
          rv = await self.middleware.run_in_thread(self.method, *([self] + args))
        File "/usr/local/lib/python3.7/site-packages/middlewared/utils/run_in_thread.py", line 10, in run_in_thread
          return await self.loop.run_in_executor(self.run_in_thread_executor, functools.partial(method, *args, **kwargs))
        File "/usr/local/lib/python3.7/site-packages/middlewared/utils/io_thread_pool_executor.py", line 25, in run
          result = self.fn(*self.args, **self.kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/schema.py", line 965, in nf
          return f(*args, **kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/jail.py", line 771, in do_create
          empty=empty
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/iocage.py", line 587, in create
          clone_basejail=clone_basejail
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_create.py", line 100, in create_jail
          return self._create_jail(jail_uuid, location)
        File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_create.py", line 501, in _create_jail
          raise RuntimeError(f"***\n{err}\n***\n")
      RuntimeError: ***
      Invalid mac_prefix. Must match `?X????` where ? can be any valid hex digit (0-9, A-F) and X is one of 2, 6, A or E.
      ***

      From iocage code in ioc_json.py:

                      elif key == 'mac_prefix':
                          # Invalid letters - 0,1,3,4,5,7,8,9,B,C,D,F
                          # Valid letters - 2,6,A,E
                          if not self.validate_mac_prefix(value):
                              iocage_lib.ioc_common.logit(
                                  {
                                      'level': 'EXCEPTION',
                                      'message': 'Invalid mac_prefix. Must match '
                                                 '`?X????` where ? can be any '
                                                 'valid hex digit (0-9, A-F) and '
                                                 'X is one of 2, 6, A or E.'
                                  },
                                  _callback=self.callback,
                                  silent=self.silent
                              )

      So, f4ce46 won't match ?X???? 

      Workaround is easy... just choose a valid letter as second bit between  2, 6, A or E.

       

       

       

        Attachments

          Attachments

            JEditor

              Activity

                People

                Assignee:
                waqar Waqar Ahmed
                Reporter:
                proto ale proto
                Watchers:
                ale proto, Bug Clerk, jaturong, Waqar Ahmed, William Grzybowski
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Due:
                  Created:
                  Updated:
                  Resolved: