Commit 7e22e60f authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

net: add ability to use tcp_repair_off from a restorer code

Use sys_setsockopt and declare a function in a header as "static inline"
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1da44415
#ifndef __CR_SK_INET_H__ #ifndef __CR_SK_INET_H__
#define __CR_SK_INET_H__ #define __CR_SK_INET_H__
#include <netinet/tcp.h>
#include "protobuf.h" #include "protobuf.h"
#include "../protobuf/sk-inet.pb-c.h" #include "../protobuf/sk-inet.pb-c.h"
#define INET_ADDR_LEN 40 #define INET_ADDR_LEN 40
#ifndef TCP_REPAIR
#define TCP_REPAIR 19 /* TCP sock is under repair right now */
#define TCP_REPAIR_QUEUE 20
#define TCP_QUEUE_SEQ 21
#define TCP_REPAIR_OPTIONS 22
#endif
struct inet_sk_desc { struct inet_sk_desc {
struct socket_desc sd; struct socket_desc sd;
...@@ -33,7 +41,14 @@ struct inet_sk_info { ...@@ -33,7 +41,14 @@ struct inet_sk_info {
int inet_bind(int sk, struct inet_sk_info *); int inet_bind(int sk, struct inet_sk_info *);
int inet_connect(int sk, struct inet_sk_info *); int inet_connect(int sk, struct inet_sk_info *);
void tcp_repair_off(int sk); static inline void tcp_repair_off(int fd)
{
int aux = 0;
if (sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to turn off repair mode on socket");
}
void tcp_unlock_all(void); void tcp_unlock_all(void);
void tcp_locked_conn_add(struct inet_sk_info *); void tcp_locked_conn_add(struct inet_sk_info *);
void tcp_unlock_connections(void); void tcp_unlock_connections(void);
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/tcp-stream.pb-c.h" #include "protobuf/tcp-stream.pb-c.h"
#ifndef TCP_REPAIR
#define TCP_REPAIR 19 /* TCP sock is under repair right now */
#define TCP_REPAIR_QUEUE 20
#define TCP_QUEUE_SEQ 21
#define TCP_REPAIR_OPTIONS 22
struct tcp_repair_opt { struct tcp_repair_opt {
u32 opt_code; u32 opt_code;
u32 opt_val; u32 opt_val;
...@@ -36,7 +30,6 @@ enum { ...@@ -36,7 +30,6 @@ enum {
TCP_SEND_QUEUE, TCP_SEND_QUEUE,
TCP_QUEUES_NR, TCP_QUEUES_NR,
}; };
#endif
#ifndef TCPOPT_SACK_PERM #ifndef TCPOPT_SACK_PERM
#define TCPOPT_SACK_PERM TCPOPT_SACK_PERMITTED #define TCPOPT_SACK_PERM TCPOPT_SACK_PERMITTED
...@@ -55,14 +48,6 @@ static int tcp_repair_on(int fd) ...@@ -55,14 +48,6 @@ static int tcp_repair_on(int fd)
return ret; return ret;
} }
void tcp_repair_off(int fd)
{
int aux = 0;
if (setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to turn off repair mode on socket");
}
static int tcp_repair_establised(int fd, struct inet_sk_desc *sk) static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
{ {
int ret; int ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment