Detection of duplicate network name

LuCI allows the addition of interfaces with the same name.

Create Interface page does not show any error on the entry of the already existing interface name. It continues to load the screens with the details of the existing details.

Assume the below function from the iface_add.lua file should have taken care of it, but we do not see any error messages.

function newproto.validate(self, value, section)
	local name = newnet:formvalue(section)
	if not name or #name == 0 then
		newnet:add_error(section, translate("No network name specified"))
	elseif m:get(name) then
		newnet:add_error(section, translate("The given network name is not unique"))

	local proto = nw:get_protocol(value)
	if proto and not proto:is_floating() then
		local br = (netbridge:formvalue(section) == "1")
		local ifn = br and mifname:formvalue(section) or sifname:formvalue(section)
		for ifn in utl.imatch(ifn) do
			return value
		return nil, translate("The selected protocol needs a device assigned")
	return value

Any suggestions on how to handle it?

m:get(name) always returns a nil even though network config file has a section a section with the same name provided.

Need help in this regard..