Fix problems with overlapping 'allowed IP subnets' in CP

- Always use subnet mask when deleting an entry
- Add subnet mask to required fields and check for valid subnet
- Do not add / to $oldmask variable
- Do not try to delete an old entry when adding a new one (fixes problems with overlapping entries)
- Change order of freeing pipe number (fixes problem that wrong pipe is removed)