Page MenuHomeFreeBSD

resolver: preserve binary compatibility; reduce header pollution
ClosedPublic

Authored by vangyzen on Dec 9 2015, 4:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 3 2024, 10:35 AM
Unknown Object (File)
Sep 29 2024, 11:05 PM
Unknown Object (File)
Sep 29 2024, 11:05 PM
Unknown Object (File)
Sep 29 2024, 11:05 PM
Unknown Object (File)
Sep 29 2024, 11:05 PM
Unknown Object (File)
Sep 29 2024, 11:05 PM
Unknown Object (File)
Sep 29 2024, 11:01 PM
Unknown Object (File)
Sep 27 2024, 2:08 AM
Subscribers

Details

Summary

In r289315, I added new fields to res_state. This broke binary
backward compatibility. It also broke some ports (and possibly
other code) by requiring the definition of time_t and struct timespec.

Fix these problems by moving the new fields into __res_state_ext.

Suggested by: ume
MFC after: 1 week
Sponsored by: Dell Inc.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 1533
Build 1539: arc lint + arc unit

Event Timeline

vangyzen retitled this revision from to resolver: preserve binary compatibility; reduce header pollution.
vangyzen updated this object.
vangyzen added a reviewer: ume.

Could you move reload_period as well? We should not touch struct __res_state as much as possible to ease merging further upstream changes.

vangyzen edited edge metadata.

Move reload_period into __res_ext_state, too.

include/resolv.h has returned to its r269867 state.

lib/libc/resolv/res_init.c
685

You need to check if statp->_u._ext.ext is not NULL before set a value to reload_period.

Check for NULL ext pointer in one case I missed.

lib/libc/resolv/res_init.c
684–686

Indeed. Thank you.

There are some codes in res_setoptions() which touch statp->_u._ext.ext but we disabled them. I think it is better to do something like following in res_setoptions():

@@ -599,9 +595,7 @@
 {
        const char *cp = options;
        int i;
-#ifndef _LIBC
        struct __res_state_ext *ext = statp->_u._ext.ext;
-#endif

 #ifdef DEBUG
        if (statp->options & RES_DEBUG)
@@ -686,8 +680,10 @@
                        statp->options |= RES_NOCHECKNAME;
                } else if (!strncmp(cp, "reload-period:",
                                    sizeof("reload-period:") - 1)) {
-                       statp->reload_period = (u_short)
-                               atoi(cp + sizeof("reload-period:") - 1);
+                       if (ext != NULL) {
+                               ext->reload_period = (u_short)
+                                   atoi(cp + sizeof("reload-period:") - 1);
+                       }
                }
 #ifdef RES_USE_EDNS0
                else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {

It seems you forgot to include the diff for resolv.h in you.

Oops, I have submitted it accidentally at the middle. X-(
It seems you forgot to include the diff for resolv.h in your previous patch.
Other than that, it seems good to me.

Pull ext into a local variable.

Upload the diff for resolv.h. Oops.

ume edited edge metadata.
This revision is now accepted and ready to land.Dec 14 2015, 4:43 PM
This revision was automatically updated to reflect the committed changes.