Commit 74221764 authored by Pavel Emelyanov's avatar Pavel Emelyanov

pscketsk: Add loss and timestamp sockoptions

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d29feb91
......@@ -16,4 +16,6 @@ message packet_sock_entry {
required bool aux_data = 10;
required bool orig_dev = 11;
required bool vnet_hdr = 12;
required bool loss = 13;
required uint32 timestamp = 14;
}
......@@ -59,6 +59,9 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
if (dump_opt(lfd, SOL_PACKET, PACKET_RESERVE, &psk.reserve))
return -1;
if (dump_opt(lfd, SOL_PACKET, PACKET_TIMESTAMP, &psk.timestamp))
return -1;
if (dump_opt(lfd, SOL_PACKET, PACKET_AUXDATA, &yes))
return -1;
psk.aux_data = (yes ? true : false);
......@@ -71,6 +74,10 @@ static int dump_one_packet_fd(int lfd, u32 id, const struct fd_parms *p)
return 1;
psk.vnet_hdr = (yes ? true : false);
if (dump_opt(lfd, SOL_PACKET, PACKET_LOSS, &yes))
return 1;
psk.loss = (yes ? true : false);
return pb_write_one(fdset_fd(glob_fdset, CR_FD_PACKETSK), &psk, PB_PACKETSK);
}
......@@ -118,6 +125,9 @@ static int open_packet_sk(struct file_desc *d)
if (restore_opt(sk, SOL_PACKET, PACKET_RESERVE, &pse->reserve))
goto err_cl;
if (restore_opt(sk, SOL_PACKET, PACKET_TIMESTAMP, &pse->timestamp))
goto err_cl;
if (pse->aux_data) {
yes = 1;
if (restore_opt(sk, SOL_PACKET, PACKET_AUXDATA, &yes))
......@@ -136,6 +146,12 @@ static int open_packet_sk(struct file_desc *d)
goto err_cl;
}
if (pse->loss) {
yes = 1;
if (restore_opt(sk, SOL_PACKET, PACKET_LOSS, &yes))
goto err_cl;
}
if (rst_file_params(sk, pse->fown, pse->flags))
goto err_cl;
......
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