Skip to contentSkip to conversation

net/ipv4/route.c: Routing anomaly introduced by 89aef89 (ipv4: Delete routing cache.)

DISCUSSION Shmulik Ladkani 2 participants 3 messages Jul 8, 2013 – Jul 9, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

In 89aef89 (ipv4: Delete routing cache) the following was removed from ip_route_input_common (nowadays named ip_route_input_noref):

- tos &= IPTOS_RT_MASK;

As a side effect, the 'tos' argument passed to 'ip_route_input_slow' is the "raw" u8, as present in iph->tos (opposed to the formerly "masked" value).

This may affect the route calculation, as this value is later placed in fl4.flowi4_tos for matching purposes (using equality to the tos stored in the FIB Rule and/or Route).

(BTW, the question whether applying the historical IPTOS_RT_MASK prior route lookup is interesting on its own...)

However, 89aef89 created an anomaly - since in the output path, routing *still* uses the IPTOS_RT_MASK (see __ip_route_output_key for example).

It seems the omission of 'tos &= IPTOS_RT_MASK' from 'ip_route_input_noref' was accidental.

We should align input/output behavior by reverting the omission, or alternatively we may reconsider the entire IPTOS_RT_MASK thing.

Regards,
Shmulik

#1 lore raw

Hello,

Quoted 15 lines · Shmulik Ladkani

Hi,

In 89aef89 (ipv4: Delete routing cache) the following was removed from ip_route_input_common (nowadays named ip_route_input_noref):

- tos &= IPTOS_RT_MASK;

As a side effect, the 'tos' argument passed to 'ip_route_input_slow' is the "raw" u8, as present in iph->tos (opposed to the formerly "masked" value).

This may affect the route calculation, as this value is later placed in fl4.flowi4_tos for matching purposes (using equality to the tos stored in the FIB Rule and/or Route).

Quoted 8 lines

(BTW, the question whether applying the historical IPTOS_RT_MASK prior route lookup is interesting on its own...)

However, 89aef89 created an anomaly - since in the output path, routing *still* uses the IPTOS_RT_MASK (see __ip_route_output_key for example).

It seems the omission of 'tos &= IPTOS_RT_MASK' from 'ip_route_input_noref' was accidental.

Agreed

Quoted 2 lines

We should align input/output behavior by reverting the omission, or alternatively we may reconsider the entire IPTOS_RT_MASK thing.

The right thing should be to use tos &= IPTOS_RT_MASK
at beginning of ip_route_input_noref.

Regards

--
Julian Anastasov <[email protected]>

#2 lore raw
Quoted 10 lines · On Tue, 9 Jul 2013 08:43:14 +0300 (EEST) Julian Anastasov <[email protected]> wrote:
Quoted 2 lines

It seems the omission of 'tos &= IPTOS_RT_MASK' from 'ip_route_input_noref' was accidental.

Agreed

Quoted 2 lines

We should align input/output behavior by reverting the omission, or alternatively we may reconsider the entire IPTOS_RT_MASK thing.

The right thing should be to use tos &= IPTOS_RT_MASK
at beginning of ip_route_input_noref.

Agreed. Will post a patch.

Regards,
Shmulik