mirror of
https://github.com/systemd/systemd.git
synced 2025-09-07 09:44:44 +03:00
socket-util: add sockopt helper for controlling IP_RECVFRAGSIZE
This commit is contained in:
@@ -67,6 +67,14 @@ struct sockaddr_vm {
|
|||||||
#define IPV6_FREEBIND 78
|
#define IPV6_FREEBIND 78
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef IP_RECVFRAGSIZE
|
||||||
|
#define IP_RECVFRAGSIZE 25
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IPV6_RECVFRAGSIZE
|
||||||
|
#define IPV6_RECVFRAGSIZE 77
|
||||||
|
#endif
|
||||||
|
|
||||||
/* linux/sockios.h */
|
/* linux/sockios.h */
|
||||||
#ifndef SIOCGSKNS
|
#ifndef SIOCGSKNS
|
||||||
#define SIOCGSKNS 0x894C
|
#define SIOCGSKNS 0x894C
|
||||||
|
@@ -266,6 +266,7 @@ ssize_t recvmsg_safe(int sockfd, struct msghdr *msg, int flags);
|
|||||||
int socket_get_family(int fd, int *ret);
|
int socket_get_family(int fd, int *ret);
|
||||||
int socket_set_recvpktinfo(int fd, int af, bool b);
|
int socket_set_recvpktinfo(int fd, int af, bool b);
|
||||||
int socket_set_unicast_if(int fd, int af, int ifi);
|
int socket_set_unicast_if(int fd, int af, int ifi);
|
||||||
|
|
||||||
int socket_set_option(int fd, int af, int opt_ipv4, int opt_ipv6, int val);
|
int socket_set_option(int fd, int af, int opt_ipv4, int opt_ipv6, int val);
|
||||||
static inline int socket_set_recverr(int fd, int af, bool b) {
|
static inline int socket_set_recverr(int fd, int af, bool b) {
|
||||||
return socket_set_option(fd, af, IP_RECVERR, IPV6_RECVERR, b);
|
return socket_set_option(fd, af, IP_RECVERR, IPV6_RECVERR, b);
|
||||||
@@ -282,3 +283,6 @@ static inline int socket_set_freebind(int fd, int af, bool b) {
|
|||||||
static inline int socket_set_transparent(int fd, int af, bool b) {
|
static inline int socket_set_transparent(int fd, int af, bool b) {
|
||||||
return socket_set_option(fd, af, IP_TRANSPARENT, IPV6_TRANSPARENT, b);
|
return socket_set_option(fd, af, IP_TRANSPARENT, IPV6_TRANSPARENT, b);
|
||||||
}
|
}
|
||||||
|
static inline int socket_set_recvfragsize(int fd, int af, bool b) {
|
||||||
|
return socket_set_option(fd, af, IP_RECVFRAGSIZE, IPV6_RECVFRAGSIZE, b);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user