  We consider the long term dynamics of the restricted N-body problem, modeling
in a statistical sense the motion of an asteroid in the gravitational field of
the Sun and the solar system planets. We deal with the case of a mean motion
resonance with one planet and assume that the osculating trajectory of the
asteroid crosses the one of some planet, possibly different from the resonant
one, during the evolution. Such crossings produce singularities in the
differential equations for the motion of the asteroid, obtained by standard
perturbation theory. In this work we prove that the vector field of these
equations can be extended to two locally Lipschitz-continuous vector fields on
both sides of a set of crossing conditions. This allows us to define
generalized solutions, continuous but not differentiable, going beyond these
singularities. Moreover, we prove that the long term evolution of the 'signed'
orbit distance (Gronchi and Tommei 2007) between the asteroid and the planet is
differentiable in a neighborhood of the crossing times. In case of crossings
with the resonant planet we recover the known dynamical protection mechanism
against collisions. We conclude with a numerical comparison between the long
term and the full evolutions in the case of asteroids belonging to the 'Alinda'
and 'Toro' classes (Milani et al. 1989). This work extends the results in
(Gronchi and Tardioli 2013) to the relevant case of asteroids in mean motion
resonance with a planet.
