---
name: "vdeslirp_init"
section: "3"
platform: "linux"
package: "libvdeslirp0"
version: "0.1.1-2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libvdeslirpcfg"
---

# vdeslirp\_init(3)

simple API for slirp: configuration helpers

Part of [libvdeslirpcfg(3)](/libvdeslirpcfg/3.md).

## NAME

vdeslirp\_init, vdeslirp\_setvprefix, vdeslirp\_setvprefix6 - simple API for slirp: configuration helpers

## SYNOPSIS

**#include \<libvdeslirp.h\>**

**#define VDE\_INIT\_DEFAULT 1**

**void vdeslirp\_init(SlirpConfig \****cfg***, int** *flags***);**

**void vdeslirp\_setvprefix(SlirpConfig \****cfg***, int** *prefix***);**

**void vdeslirp\_setvprefix6(SlirpConfig \****cfg***, int** *prefix6***);**

These functions are provided by libvdeslirp. Link with -lvdeslirp.

## DESCRIPTION

These functions are configuration helpers for [**libvdeslirp**(3)](/libvdeslirp/3.md). The fields of the SlirpConfig has been described in the [**libvdeslirp**(3)](/libvdeslirp/3.md) manpage.

**vdeslirp\_init** clears the **SlirpConfig** configuration structure **cfg** and sets the version number. If **flags** is set to **VDE\_INIT\_DEFAULT** then it sets default values to all the fields of **cfg**. These default values are suitable for most applications.

-

  ```
  SLIRP configuration
  version       1
  ipv4-enable   1
  ipv4-network  10.0.2.0
  ipv4-netmask  255.255.255.0
  ipv4-host     10.0.2.2
  ipv6-enabled  1
  ipv6-prefix   fd00::
  ipv6-preflen  64
  ipv6-host     fd00::2
  hostname      slirp
  tftp-servname (null)
  tftp-path     (null)
  bootfile      (null)
  dhcp-start    10.0.2.15
  ipv4-vDNS     10.0.2.3
  ipv6-vDNS     fd00::3
  vDNS-search
  vdomainname   (null)
  MTU(0=def)    0
  MRU(0=def)    0
  disable-lback 0
  enable-emu    0
  ```

-

  The functions **vdeslirp\_setvprefix** and **vdeslirp\_setvprefix6** define the netmasks and prefixes for IPv4 and IPv6. These function are usually called after the redefinition of **vhost** or **vhost6**. **vdeslirp\_setvprefix** redefines the network prefix of **vnetwork**, **vdhcp\_start** and **vnameserver** while **vdeslirp\_setvprefix6** redefines the network prefix for **vprefix\_addr6** and **vnameserver6**.

## SEE ALSO

[**libvdeslirp**(3)](/libvdeslirp/3.md)

## BUGS

Bug reports should be addressed to \<info@virtualsquare.org\>

## AUTHOR

VirtualSquare. Project leader: Renzo Davoli.
