That's valid. Its a little clumsy though... Also does not cope with narrower than /24 netmasks, as far as I can see.