vmd(8): Avoid double DHCP reply when using the internal dhcp server.
authorjan <jan@openbsd.org>
Tue, 9 Jul 2024 18:49:05 +0000 (18:49 +0000)
committerjan <jan@openbsd.org>
Tue, 9 Jul 2024 18:49:05 +0000 (18:49 +0000)
DHCP request should no leave vmd if its answered internally.

ok dv@

usr.sbin/vmd/vionet.c

index f4bb1a9..4e4e2d9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vionet.c,v 1.14 2024/02/22 02:38:53 dv Exp $  */
+/*     $OpenBSD: vionet.c,v 1.15 2024/07/09 18:49:05 jan Exp $ */
 
 /*
  * Copyright (c) 2023 Dave Voutila <dv@openbsd.org>
@@ -839,9 +839,11 @@ vionet_tx(struct virtio_dev *dev)
                if (vionet->local) {
                        dhcpsz = dhcp_request(dev, iov->iov_base, iov->iov_len,
                            &dhcppkt);
-                       if (dhcpsz > 0)
+                       if (dhcpsz > 0) {
                                log_debug("%s: detected dhcp request of %zu bytes",
-                                   __func__, dhcpsz);
+                                   __func__, dhcpsz);
+                               goto drop;
+                       }
                }
 
                /* Write our packet to the tap(4). */