We hear that the router forwards the traffic based on the longer prefix match.
For example the router has four prefixes installed in the routing table as below.
10.50.20.0 /24, 10.50.20.0 /22, 10.50.0.0 /16, and 10.0.0.0 /8
now if packet comes with the a destination address of 10.50.20.10 then if we consider the logic of longest prefix matching then the router will select the path of 10.50.20.0/24..
My confusion is how does the router know that it should use this path..may be i am missing small thing over here.