The chemical composition of Galactic ring nebulae around massive stars