nerves-networking/vintage_net

Configuring by mistake eth0 with VintageNetWiFi fills up the log with error messages

jfburdet opened this issue · 1 comments

Describe the bug

Using a fresh mix nerves.new install, if you type :

log_attach
VintageNet.configure("eth0",
   %{
        ipv4: %{method: :dhcp},
        type: VintageNetWiFi,
        vintage_net_wifi: %{
          networks: [
            %{
              key_mgmt: :wpa_psk,
              mode: :infrastructure,
              psk: "A_dummy_password",
              ssid: "my_ssid_network_name"
            }
          ]
        }
      }
    )

obvious configuration error (configuring a eth0 wired interface with VintageNetWifi) will not be intercepted, and the log will be fill up with message like https://gitlab.com/-/snippets/2230759

To Reproduce
See step above

Expected behavior

Bad configuration should not be allowed and return an error message instead of messing the configuration.

It should be noted that VintageNet.reset_to_defaults("eth0") fixes back the problem

VintageNet Info

iex(1)> VintageNet.info
VintageNet 0.11.4

All interfaces:       ["eth0", "lo"]
Available interfaces: ["eth0"]

Interface eth0
  Type: VintageNetWiFi
  Present: true
  State: :configured (2.6 s)
  Connection: :lan (67.0 ms)
  Addresses: 192.168.1.117/24, fe80::ba27:ebff:fe89:e4a0/64
  Configuration:
    %{
      ipv4: %{method: :dhcp},
      type: VintageNetWiFi,
      vintage_net_wifi: %{
        networks: [
          %{
            key_mgmt: :wpa_psk,
            mode: :infrastructure,
            psk: "....",
            ssid: "my_ssid_network_name"
          }
        ]
      }
    }

Interface usb0
  Type: VintageNetDirect
  Present: false
  Configuration:
    %{type: VintageNetDirect}

Interface wlan0
  Type: VintageNetWiFi
  Present: false
  Configuration:
    %{type: VintageNetWiFi}

Environment

  • Nerves environment: (mix nerves.env --info)
==> nerves
==> hello_nerves
|nerves_bootstrap| Environment Package List

  Pkg:         nerves_system_br
  Vsn:         1.18.2
  Type:        system_platform
  BuildRunner: {nil, []}

  Pkg:         nerves_system_rpi2
  Vsn:         1.18.0
  Type:        system
  BuildRunner: {Nerves.Artifact.BuildRunners.Local, [make_args: ["source", "all", "legal-info"]]}

  Pkg:         nerves_toolchain_armv7_nerves_linux_gnueabihf
  Vsn:         1.5.0
  Type:        toolchain
  BuildRunner: {Nerves.Artifact.BuildRunners.Local, []}

  Pkg:         nerves_toolchain_ctng
  Vsn:         1.8.5
  Type:        toolchain_platform
  BuildRunner: {nil, []}

|nerves_bootstrap| Loadpaths Start


Nerves environment
  MIX_TARGET:   rpi2
  MIX_ENV:      dev

|nerves_bootstrap| Environment Variable List
  target:     rpi2
  toolchain:  /home/jfburdet/.nerves/artifacts/nerves_toolchain_armv7_nerves_linux_gnueabihf-linux_x86_64-1.5.0
  system:     /home/jfburdet/.nerves/artifacts/nerves_system_rpi2-portable-1.18.0
  app:        .

|nerves_bootstrap| Loadpaths End


  • Additional information about your host, target hardware or environment that might help

Hardware target is Raspberry Pi 2 Model B Rev 1.1

Thanks for writing this up. It definitely seems like something we can improve.