[haiku-commits] Re: r35938 - in haiku/trunk/src: preferences/network servers/net

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 24 Mar 2010 08:45:08 +0100

On 2010-03-24 at 01:32:16 [+0100], Bruno Albuquerque <bga@xxxxxxxxxxxxx> 
wrote:
> 2010/3/23  <superstippi@xxxxxx>:
> 
> > Modified: haiku/trunk/src/servers/net/DHCPClient.cpp
> > ===================================================================
> > --- haiku/trunk/src/servers/net/DHCPClient.cpp  2010-03-23 20:03:15 UTC 
> > (rev 35937)
> > +++ haiku/trunk/src/servers/net/DHCPClient.cpp  2010-03-23 23:58:41 UTC 
> > (rev 35938)
> > @@ -4,6 +4,7 @@
> >  *
> >  * Authors:
> >  *             Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
> > + *             Vegard Wærp, vegarwa@xxxxxxxxx
> >  */
> >
> >
> > @@ -681,6 +682,18 @@
> >                                memcpy(name, data, size);
> >                                name[size] = '\0';
> >                                syslog(LOG_INFO, "DHCP domain name: 
> >                                \"%s\"\n", name);
> > +
> > +                               BPath path;
> > +                               if 
> > (find_directory(B_COMMON_SETTINGS_DIRECTORY, &path) != B_OK)
> > +                                       break;
> > +
> > +                               path.Append("network/resolv.conf");
> > +
> > +                               FILE* file = fopen(path.Path(), "a");
> > +                               if (file != NULL) {
> > +                                       fprintf(file, "domain %s\n", 
> > name);
> > +                                       fclose(file);
> > +                               }
> >                                break;
> >                        }
> 
> this part probably do not work as he expected. There are a couple of
> problems with this:
> 
> 1 - It assumes that the domain name will always be sent after the DNS
> servers are sent, which. if I remember correctly, is not true. this
> happens because if you check the case above this where it sets DNS
> servers, you will see it actually truncates and overwrites resolv.conf
> so if the domain name comes first, it will not be set.
> 
> 2 - You can can get informatiomn about the domain name several times
> even if it does not change. in this case, and assuming no DNS server
> information in the middle, this will result in several domain entries
> in resolv.conf.

Thanks for looking over the patch. Are there more easy fixes for the 
problem besides designing some kind of model for the information in 
resolv.conf?

Best regards,
-Stephan


Other related posts: