mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
tcp: be ready that a size of tcp_info can be changed
(00.052683) Error (soccr/soccr.c:166): Failed to obtain TCP_INFO: No error information We don't need a whole tcp info, so get only a part what we are going to use. Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
7178717bcf
commit
598790eb43
4 changed files with 31 additions and 6 deletions
|
|
@ -246,7 +246,14 @@ static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p, int
|
|||
sk->sd.ino = p->stat.st_ino;
|
||||
|
||||
if (proto == IPPROTO_TCP) {
|
||||
struct tcp_info info;
|
||||
struct {
|
||||
__u8 tcpi_state;
|
||||
__u8 tcpi_ca_state;
|
||||
__u8 tcpi_retransmits;
|
||||
__u8 tcpi_probes;
|
||||
__u8 tcpi_backoff;
|
||||
__u8 tcpi_options;
|
||||
} info;
|
||||
|
||||
aux = sizeof(info);
|
||||
ret = getsockopt(lfd, SOL_TCP, TCP_INFO, &info, &aux);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,18 @@ void libsoccr_release(struct libsoccr_sk *sk)
|
|||
free(sk);
|
||||
}
|
||||
|
||||
static int refresh_sk(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, struct tcp_info *ti)
|
||||
struct soccr_tcp_info {
|
||||
__u8 tcpi_state;
|
||||
__u8 tcpi_ca_state;
|
||||
__u8 tcpi_retransmits;
|
||||
__u8 tcpi_probes;
|
||||
__u8 tcpi_backoff;
|
||||
__u8 tcpi_options;
|
||||
__u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
|
||||
};
|
||||
|
||||
static int refresh_sk(struct libsoccr_sk *sk,
|
||||
struct libsoccr_sk_data *data, struct soccr_tcp_info *ti)
|
||||
{
|
||||
int size;
|
||||
socklen_t olen = sizeof(*ti);
|
||||
|
|
@ -215,7 +226,8 @@ static int refresh_sk(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, str
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int get_stream_options(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, struct tcp_info *ti)
|
||||
static int get_stream_options(struct libsoccr_sk *sk,
|
||||
struct libsoccr_sk_data *data, struct soccr_tcp_info *ti)
|
||||
{
|
||||
int ret;
|
||||
socklen_t auxl;
|
||||
|
|
@ -353,7 +365,7 @@ err_recv:
|
|||
|
||||
int libsoccr_save(struct libsoccr_sk *sk, struct libsoccr_sk_data *data, unsigned data_size)
|
||||
{
|
||||
struct tcp_info ti;
|
||||
struct soccr_tcp_info ti;
|
||||
|
||||
if (!data || data_size < SOCR_DATA_MIN_SIZE) {
|
||||
loge("Invalid input parameters\n");
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
|
|
@ -14,7 +15,9 @@ static int port = 8880;
|
|||
static int check_socket_closed(int sk)
|
||||
{
|
||||
int err, buffer = 0;
|
||||
struct tcp_info info;
|
||||
struct {
|
||||
__u8 tcpi_state;
|
||||
} info;
|
||||
socklen_t len = sizeof(info);
|
||||
|
||||
err = getsockopt(sk, IPPROTO_TCP, TCP_INFO, (void *)&info, &len);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
|
|
@ -13,7 +14,9 @@ static int port = 8880;
|
|||
static int check_socket_state(int sk, int state)
|
||||
{
|
||||
int err;
|
||||
struct tcp_info info;
|
||||
struct {
|
||||
__u8 tcpi_state;
|
||||
} info;
|
||||
socklen_t len = sizeof(info);
|
||||
|
||||
err = getsockopt(sk, IPPROTO_TCP, TCP_INFO, (void *)&info, &len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue