Re: [RTnet-developers] Raw Socket
Brought to you by:
bet-frogger,
kiszka
|
From: Jan K. <jan...@we...> - 2006-08-30 16:48:27
|
[put the list on CC again]
Jorge Almeida wrote:
> For my application i need the RAW socket catching all the messages in t=
he network, and then they are treated in the rest of the application.
>=20
> But i have a smaller application, a watchdog, that have a UDP socket fo=
r remote control of the first application.=20
> And one of the principles is that they must stay independent from each =
other, i mean without communication.
>=20
> And not very often i yould like to connect to the machine using a ssh c=
lient for log collector or maybe a maintenance operation for example.
SSH would either be tunnelled (when using a closed, RTmac-managed
network) or be forwarded to the rtnetproxy (when installed). But do you
need those packets on the ETH_P_ALL socket as well?
>=20
> For that to work i think the A solution is not enough (!!!????)
Do you need ANY incoming packet delivered to more than one socket? If
yes, A is a no-go. :(
>=20
> But maybe the B 1 solution, with copy, is enough.
Ok, let's go for this and optimise later (shared rtskbs).
>=20
> But i stuck in the rtskb copy, because i dont know all the architectur =
and concept of the rtskb.
> If anyone could help me with the rtskb_copy function.
>=20
> I've started with this:
> alloc a rtskb from the rtskb_queue (this is the queue from the socket t=
hat gonna red the message after) so this rtskb will be release shortly.
> But now i dont know if a can make a simple memcpy copying the all struc=
ture at once or i need to make some more complicated kind of copy.
> After the copy the result rtskb will be inserted in the head of the dri=
ver receiving queue and willbe acquired by the socket function to the soc=
ket queue as normaly,=20
> with this the same function is used for ETH_P_ALL or any other protocol=
=2E
>=20
> // int rtskb_copy(struct rtskb *rtskb_1,struct rtskb *rtskb_2,struct rt=
skb_queue *pool)
> // {
> //=20
> // rtskb_1 =3D alloc_rtskb(rtskb_2->len,pool);
> // if(rtskb_1 =3D NULL)
> // return -ENOMEM;
> // =20
> // =20
> //=20
> //=20
> // }
>=20
memcpy the data, but not the control structure. I would suggest to
carefully step through the short life of an rtskb from its allocation in
the driver's rx handler up to the point where you want to clone it (BTW,
"clone" is the better term for the future, copy is just the current way
to achieve this). What fields are touched? What do they express?
=3D>Translate. If you stumble of some fields of an rtskb that you don't
understand, come back and ask here.
Jan
|