I'm working on some code that handles IPs entered as strings and stored as arraylists of integers. That part of the code is up and running.
Now I want to be able to enter subnet masks. This re-uses most of the code, but requires some extra validation (since only a few addresses are valid as subnet masks - see
here). However, I'm not sure how to handle this since subnet masks follow some very specific rules.
Plan B is to just check against all valid subnet masks but that seems clumsy. Has anyone else had this problem before? Can anyone point me in the right direction to solve this?