A Russian court has sentenced pro-war activist Sergei Udaltsov to six years in prison for justifying terrorism.