ifconfig: introduce _flags_{set,clear,has}_bit()

This removes code redundancy and improves code readability.