linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* RAW Sockets - HDLC or Ethernet
@ 2008-03-06  9:24 Russell McGuire
  2008-03-07  7:53 ` Norbert van Bolhuis
  0 siblings, 1 reply; 2+ messages in thread
From: Russell McGuire @ 2008-03-06  9:24 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]

Anyone,

Yet another mysterious question, at least to me.

I have written to simple utilities to send and receive a file / data through
a newly created driver, HDLC using an MPC8360E. 
Though I doubt this question is limited to that specific HW.

The main question is that everything I send though device HDLC0 I can
immediately read from HDLC0 even though logically there is no connection
there. It as if the kernel is immediately allowing me to read from the same
device, what a separate application just wrote.???
HOW CAN THIS BE?

Details:
I have two applications: send and receive.  (pseudo code as follows)

Send opens a socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)).
And binds it (AF_PACKET, ETH_P_HLDC, if_index(hdlc0))

Receive opens a socket to the same device 
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
bind(AF_PACKET, ETH_P_ALL, if_index(hdlc0)

Note they are opening the same device.

Now if I send anything through the send application, I immediately receive
it via the receive application??
Note, entirely separate processes!

Note, there is NO hardware loopback, this should be a dead end, and I should
get nothing back at least as far as HW is concerned.

What am I missing, that causes all my TX data to show up immediately in the
RX app? Note I have verified my HDLC drier is not actually receiving
anything, so is there something in the kernel that is bridging the TX / RX
paths, or am I just missing the function of this? If so how can I use RAW
mode, while not mixing this, or at least keeping them separate in the
applications?

-Russ

[-- Attachment #2: Type: text/html, Size: 9225 bytes --]

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

* Re: RAW Sockets - HDLC or Ethernet
  2008-03-06  9:24 RAW Sockets - HDLC or Ethernet Russell McGuire
@ 2008-03-07  7:53 ` Norbert van Bolhuis
  0 siblings, 0 replies; 2+ messages in thread
From: Norbert van Bolhuis @ 2008-03-07  7:53 UTC (permalink / raw)
  To: rmcguire; +Cc: linuxppc-embedded


I guess this is what a raw packet socket is supposed to do.
It's not a bug it's a feature.
Can't you somehow recognize your own packet (and skip it) ?

Btw. this question can probably be better addressed in
comp.os.linux.development.system

---
N. van Bolhuis.


Russell McGuire wrote:
> Anyone,
> 
> Yet another mysterious question, at least to me.
> 
> I have written to simple utilities to send and receive a file / data through
> a newly created driver, HDLC using an MPC8360E. 
> Though I doubt this question is limited to that specific HW.
> 
> The main question is that everything I send though device HDLC0 I can
> immediately read from HDLC0 even though logically there is no connection
> there. It as if the kernel is immediately allowing me to read from the same
> device, what a separate application just wrote.???
> HOW CAN THIS BE?
> 
> Details:
> I have two applications: send and receive.  (pseudo code as follows)
> 
> Send opens a socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)).
> And binds it (AF_PACKET, ETH_P_HLDC, if_index(hdlc0))
> 
> Receive opens a socket to the same device 
> socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))
> bind(AF_PACKET, ETH_P_ALL, if_index(hdlc0)
> 
> Note they are opening the same device.
> 
> Now if I send anything through the send application, I immediately receive
> it via the receive application??
> Note, entirely separate processes!
> 
> Note, there is NO hardware loopback, this should be a dead end, and I should
> get nothing back at least as far as HW is concerned.
> 
> What am I missing, that causes all my TX data to show up immediately in the
> RX app? Note I have verified my HDLC drier is not actually receiving
> anything, so is there something in the kernel that is bridging the TX / RX
> paths, or am I just missing the function of this? If so how can I use RAW
> mode, while not mixing this, or at least keeping them separate in the
> applications?
> 
> -Russ
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded


-- 
This message has been scanned for viruses and is believed to be clean

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

end of thread, other threads:[~2008-03-07  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06  9:24 RAW Sockets - HDLC or Ethernet Russell McGuire
2008-03-07  7:53 ` Norbert van Bolhuis

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).