inverse-inc / packetfence

PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) solution. Boasting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, powerful BYOD management options, 802.1X support, layer-2 isolation of problematic devices; PacketFence can be used to effectively secure networks small to very large heterogeneous networks.
https://packetfence.org
GNU General Public License v2.0
1.37k stars 287 forks source link

web admin: unable to set type=dhcp-listener for an interface #5512

Closed nqb closed 4 years ago

nqb commented 4 years ago

Describe the bug When I tried to set type=dhcp-listener for an ethernet interface without any other setting, I got following error message on frontend:

Unable to validate
type: 'dhcp-listener' is not a valid value

To Reproduce Steps to reproduce the behavior:

  1. Go to Interfaces menu
  2. Click on an interface without IP address
  3. Try to set type to "DHCP listener"
  4. See error

Expected behavior Frontend should allow you to set type=dhcp-listener for an interface.

Additional context No difference if I specified an IP address on the interface.

I'm able to set type=dhcp-listener by editing directly pf.conf and checkup doesn't report any issue.

jrouzierinverse commented 4 years ago

Which version? Unable to replicate in devel.

nqb commented 4 years ago

I tested on devel and tested again this morning: I'm able to reproduce.

My setup:

JSON payload sent:

{
    "additional_listening_daemons": [],
    "address": "192.168.121.48/24",
    "coa": null,
    "dhcpd_enabled": null,
    "dns": null,
    "high_availability": 0,
    "hwaddr": "52:54:00:bb:2e:8a",
    "id": "eth0",
    "ifindex": "2",
    "ipaddress": "192.168.121.48",
    "ipv6_address": null,
    "ipv6_prefix": null,
    "is_running": true,
    "master": null,
    "name": "eth0",
    "nat_enabled": null,
    "netmask": "255.255.255.0",
    "network": "192.168.121.0",
    "network_iseditable": false,
    "networks": [],
    "reg_network": null,
    "split_network": null,
    "type": "dhcp-listener",
    "vip": null,
    "vlan": null
},
jrouzierinverse commented 4 years ago

This was caused by the fix for #5466 . Question for @julsemaan or @fdurand is 'dhcp-listener' a valid type? Or should it be we only see it in options_additional_listening_daemons?

julsemaan commented 4 years ago

dhcp-listener is a valid type

jrouzierinverse commented 4 years ago

Where would it go in this list? https://github.com/inverse-inc/packetfence/blob/devel/html/pfappserver/lib/pfappserver/Model/Enforcement.pm#L26

jrouzierinverse commented 4 years ago

Fixed by e7f520129df58ee39ad4d8e2147adcddd23bbceb