New: recvmsg returning buffer filled with zeros
Subsystems (2)
This is most likely just a programming error in the sample application. Someone want to investigate it?
Begin forwarded message:
Date: Sat, 04 Apr 2020 11:00:23 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 207097] New: recvmsg returning buffer filled with zeros
https://bugzilla.kernel.org/show_bug.cgi?id=207097
Bug ID: 207097
Summary: recvmsg returning buffer filled with zeros
Product: Networking
Version: 2.5
Kernel Version: 5.3.0-46-generic
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: blocking
Priority: P1
Component: Other
Assignee: [email protected]
Reporter: [email protected]
Regression: NoI am creating socket as follows:
=============================
static void create_new_read_socket( const uint64_t card_pos )
{
const int read_sock = available_cards[card_pos].read_socket = socket(PF_PACKET, SOCK_RAW|SOCK_NONBLOCK, htons( ETH_P_ALL ) );
if( read_sock < 0 )
{
fprintf( stderr, "%s %d Unable to create read_sock", __func__,
__LINE__ );
return;
}
struct ifreq ifr;
strncpy( ifr.ifr_name, available_cards[card_pos].card_name, IFNAMSIZ );
if( ioctl( read_sock, SIOCGIFFLAGS, &ifr ) == -1 )
{
fprintf( stderr, "%s %d Unable to get flag", __func__, __LINE__ );
return;
}
available_cards[card_pos].ifr_flags_backup = ifr.ifr_flags;
ifr.ifr_flags |= ( IFF_PROMISC | IFF_UP );
if( ioctl( read_sock, SIOCSIFFLAGS, &ifr ) == -1 )
{
fprintf( stderr, "%s %d Unable to set promiscious flag", __func__,
__LINE__ );
return;
}
struct sockaddr_ll ll =
{
.sll_family = PF_PACKET,
.sll_protocol = htons(ETH_P_ALL),
.sll_ifindex = (int)available_cards[card_pos].index
};
if( bind( read_sock, (struct sockaddr *) &ll, sizeof(ll) ) < 0 )
{
fprintf( stderr, "%s %d Unable to bind", __func__, __LINE__ );
return;
}
const int one = 1;
if( setsockopt( read_sock, SOL_PACKET, PACKET_AUXDATA, &one, sizeof(one))
< 0 )
{
fprintf( stderr, "%s %d Unable to setsockopt PACKET_AUXDATA",
__func__, __LINE__ );
return;
}
}=============================
reading the packet as follows:
=============================
read_return = recvmsg( read_socket, &msg, MSG_DONTWAIT );
=============================
I am seeing recvmsg is returning buffer filled with zeros but returning size is accurate.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
Quoted 6 lines · Stephen Hemminger
This is most likely just a programming error in the sample application. Someone want to investigate it?
Begin forwarded message:
Quoted 7 lines
Date: Sat, 04 Apr 2020 11:00:23 +0000
From: [email protected]
To: [email protected]
Subject: [Bug 207097] New: recvmsg returning buffer filled with zeros
From the link in buganizer to another discussion thread with the whole program, this appears to have already been resolved.