Menu

#43 Improved FreeBSD interface description support

Git head
closed-fixed
nobody
None
5
2013-11-20
2010-03-10
Xin LI
No

The attached patch is an improved version of interface description support. This version provided the ability of supporting arbitrary length'ed interface description.

I have reorganized the code a little bit to make it easier to review. To summary:

- Dynamically allocate the description buffer instead of allocating it statically on the stack.
- For FreeBSD, when the buffer is not sufficient to hold the description, use the value fed back from kernel to reallocate the buffer.
- Free the buffer after use.

Note: I believe that the free() usage here is safe on FreeBSD and OpenBSD where free(NULL) is a no-op.

If this patch is accepted and if my name would be used please spell it as "Xin LI <delphij@FreeBSD.org>", thanks!

Discussion

  • Xin LI

    Xin LI - 2010-03-10

    Patch for support of arbitrary interface description

     
  • Guy Harris

    Guy Harris - 2010-03-10

    My copy of the C89 standard is at home, and I'm not about to spend an additional $300(!) to get an additional machine-readable copy, but a draft I found online says

    The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs.

    so, in any system that implements ANSI C, free(NULL) is a no-op.

     
  • Guy Harris

    Guy Harris - 2010-03-11

    Checked into the top of the tree and pushed. This might, or might not, get into the 1.1 release.

     
  • Guy Harris

    Guy Harris - 2010-03-11
    • status: open --> closed-fixed
     
  • Denis Ovsienko

    Denis Ovsienko - 2013-11-20

    Administrators of the "libpcap" SourceForge project have superseded this tracker item (formerly artifact 2968295, now patch 43) with issue 239 of the "libpcap" GitHub project.