Use the IFF_RUNNING bit in the flags returned by the SIOCGIFFLAGS ioctl, like Linux SIOCGIFFLAGS ioctl.