All of lore.kernel.org
 help / color / mirror / Atom feed
* About Raw socket, vlan + ip header
@ 2015-03-03  5:14 Sriram Raghunathan
  2015-03-03 17:03 ` Philippe Troin
  0 siblings, 1 reply; 3+ messages in thread
From: Sriram Raghunathan @ 2015-03-03  5:14 UTC (permalink / raw)
  To: netdev

Hi,

My name is Sriram, have a question about raw socket programming.

Writing a socket program where, I'm trying to construct a ether frame
with vlan id and copying ip header there after. By using PF_PACKET
family.

But when I do a sendto, the ip header is stripped off from the
packet. Could you please let me know how to go about?

Having the ip header is necessary for a software here.

Thanks for the time.

Sriram

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

* Re: About Raw socket, vlan + ip header
  2015-03-03  5:14 About Raw socket, vlan + ip header Sriram Raghunathan
@ 2015-03-03 17:03 ` Philippe Troin
  2015-03-04  4:36   ` Sriram Raghunathan
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Troin @ 2015-03-03 17:03 UTC (permalink / raw)
  To: Sriram Raghunathan; +Cc: netdev

On Tue, 2015-03-03 at 10:44 +0530, Sriram Raghunathan wrote:
> Writing a socket program where, I'm trying to construct a ether frame
> with vlan id and copying ip header there after. By using PF_PACKET
> family.
> 
> But when I do a sendto, the ip header is stripped off from the
> packet. Could you please let me know how to go about?

man 7 packet

...
       The  socket_type  is either SOCK_RAW for raw packets including the link
       level header or SOCK_DGRAM for  cooked  packets  with  the  link  level
       header  removed.   The  link level header information is available in a
       common format in a sockaddr_ll.  protocol is the  IEEE  802.3  protocol
...

Are you opening a SOCK_RAW or a SOCK_DGRAM PF_PACKET socket?

Phil.

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

* Re: About Raw socket, vlan + ip header
  2015-03-03 17:03 ` Philippe Troin
@ 2015-03-04  4:36   ` Sriram Raghunathan
  0 siblings, 0 replies; 3+ messages in thread
From: Sriram Raghunathan @ 2015-03-04  4:36 UTC (permalink / raw)
  To: ext Philippe Troin, Sriram Raghunathan; +Cc: netdev

Hi Philippe,

Using SOCK_RAW.

Sriram
On Tuesday 03 March 2015 10:33 PM, ext Philippe Troin wrote:
> On Tue, 2015-03-03 at 10:44 +0530, Sriram Raghunathan wrote:
>> Writing a socket program where, I'm trying to construct a ether frame
>> with vlan id and copying ip header there after. By using PF_PACKET
>> family.
>>
>> But when I do a sendto, the ip header is stripped off from the
>> packet. Could you please let me know how to go about?
> man 7 packet
>
> ...
>         The  socket_type  is either SOCK_RAW for raw packets including the link
>         level header or SOCK_DGRAM for  cooked  packets  with  the  link  level
>         header  removed.   The  link level header information is available in a
>         common format in a sockaddr_ll.  protocol is the  IEEE  802.3  protocol
> ...
>
> Are you opening a SOCK_RAW or a SOCK_DGRAM PF_PACKET socket?
>
> Phil.
>

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

end of thread, other threads:[~2015-03-04  4:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03  5:14 About Raw socket, vlan + ip header Sriram Raghunathan
2015-03-03 17:03 ` Philippe Troin
2015-03-04  4:36   ` Sriram Raghunathan

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.