patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9427, Add gethostbyname hook

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9427: Add gethostbyname hook

Submitted by:  Joel Cunningham <jcunningham>
Submitted on:  Fri 04 Aug 2017 08:45:19 PM UTC  
 
Category: sockets/netconnPriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: Joel Cunningham <jcunningham>Open/Closed: Open
Planned Release: None

Mon 07 Aug 2017 02:00:16 PM UTC, comment #3:

You're correct that dns_gethostbyname() would not have access to the hook, but then again the hook would have to be implemented in terms of only raw APIs if it were placed at that level. That pretty much rules out hooking in any external DNS resolver since these are all going to use sockets API (I'm not aware of any external DNS libraries using LwIP's raw API)

The lack of parity between gethostbyname and dns_gethostbyname hasn't been an issue in my system since I don't use any of the raw applications, everything is calling netdb APIs for name resolution

FWIW, DNS resolver systems typically allow external hooks. mDNSResponder ships with hooks for Glibc's GNU Name Switch Service and Winsock's Namepsace Service Provider

Joel Cunningham <jcunningham>
Project MemberIn charge of this item.
Sun 06 Aug 2017 07:45:04 PM UTC, comment #2:

Hmm, adding a hook in gethostbyname in api_lib.c would mean that API applications would receive a different result to raw applications. I don't think that would be a good idea...

Simon Goldschmidt <goldsimon>
Project Administrator
Fri 04 Aug 2017 08:47:29 PM UTC, comment #1:

0001-Add-DNS-SD-hook-for-LWIP_HOOK_GETHOSTBYNAME.patch is for lwip-contrib if that's not clear :)

Joel Cunningham <jcunningham>
Project MemberIn charge of this item.
Fri 04 Aug 2017 08:45:19 PM UTC, original submission:

0001-Add-gethostbyname.patch: adds a new hook (LWIP_HOOK_GETHOSTBYNAME) which allows an external DNS resolver to be hooked into's LwIP gethostbyname/getaddrinfo implementation and DNS stack. The hook can handle some or all of the queries

One use case for this hook is to run mDNSResponder in the same system as LwIP (mDNSResponder also uses LwIP's socekt APIs) and have it handle .local queries while LwIP stack handles unicast DNS queries

This allows applications to use LwIP's gethostbyname/getaddrinfo for all types of queries supported in the system and not have to worry about using a different API for each DNS resolver that actually handles the query

0001-Add-DNS-SD-hook-for-LWIP_HOOK_GETHOSTBYNAME.patch: This adds an implementation of LWIP_HOOK_GETHOSTBYNAME that uses the
DNS-SD API provided by mDNSResponder

I've been using these in my port, which uses mDNSResponder (ported to LwIP) only for MDNS queries (unicast queries use LwIP). This provides a unified DNS subsystem that applications can use via gethostbyname/getaddrinfo. I know others have mDNSResponder in a system with LwIP, so I'd like to share this approach

Joel Cunningham <jcunningham>
Project MemberIn charge of this item.

 

Attached Files
file #41416:  0001-Add-gethostbyname-hook.patch added by jcunningham (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by jcunningham (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Aug 2017 08:45:19 PM UTCjcunninghamAttached File-=>Added 0001-Add-gethostbyname-hook.patch, #41416
      Attached File-=>Added 0001-Add-DNS-SD-hook-for-LWIP_HOOK_GETHOSTBYNAME.patch, #41417

    Back to the top


    Powered by Savane 3.1-cleanup1