Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Handle netgraph control messages

2 views
Skip to first unread message

serena zanetta

unread,
Apr 7, 2010, 11:51:58 AM4/7/10
to freeb...@freebsd.org
I’ve modified the ng_hub node code in order to send a “connect” control
message to the following ng_ksocket node.

I’ve filled a sockaddr_in structure, named connect_saddrin, as:

connect_saddrin.sin_len = 16;

connect_saddrin.sin_family = AF_INET;

connect_saddrin.sin_port = htonl(55056);

connect_saddrin.sin_addr.s_addr = htonl(remoteIP.s_addr);

And then I’ve initialized the control message and send it out:


NG_MKMESSAGE(connect_msg,NGM_KSOCKET_COOKIE,NGM_KSOCKET_CONNECT,sizeof(struct
sockaddr_in),M_NOWAIT);

*(struct sockaddr_in *)connect_msg->data = connect_saddrin;

NG_SEND_MSG_HOOK(error,node,connect_msg,hook2,0);

But it doesn’t work: no message is received by the ng_ksocket node!

Can anyone help me please?

Thank you,

Serena

Julian Elischer

unread,
Apr 7, 2010, 2:43:26 PM4/7/10
to serena zanetta, freeb...@freebsd.org
On 4/7/10 8:51 AM, serena zanetta wrote:
> I’ve modified the ng_hub node code in order to send a “connect” control
> message to the following ng_ksocket node.
>

At very first glance it looks ok but I'll have to go look a the code
to see if you've forgotten something :-)

>
>
> I’ve filled a sockaddr_in structure, named connect_saddrin, as:
>
> connect_saddrin.sin_len = 16;
>
> connect_saddrin.sin_family = AF_INET;
>
> connect_saddrin.sin_port = htonl(55056);
>
> connect_saddrin.sin_addr.s_addr = htonl(remoteIP.s_addr);
>
> And then I’ve initialized the control message and send it out:
>
>
> NG_MKMESSAGE(connect_msg,NGM_KSOCKET_COOKIE,NGM_KSOCKET_CONNECT,sizeof(struct
> sockaddr_in),M_NOWAIT);
>
> *(struct sockaddr_in *)connect_msg->data = connect_saddrin;
>
> NG_SEND_MSG_HOOK(error,node,connect_msg,hook2,0);
>
>
>
> But it doesn’t work: no message is received by the ng_ksocket node!
>
>
>
> Can anyone help me please?
>
>
>
> Thank you,
>
>
>
> Serena

> _______________________________________________
> freeb...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net...@freebsd.org"

0 new messages