FAQ
http://codereview.appspot.com/6445105/diff/13001/src/pkg/net/iprawsock_posix.go
File src/pkg/net/iprawsock_posix.go (left):

http://codereview.appspot.com/6445105/diff/13001/src/pkg/net/iprawsock_posix.go#oldcode81
src/pkg/net/iprawsock_posix.go:81: if len(b) >= IPv4len { // discard
ipv4 header
I am confused. Is the issue that you don't want to discard the IPv4
header anymore, or is it that the header is already gone and we were
throwing away data bytes?

I would like to understand what the API is supposed to be. The comments
don't really say.

http://codereview.appspot.com/6445105/

Search Discussions

  • Cw at Sep 10, 2012 at 9:16 pm

    I would like to understand what the API is supposed to be. The
    comments don't
    really say.
    I think this was my code from a couple of years back, I could be wrong.


    IIRC, IPv4 raw sockets have headers prepended to them. IPv6 do not.

    So discarding them for IPv4 makes sense to keep the interface more
    uniform.

    @mikio, does that seem reasonable?




    https://codereview.appspot.com/6445105/
  • Russ Cox at Sep 10, 2012 at 9:11 pm
    Right, I am trying to understand if

    (A) the CL is trying to preserve the headers
    or
    (B) we have somehow started using a system call that drops the headers
    and the code is trying to avoid dropping the beginning of the data.

    Russ
  • Cw at Sep 10, 2012 at 9:42 pm

    (A) the CL is trying to preserve the headers
    iirc, would break the test, it does a ping to localhost
    (B) we have somehow started using a system call that drops the headers
    and the code is trying to avoid dropping the beginning of the data.
    which would also break the test



    is this for make things work on some kernel/platform that behaves
    differently? i think when i did this i tested it on linux, bsd and
    mcapple and they all behaved the same way





    i suspect someone wants the headers (which is arguably fair) but not
    what the API did on the past

    i would prefer APIs that don't involve syscall be fairly uniform and not
    protocol specific

    if you need protocol/platform specific thins, importing syscall or
    unsafe might be required


    https://codereview.appspot.com/6445105/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 10, '12 at 8:27p
activeSep 10, '12 at 9:42p
posts4
users2
websitegolang.org

2 users in discussion

Russ Cox: 2 posts Cw: 2 posts

People

Translate

site design / logo © 2022 Grokbase