Opened 9 years ago

Closed 9 years ago

#283 closed defect (fixed)

Xfrout uses different socket file than b10-auth when ran from source

Reported by: jreed Owned by: jelte
Priority: medium Milestone:
Component: xfrout Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: 0.0 Add Hours to Ticket:
Total Hours: Internal?: no

Description

When running run_bind.sh in source tree, the socket file is at ./auth_xfrout_conn in the source, but Xfrout wants to use a non-existing file located in the installation prefix:

error handle xfr query /home/reed/opt/bind10/var/auth_xfrout_conn:Fail to send the socket file descriptor to xfrout module
07-Jul-2010 12:52:07.442 Xfrout: ERROR: Failed to receive the file descriptor for XFR connection

Subtickets

Change History (7)

comment:1 Changed 9 years ago by zhanglikun

Hi jeremy, I tested in latest trunk, and didn't find the error mentioned by you. It worked well in source. xfrout and auth share the same socket file ./auth_xfrout_conn.

comment:2 follow-up: Changed 9 years ago by jreed

  • billable set to 0
  • Estimated Difficulty set to 0.0
  • Internal? unset

I still have the problem. I don't see in auth where it is set. As I only see hardcoded: XfroutClient? xfrout_client(UNIX_SOCKET_FILE);

Also the error I get is:
[b10-auth] Error in handling XFR request: socket connect failed: Connection refused

(and an AXFR request results in SERVFAIL.)

comment:3 in reply to: ↑ 2 Changed 9 years ago by zhanglikun

Replying to jreed:

I still have the problem. I don't see in auth where it is set. As I only see hardcoded: XfroutClient? xfrout_client(UNIX_SOCKET_FILE);

What's the problem? is it mean the problem

"When running run_bind.sh in source tree, the socket file is at ./auth_xfrout_conn in the source, but Xfrout wants to use a non-existing file located in the installation prefix:
"

BTW, the socket file wasn't designed as changeable, since it's the communication agreement between auth and xfrout.

Also the error I get is:
[b10-auth] Error in handling XFR request: socket connect failed: Connection refused

(and an AXFR request results in SERVFAIL.)

This is one bug, and it has been catched by ticket #299(see more detail information in that ticket), will fix soon.

comment:4 follow-up: Changed 9 years ago by jelte

The issue here is another one than the one in #299; it's a regression as a result from the changes in changelog item 79 (trac #221, r2565);

(btw, no the socket file should not be changeable by the user, but if we want to run from source we can't rely on having access to whatever is the target directory)

this should fix it:

Index: src/bin/auth/main.cc
===================================================================
--- src/bin/auth/main.cc	(revision 2681)
+++ src/bin/auth/main.cc	(working copy)
@@ -156,7 +156,13 @@
     Session* xfrin_session = NULL;
     bool xfrin_session_established = false; // XXX (see Trac #287)
     ModuleCCSession* config_session = NULL;
-    XfroutClient xfrout_client(UNIX_SOCKET_FILE);
+    std::string xfrout_socket_path;
+    if (getenv("B10_FROM_BUILD")) {
+        xfrout_socket_path = string(getenv("B10_FROM_BUILD")) + "/auth_xfrout_conn";
+    } else {
+        xfrout_socket_path = UNIX_SOCKET_FILE;
+    }
+    XfroutClient xfrout_client(xfrout_socket_path);
     try {
         string specfile;
         if (getenv("B10_FROM_BUILD")) {

comment:5 in reply to: ↑ 4 Changed 9 years ago by jinmei

  • Owner set to jelte
  • Status changed from new to reviewing

Replying to jelte:

The issue here is another one than the one in #299; it's a regression as a result from the changes in changelog item 79 (trac #221, r2565);

(btw, no the socket file should not be changeable by the user, but if we want to run from source we can't rely on having access to whatever is the target directory)

this should fix it:

It basically looks okay. Some minor points:

  • I'd avoid specifying the redundant std:: when we say 'using namespace std'. at least the policy isn't consistent with other cases of this file.
+    std::string xfrout_socket_path;
  • I'd not rely on automatic conversion from a pointer to bolean:
    +    if (getenv("B10_FROM_BUILD")) {
    
    so, it should be:
    +    if (getenv("B10_FROM_BUILD") != NULL) {
    
  • maybe we want to remember getenv("B10_FROM_BUILD") somewhere and use it in the rest of the code:
        const char* ev_from_build = getenv("B10_FROM_BUILD");
        if (ev_from_build != NULL) {
            ....
    
  • technically, we'd avoid letting string generation throw an exception and force the program terminate abruptly. but that also applies to the construction of XfroutClient, so we should probably just live with it at least for now.

comment:6 Changed 9 years ago by jelte

Addressed first two points in the diff, and committed it to trunk; r2705.

comment:7 Changed 9 years ago by jelte

  • Resolution set to fixed
  • Status changed from reviewing to closed

it seems I forgot to close this ticket after I had committed it. Doing so now.

Note: See TracTickets for help on using tickets.