RE: netgraph(3) NGM_KSOCKET_BIND

From: John Polstra (jdp_at_polstra.com)
Date: 11/19/03

  • Next message: Alex Hoff: "RE: Multicast stats and bridging"
    Date: Wed, 19 Nov 2003 13:14:21 -0800 (PST)
    To: "Crist J. Clark" <cjc@freebsd.org>
    
    

    On 19-Nov-2003 Crist J. Clark wrote:
    > OK, an easy one. I am trying to do some netgraph(3) coding in
    > userland. From how I read the documentation, this should work. Before
    > I go learn all of the netraph(4) kernel code to understand the error
    > message, could someone tell me how this is supposed to look? I'm sure
    > it's something obvious that I have missed.
    >
    > The attached test program returns,
    >
    > # ./ngtest
    > ngtest: failed to bind ksocket: Invalid argument
    [...]
    > bzero(&laddr, sizeof laddr);
    > laddr.sin_family = AF_INET;
    > laddr.sin_addr.s_addr = INADDR_ANY;
    > laddr.sin_port = htons(DEFAULT_PORT);
    > if (NgSendMsg(cs, OUR_HOOK_CTL, NGM_KSOCKET_COOKIE, NGM_KSOCKET_BIND,
    > &laddr, sizeof laddr) == -1)
    > err(errno, "failed to bind ksocket");

    I think the problem might be that you forgot to set the "sin_len"
    member of the sockaddr_in struct. I don't see anything else
    glaringly wrong.

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


  • Next message: Alex Hoff: "RE: Multicast stats and bridging"