mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lib: extract NETWORK_ADDRESS and NETWORK_PREFIX as macros
The 169.254.0.0/16 network specification (for the appliance) is currently
duplicated between the direct backend and the libvirt backend. In a
subsequent patch, we're going to need the network specification in yet
another spot; extract it now to the NETWORK_ADDRESS and NETWORK_PREFIX
macros (simply as strings).
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2034160
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20211223103701.12702-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 216de164e0)
This commit is contained in:
committed by
Richard W.M. Jones
parent
6657d0c101
commit
4b9eac11db
@@ -158,6 +158,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Network address and network mask (expressed as address prefix) that the
|
||||
* appliance will see (if networking is enabled).
|
||||
*/
|
||||
#define NETWORK_ADDRESS "169.254.0.0"
|
||||
#define NETWORK_PREFIX "16"
|
||||
|
||||
/* Guestfs handle and associated structures. */
|
||||
|
||||
/* State. */
|
||||
|
||||
@@ -681,7 +681,7 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
|
||||
start_list ("-netdev") {
|
||||
append_list ("user");
|
||||
append_list ("id=usernet");
|
||||
append_list ("net=169.254.0.0/16");
|
||||
append_list ("net=" NETWORK_ADDRESS "/" NETWORK_PREFIX);
|
||||
} end_list ();
|
||||
start_list ("-device") {
|
||||
append_list (VIRTIO_DEVICE_NAME ("virtio-net"));
|
||||
|
||||
@@ -1826,7 +1826,8 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
|
||||
} end_element ();
|
||||
|
||||
start_element ("qemu:arg") {
|
||||
attribute ("value", "user,id=usernet,net=169.254.0.0/16");
|
||||
attribute ("value",
|
||||
"user,id=usernet,net=" NETWORK_ADDRESS "/" NETWORK_PREFIX);
|
||||
} end_element ();
|
||||
|
||||
start_element ("qemu:arg") {
|
||||
|
||||
Reference in New Issue
Block a user