Why CARP not send packets with physical CARP interface address ?
I think there is a some good reason for that.
This will be usefull to check packets from CARP address with tcpdump.
here is what i am talking...
from src/sys/net/if_ethersubr.c at ether_output()
(...)
/*
* Add local net header. If no space in first mbuf,
* allocate another.
*/
M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT);
if (m == 0)
senderr(ENOBUFS);
eh = mtod(m, struct ether_header *);
(...)
#if NCARP > 0
if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
bcopy((caddr_t)((struct arpcom *)ifp0)->ac_enaddr,
(caddr_t)eh->ether_shost, sizeof(eh->ether_shost));
}
#endif
here is made the copy of carp physical address ((caddr_t)((struct arpcom
*)ifp0)->ac_enaddr to ethernet header added at M_PREPEND and pointed by eh =
mtod().
Here is my debug info to check if this is ok:
eh = mtod(m, struct ether_header *);
if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
printf("send: %s\n", ether_sprintf(eh->ether_shost));
}
mflags = m->m_flags;
len = m->m_pkthdr.len;
s = splimp();
/*
* Queue message on interface, and start output if interface
* not yet active.
*/
IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
my setup:
# ifconfig fxp0 192.168.0.2 255.255.255.0
# ifconfig carp0 create
# ifconfig carp0 192.168.0.3 255.255.255.0 vhid 1 pass 1
# ping -s 192.168.0.3 192.168.0.1
And when i check the packets with:
# tcpdump -nei rl0 dst 192.168.0.1 or src 192.168.0.1
13:02:37.884814 0:2:a5:9:57:f8 0:e0:7d:cc:2f:4d 0800 98: 192.168.0.3 >
192.168.0.1: icmp: echo request
13:02:37.884932 0:e0:7d:cc:2f:4d 0:0:5e:0:1:1 0800 98: 192.168.0.1 >
192.168.0.3: icmp: echo reply
And the debug info say:
# tail -f /var/log/messages
Aug 16 13:04:15 fw2 /bsd: send: 00:00:5e:00:01:01
Why i can4t see the ethernet source address copied by ether_output before
the mbuf is inserted in the interface queue ?
i am missing something ?
luiz