As stated above, filtering is not illegal as long as it is done with due regard to the other rules of the road. Filtering past stationary traffic at 80mph would be dangerous, crossing solid whites, overtaking on zigzags, etc
A month or so ago I was out a run with my boy, on crossing the Erskine Bridge we came to a long line of static traffic. Ever filtered I ask.'no' was the reply. My advice was keep a safe distance behind me (incase I get knocked off), keep your eyes peeled for folk trying to close the gap, and only take the gap if you think it is safe. Never mind if I get through it, make sure you can. Finally if at any time you want to stop filtering just pull in.
The filtering lasted right up to the Balloch roundabound, so was around 8-9 miles. The boy done good.