Common origin of warm dark matter and dark radiation