From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Subject: Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros
Date: Mon, 6 Apr 2020 08:03:43 -0700 [thread overview]
Message-ID: <20200406080343.2a0c4e7b@hermes.lan> (raw)
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: bugzilla-daemon@bugzilla.kernel.org
To: stephen@networkplumber.org
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: stephen@networkplumber.org
Reporter: Lvenkatakumarchakka@gmail.com
Regression: No
I 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.
--
You are receiving this mail because:
You are the assignee for the bug.
next reply other threads:[~2020-04-06 15:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 15:03 Stephen Hemminger [this message]
2020-04-06 20:11 ` Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200406080343.2a0c4e7b@hermes.lan \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.