Parametric options

Options like system.hostname, network.main_ipv4_address, network.main_ipv6_address, can be parametric so what the user write is a template of what the value will be, this page is about to try to define a flexible yet not complicated formalism for those templates.

Old formalism provide just substitution by mac address byte but this is eventually quite limited and already showed limits, like the impossibility for the user to control the format in which the mac address byte should be represented.

The new formalism should have following characteristics:

  • Easy parsing just with lua patterns
  • Compact format
  • Possibility to take byte from mac address
  • Possibility to take randoms byte
  • Possibility to choose the output format

I was thinking a way to have bit level control but all ides I had needed too much complication of patterns syntax

Proposal 1:

|<char source><char source param><char destination format><char destination format param>|
examples:
|M6HL| -> M = use MAC address as source, 6 take sixth byte of the mac, H use hexadecimal as output format, L lower case.
|M5HU| -> M = use MAC address as source, 5 take fifth byte of the mac, H use hexadecimal as output format, U upper case.
|M4D0| -> M = use MAC address as source, 4 take forth byte of the mac, D use decimal as output format, 0 without meaning param is not used by this format.
|R2HL| -> R = use random as source, 2 take two bytes, H use hexadecimal as output format, L lower case
|R2CL| -> R = use random as source, 2 take two bytes, C use ASCII char as output format, L lower case
|R2C0| -> R = use random as source, 2 take two bytes, C use ASCII char as output format, 0 output chars as is