linux/net
Jamal Hadi Salim f8d0e3f115 [NET] ethernet: Fix first packet goes out with MAC 00:00:00:00:00:00
When you turn off ARP on a netdevice then the first packet always goes
out with a dstMAC of all zeroes. This is because the first packet is
used to resolve ARP entries. Even though the ARP entry may be resolved
(I tried by setting a static ARP entry for a host i was pinging from),
it gets overwritten by virtue of having the netdevice disabling ARP.

Subsequent packets go out fine with correct dstMAC address (which may
be why people have ignored reporting this issue).

To cut the story short: 

the culprit code is in net/ethernet/eth.c::eth_header()

----
        /*
         *      Anyway, the loopback-device should never use this
function...
         */

        if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
        {
                memset(eth->h_dest, 0, dev->addr_len);
                return ETH_HLEN;
        }

	if(daddr)
        {
                memcpy(eth->h_dest,daddr,dev->addr_len);
                return ETH_HLEN;
        }

----

Note how the h_dest is being reset when device has IFF_NOARP.

As a note:
All devices including loopback pass a daddr. loopback in fact passes
a 0 all the time ;-> 
This means i can delete the check totaly or i can remove the IFF_NOARP

Alexey says:
--------------------
I think, it was me who did this crap. It was so long ago I do not remember
why it was made.

I remember some troubles with dummy device. It tried to resolve
addresses, apparently, without success and generated errors instead of
blackholing. I think the problem was eventually solved at neighbour
level.

After some thinking I suspect the deletion of this chunk could change
behaviour of some parts which do not use neighbour cache f.e. packet
socket.

I think safer approach would be to move this chunk after if (daddr).
And the possibility to remove this completely could be analyzed later.
--------------------

Patch updated with Alexey's safer suggestions.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-23 16:18:01 -08:00
..
802 [P8023]: Fix tainting of kernel. 2006-02-13 15:38:42 -08:00
8021q [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
appletalk [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
atm [ATM]: Ratelimit atmsvc failure messages 2006-02-13 15:34:58 -08:00
ax25 [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
bluetooth [Bluetooth] Fix NULL pointer dereferences of the HCI socket 2006-02-13 11:40:03 +01:00
bridge [NETFILTER]: Fix bridge netfilter related in xfrm_lookup 2006-02-23 16:10:51 -08:00
core [NET]: NETFILTER: remove duplicated lines and fix order in skb_clone(). 2006-02-19 22:32:06 -08:00
dccp [PATCH] remove bogus asm/bug.h includes. 2006-02-07 20:56:35 -05:00
decnet [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
econet [ECONET]: Use macro for spinlock_t definition. 2006-01-04 13:56:08 -08:00
ethernet [NET] ethernet: Fix first packet goes out with MAC 00:00:00:00:00:00 2006-02-23 16:18:01 -08:00
ieee80211 [PATCH] Typo corrections for ieee80211 2006-01-30 17:41:36 -05:00
ipv4 [IPV4]: Fix garbage collection of multipath route entries 2006-02-23 16:10:52 -08:00
ipv6 [PATCH] missing ntohs() in ip6_tunnel 2006-02-18 16:02:18 -05:00
ipx [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
irda [IRDA]: out of range array access 2006-02-09 16:59:48 -08:00
key [XFRM]: Eliminate refcounting confusion by creating __xfrm_state_put(). 2006-02-23 16:10:53 -08:00
lapb [NET]: Kill skb->list 2005-08-29 15:31:14 -07:00
llc [NET]: Add a dev_ioctl() fallback to sock_ioctl() 2006-01-03 14:18:33 -08:00
netfilter [NETFILTER]: nf_conntrack: Fix TCP/UDP HW checksum handling for IPv6 packet 2006-02-15 15:25:18 -08:00
netlink [NETLINK] genetlink: Fix bugs spotted by Andrew Morton. 2006-02-13 15:51:24 -08:00
netrom [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
packet [NET]: Fix some whitespace issues in af_packet.c 2006-01-23 16:28:02 -08:00
rose [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
rxrpc [NET]: "signed long" -> "long" 2006-01-17 13:03:54 -08:00
sched [PKT_SCHED]: Handle SCTP/DCCP in sfq_hash 2006-01-17 13:01:06 -08:00
sctp [SCTP]: Fix 'fast retransmit' to send a TSN only once. 2006-02-02 16:57:31 -08:00
sunrpc SUNRPC: Move upcall out of auth->au_ops->crcreate() 2006-02-01 12:52:25 -05:00
tipc [TIPC] Avoid polluting the global namespace 2006-01-18 00:45:16 +01:00
unix [PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem 2006-01-09 15:59:24 -08:00
wanrouter [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
x25 [PATCH] capable/capability.h (net/) 2006-01-11 18:42:14 -08:00
xfrm [XFRM]: Eliminate refcounting confusion by creating __xfrm_state_put(). 2006-02-23 16:10:53 -08:00
compat.c [PATCH] Fix 32bit sendmsg() flaw 2005-09-08 08:14:11 -07:00
Kconfig [NET]: Add CONFIG_NETDEBUG to suppress bad packet messages. 2006-02-02 20:40:09 -08:00
Makefile [TIPC] Initial merge 2006-01-12 14:06:31 -08:00
nonet.c [NET]: Fix sock_init() return value. 2006-01-03 13:11:17 -08:00
socket.c [PATCH] percpu data: only iterate over possible CPUs 2006-02-05 11:06:51 -08:00
sysctl_net.c [NET]: Fix "sysctl_net.c:36: error: 'core_table' undeclared here" 2005-10-03 14:16:34 -07:00
TUNABLE Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00