Skip to content

Is there any way to set FwMark? #93

@kr105

Description

@kr105

I did look on the code, but I could not find anything, is there any way to set the FwMark value like in the wg0.conf file?

[Interface]
PrivateKey = xxxxxxxxxxxxxxxxx
Address = 10.10.10.2/24
ListenPort = 51820
FwMark = 0x10

Currently I made this workaround, but I don't like it 😆

fn configure_wg_fwmark(interface_name: &str, fwmark: u32) -> Result<(), Box<dyn std::error::Error>> {
	let output = Command::new("wg")
		.args(["set", interface_name, "fwmark", &fwmark.to_string()])
		.output()?;

	if !output.status.success() {
		let error_msg = String::from_utf8_lossy(&output.stderr);
		return Err(format!("Failed to set fwmark: {error_msg}").into());
	}

	Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions