LIBVDESLIRPFWD(3)
π LIBVDESLIRPFWD(3) π
okay bestie, welcome to the Library Functions Manual section for LIBVDESLIRPFWD β yes she's a (3), that's library functions babes, we're in the C headers today π
β¨ NAME β¨
vdeslirp_add_fwd, vdeslirp_remove_fwd, vdeslirp_add_unixfwd, vdeslirp_remove_unixfwd, vdeslirp_add_cmdexec β a simple API for slirp, port forwarding π¦
πΈ SYNOPSIS πΈ
#include *libvdeslirp.h*
int vdeslirp_add_fwd(struct vdeslirp *slirp, int is_udp, struct in_addr
host_addr, int host_port, struct in_addr guest_addr, int guest_port);
int vdeslirp_remove_fwd(struct vdeslirp *slirp, int is_udp, struct
in_addr host_addr, int host_port);
int vdeslirp_add_unixfwd(struct vdeslirp *slirp, char *path, struct
in_addr guest_addr, int guest_port);
int vdeslirp_remove_unixfwd(struct vdeslirp *slirp, struct in_addr
guest_addr, int guest_port);
int vdeslirp_add_cmdexec(struct vdeslirp *slirp, const char *cmdline,
struct in_addr *guest_addr, int guest_port);
int vdeslirp_remove_cmdexec(struct vdeslirp *slirp, struct in_addr
guest_addr, int guest_port);
π«Ά DESCRIPTION π«Ά
Slirp (peep libvdelirp(3) for the lore π) is a TCP/IP emulator. Slirp spins up a whole virtual network using just standard user privileges β like, no root access, no CAP_NET_ADMIN, none of that stressful stuff, we love a low-maintenance icon π
. And these functions right here? They're the ones managing your port forwarding services. Slay.
vdeslirp_add_fwd and vdeslirp_remove_fwd respectively add and remove udp or tcp port forwarding services β which one you get depends on the value of is_udp π. host_addr and host_port are the IP address and port number bound for the service in the host system. And the way that all the connections or datagrams to host_addr and host_port get diverted to guest_addr and guest_port in the slirp virtual network?? iconic. literally the whole point. periodt.
vdeslirp_add_unixfwd and vdeslirp_remove_unixfwd respectively add and remove a forwarding service towards a PF_UNIX stream socket on the hosting system π§. All the connections from a node of the virtual network to guest_addr and guest_port get diverted to the PF_UNIX bound to the pathname path. This feature is commonly used to run X-window clients in the virtual network β like fr fr, the value of path could be /tmp/.X11-unix/X0 π.
ngl, if libslirp does not supportslirp_add_unix, thenvdeslirp_add_unixfwdis implemented by a workaround based onnc(1). so that's the tea β
vdeslirp_cmd_fwd adds a forwarding service to a command π. A TCP connection to guest_addr and guest_port activates the command cmdline. And the data exchanged on that TCP connection is forwarded as stdin/stdout to the command. chef's kiss, no notes π₯.
vdeslirp_remove_cmdexec removes a command forwarding service. bye bye π
π RETURN VALUE π
All these functions return 0 in case of success, -1 otherwise β and yup, errno is set consequently, she always tells on you π.
vdeslirp_remove_cmdexec and vdeslirp_remove_unixfwd return -1 and set errno to ENOSYS if libslirp does not support slirp_remove_guestfwd. so like, rude, but okay π
π¦ SEE ALSO π¦
π BUGS π
Found a bug bestie?? π Bug reports should be addressed to info@virtualsquare.org β they wanna hear from you, fr fr π«Ά
π AUTHOR π
VirtualSquare. Project leader: Renzo Davoli. main character energy honestly β
and that's the whole page babes!! written by VirtualSquare, January 2024 β go forth and forward some ports, you absolute legend πβ¨π
π¦ where this page comes from
- ubuntu stonking: libvdeslirp0 0.1.4-1 Β· LGPL-2.1-or-later
- Copyright (C) 2019 VirtualSquare. Project Leader: Renzo Davoli
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms