netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros
@ 2020-04-06 15:03 Stephen Hemminger
  2020-04-06 20:11 ` Willem de Bruijn
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2020-04-06 15:03 UTC (permalink / raw)
  To: netdev

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros
  2020-04-06 15:03 Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros Stephen Hemminger
@ 2020-04-06 20:11 ` Willem de Bruijn
  0 siblings, 0 replies; 2+ messages in thread
From: Willem de Bruijn @ 2020-04-06 20:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Network Development

On Mon, Apr 6, 2020 at 11:04 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> 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

From the link in buganizer to another discussion thread with the whole
program, this appears to have already been resolved.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-06 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-06 15:03 Fw: [Bug 207097] New: recvmsg returning buffer filled with zeros Stephen Hemminger
2020-04-06 20:11 ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).