Explorar o código

ipv4: Simplify iph->daddr overwrite in ip_options_rcv_srr().

We already copy the 4-byte nexthop from the options block into
local variable "nexthop" for the route lookup.

Re-use that variable instead of memcpy()'ing again when assigning
to iph->daddr after the route lookup succeeds.

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller %!s(int64=14) %!d(string=hai) anos
pai
achega
c30883bdff
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      net/ipv4/ip_options.c

+ 1 - 1
net/ipv4/ip_options.c

@@ -635,7 +635,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
 		if (rt2->rt_type != RTN_LOCAL)
 		if (rt2->rt_type != RTN_LOCAL)
 			break;
 			break;
 		/* Superfast 8) loopback forward */
 		/* Superfast 8) loopback forward */
-		memcpy(&iph->daddr, &optptr[srrptr-1], 4);
+		iph->daddr = nexthop;
 		opt->is_changed = 1;
 		opt->is_changed = 1;
 	}
 	}
 	if (srrptr <= srrspace) {
 	if (srrptr <= srrspace) {