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

  • From: Bruno Albuquerque <bga@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 24 Mar 2010 07:30:56 -0300

2010/3/24 Stephan Assmus <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.
>
> I hope to have resolved the issue in r35940 and r35941, feedback welcome. Of 
> course
> out of laziness, I maintained the status quo about rewriting resolv.conf 
> entirely
> and loosing any stuff the user may have entered there...

Yep. your changes seem fine. Thanks for doing that.

-Bruno

Other related posts: