Influence of stellar oscillations on pulsar and magnetar magnetospheres