Skip to content

Commit

Permalink
net: ipv4: route.c: Fix indentation of multi line comment.
Browse files Browse the repository at this point in the history
All comment lines inside the comment block have been aligned.
Every line of comment starts with a * (uniformity in code).

Signed-off-by: Shubhankar Kuranagatti <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
SShubh123 authored and davem330 committed Mar 13, 2021
1 parent 12bb508 commit 6ad0860
Showing 1 changed file with 49 additions and 48 deletions.
97 changes: 49 additions & 48 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr,

for_each_possible_cpu(i) {
struct rtable __rcu **prt;

prt = per_cpu_ptr(nhc->nhc_pcpu_rth_output, i);
rt = rcu_dereference(*prt);
if (rt)
Expand Down Expand Up @@ -1258,12 +1259,12 @@ static int ip_rt_bug(struct net *net, struct sock *sk, struct sk_buff *skb)
}

/*
We do not cache source address of outgoing interface,
because it is used only by IP RR, TS and SRR options,
so that it out of fast path.
BTW remember: "addr" is allowed to be not aligned
in IP options!
* We do not cache source address of outgoing interface,
* because it is used only by IP RR, TS and SRR options,
* so that it out of fast path.
*
* BTW remember: "addr" is allowed to be not aligned
* in IP options!
*/

void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
Expand Down Expand Up @@ -2108,7 +2109,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
goto out;

/* Check for the most weird martians, which can be not detected
by fib_lookup.
* by fib_lookup.
*/

tun_info = skb_tunnel_info(skb);
Expand Down Expand Up @@ -2317,15 +2318,15 @@ int ip_route_input_rcu(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev, struct fib_result *res)
{
/* Multicast recognition logic is moved from route cache to here.
The problem was that too many Ethernet cards have broken/missing
hardware multicast filters :-( As result the host on multicasting
network acquires a lot of useless route cache entries, sort of
SDR messages from all the world. Now we try to get rid of them.
Really, provided software IP multicast filter is organized
reasonably (at least, hashed), it does not result in a slowdown
comparing with route cache reject entries.
Note, that multicast routers are not affected, because
route cache entry is created eventually.
* The problem was that too many Ethernet cards have broken/missing
* hardware multicast filters :-( As result the host on multicasting
* network acquires a lot of useless route cache entries, sort of
* SDR messages from all the world. Now we try to get rid of them.
* Really, provided software IP multicast filter is organized
* reasonably (at least, hashed), it does not result in a slowdown
* comparing with route cache reject entries.
* Note, that multicast routers are not affected, because
* route cache entry is created eventually.
*/
if (ipv4_is_multicast(daddr)) {
struct in_device *in_dev = __in_dev_get_rcu(dev);
Expand Down Expand Up @@ -2537,11 +2538,11 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
rth = ERR_PTR(-ENETUNREACH);

/* I removed check for oif == dev_out->oif here.
It was wrong for two reasons:
1. ip_dev_find(net, saddr) can return wrong iface, if saddr
is assigned to multiple interfaces.
2. Moreover, we are allowed to send packets with saddr
of another iface. --ANK
* It was wrong for two reasons:
* 1. ip_dev_find(net, saddr) can return wrong iface, if saddr
* is assigned to multiple interfaces.
* 2. Moreover, we are allowed to send packets with saddr
* of another iface. --ANK
*/

if (fl4->flowi4_oif == 0 &&
Expand All @@ -2553,18 +2554,18 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
goto out;

/* Special hack: user can direct multicasts
and limited broadcast via necessary interface
without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
This hack is not just for fun, it allows
vic,vat and friends to work.
They bind socket to loopback, set ttl to zero
and expect that it will work.
From the viewpoint of routing cache they are broken,
because we are not allowed to build multicast path
with loopback source addr (look, routing cache
cannot know, that ttl is zero, so that packet
will not leave this host and route is valid).
Luckily, this hack is good workaround.
* and limited broadcast via necessary interface
* without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
* This hack is not just for fun, it allows
* vic,vat and friends to work.
* They bind socket to loopback, set ttl to zero
* and expect that it will work.
* From the viewpoint of routing cache they are broken,
* because we are not allowed to build multicast path
* with loopback source addr (look, routing cache
* cannot know, that ttl is zero, so that packet
* will not leave this host and route is valid).
* Luckily, this hack is good workaround.
*/

fl4->flowi4_oif = dev_out->ifindex;
Expand Down Expand Up @@ -2627,21 +2628,21 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
(ipv4_is_multicast(fl4->daddr) ||
!netif_index_is_l3_master(net, fl4->flowi4_oif))) {
/* Apparently, routing tables are wrong. Assume,
that the destination is on link.
WHY? DW.
Because we are allowed to send to iface
even if it has NO routes and NO assigned
addresses. When oif is specified, routing
tables are looked up with only one purpose:
to catch if destination is gatewayed, rather than
direct. Moreover, if MSG_DONTROUTE is set,
we send packet, ignoring both routing tables
and ifaddr state. --ANK
We could make it even if oif is unknown,
likely IPv6, but we do not.
* that the destination is on link.
*
* WHY? DW.
* Because we are allowed to send to iface
* even if it has NO routes and NO assigned
* addresses. When oif is specified, routing
* tables are looked up with only one purpose:
* to catch if destination is gatewayed, rather than
* direct. Moreover, if MSG_DONTROUTE is set,
* we send packet, ignoring both routing tables
* and ifaddr state. --ANK
*
*
* We could make it even if oif is unknown,
* likely IPv6, but we do not.
*/

if (fl4->saddr == 0)
Expand Down

0 comments on commit 6ad0860

Please sign in to comment.