1
0
mirror of https://passt.top/passt synced 2024-11-09 22:29:56 +00:00
passt/pasta.h
Stefano Brivio 8f3f8e190c pasta: Add fallback timer mechanism to check if namespace is gone
We don't know how frequently this happens, but hitting
fs.inotify.max_user_watches or similar sysctl limits is definitely
not out of question, and Paul mentioned that, for example, Podman's
CI environments hit similar issues in the past.

Introduce a fallback mechanism based on a timer file descriptor: we
grab the directory handle at startup, and we can then use openat(),
triggered periodically, to check if the (network) namespace directory
still exists. If openat() fails at some point, exit.

Link: https://github.com/containers/podman/pull/21563#issuecomment-1943505707
Reported-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2024-02-16 08:47:14 +01:00

21 lines
623 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (c) 2021 Red Hat GmbH
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
#ifndef PASTA_H
#define PASTA_H
extern int pasta_child_pid;
void pasta_open_ns(struct ctx *c, const char *netns);
void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
int argc, char *argv[]);
void pasta_ns_conf(struct ctx *c);
void pasta_child_handler(int signal);
void pasta_netns_quit_init(const struct ctx *c);
void pasta_netns_quit_inotify_handler(struct ctx *c, int inotify_fd);
void pasta_netns_quit_timer_handler(struct ctx *c, union epoll_ref ref);
#endif /* PASTA_H */