mirror of
https://passt.top/passt
synced 2025-05-24 18:15:36 +02:00
tcp, udp: Don't pre-fill IPv4 destination address in headers
Because packets sent on the tap interface will always be going to the guest/namespace, we more-or-less know what address they'll be going to. So we pre-fill this destination address in our header buffers for IPv4. We can't do the same for IPv6 because we could need either the global or link-local address for the guest. In future we're going to want more flexibility for the destination address, so this pre-filling will get in the way. Change the flow so we always fill in the IPv4 destination address for each packet, rather than prefilling it from proto_update_l2_buf(). In fact for TCP we already redundantly filled the destination for each packet anyway. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
5bf200ae8a
commit
955dd3251c
8 changed files with 15 additions and 32 deletions
10
passt.c
10
passt.c
|
@ -117,13 +117,11 @@ static void timer_init(struct ctx *c, const struct timespec *now)
|
|||
* proto_update_l2_buf() - Update scatter-gather L2 buffers in protocol handlers
|
||||
* @eth_d: Ethernet destination address, NULL if unchanged
|
||||
* @eth_s: Ethernet source address, NULL if unchanged
|
||||
* @ip_da: Pointer to IPv4 destination address, NULL if unchanged
|
||||
*/
|
||||
void proto_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s,
|
||||
const struct in_addr *ip_da)
|
||||
void proto_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s)
|
||||
{
|
||||
tcp_update_l2_buf(eth_d, eth_s, ip_da);
|
||||
udp_update_l2_buf(eth_d, eth_s, ip_da);
|
||||
tcp_update_l2_buf(eth_d, eth_s);
|
||||
udp_update_l2_buf(eth_d, eth_s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,7 +245,7 @@ int main(int argc, char **argv)
|
|||
if (!c.no_icmp)
|
||||
icmp_init();
|
||||
|
||||
proto_update_l2_buf(c.mac_guest, c.mac, &c.ip4.addr);
|
||||
proto_update_l2_buf(c.mac_guest, c.mac);
|
||||
|
||||
if (c.ifi4 && !c.no_dhcp)
|
||||
dhcp_init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue