Opened 10 days ago

Closed 9 days ago

Last modified 9 days ago

#26715 closed defect (fixed)

Tor 85d6b41 on FreeBSD 12-CURRENT: error: use of undeclared identifier 'O_RDWR'

Reported by: neel Owned by: neel
Priority: Medium Milestone: Tor: 0.3.5.x-final
Component: Core Tor Version:
Severity: Normal Keywords: regression, compile-error, 035-must
Cc: Actual Points:
Parent ID: Points:
Reviewer: nickm Sponsor:

Description

When I try to compile Tor 85d6b41 on FreeBSD 12-CURRENT, I get this build error:

neel@xb3:~/code/tor/tor % make
make  all-am
  CC       src/core/or/connection_edge.o
src/core/or/connection_edge.c:2123:36: error: use of undeclared identifier
      'O_RDWR'
  pf = tor_open_cloexec("/dev/pf", O_RDWR, 0);
                                   ^
src/core/or/connection_edge.c:2271:7: warning: implicit declaration of function
      'ioctl' is invalid in C99 [-Wimplicit-function-declaration]
  if (ioctl(pf, DIOCNATLOOK, &pnl) < 0) {
      ^
src/core/or/connection_edge.c:2271:7: warning: this function declaration is not
      a prototype [-Wstrict-prototypes]
src/core/or/connection_edge.c:2271:17: warning: implicit declaration of function
      '_IOWR' is invalid in C99 [-Wimplicit-function-declaration]
  if (ioctl(pf, DIOCNATLOOK, &pnl) < 0) {
                ^
/usr/include/net/pfvar.h:1392:21: note: expanded from macro 'DIOCNATLOOK'
#define DIOCNATLOOK     _IOWR('D', 23, struct pfioc_natlook)
                        ^
src/core/or/connection_edge.c:2271:17: warning: this function declaration is not
      a prototype [-Wstrict-prototypes]
/usr/include/net/pfvar.h:1392:21: note: expanded from macro 'DIOCNATLOOK'
#define DIOCNATLOOK     _IOWR('D', 23, struct pfioc_natlook)
                        ^
src/core/or/connection_edge.c:2271:17: error: expected expression
/usr/include/net/pfvar.h:1392:36: note: expanded from macro 'DIOCNATLOOK'
#define DIOCNATLOOK     _IOWR('D', 23, struct pfioc_natlook)
                                       ^
4 warnings and 2 errors generated.
*** Error code 1

Stop.
make[1]: stopped in /usr/home/neel/code/tor/tor
*** Error code 1

Stop.
make: stopped in /usr/home/neel/code/tor/tor
neel@xb3:~/code/tor/tor %

I will upload a patch for this shortly.

Child Tickets

Attachments (1)

p1 (750 bytes) - added by neel 10 days ago.
Patch which fixes described error, but not IPv6 one

Download all attachments as: .zip

Change History (14)

comment:1 Changed 10 days ago by neel

Status: assignednew

Never mind I won't do this patch.

comment:2 Changed 10 days ago by neel

Priority: MediumImmediate
Severity: NormalBlocker

Changed 10 days ago by neel

Attachment: p1 added

Patch which fixes described error, but not IPv6 one

comment:3 Changed 10 days ago by neel

I have a patch with the filename p1 which fixes the described error, but there is another compile error with IPv6 related code after this patch (I need that patch to get here, this comes after p1):

  CC       src/lib/net/address.o
  CC       src/lib/net/ipv6.o
src/lib/net/ipv6.c:33:13: error: use of undeclared identifier 'AF_INET'
  if (af == AF_INET) {
            ^
src/lib/net/ipv6.c:38:20: error: use of undeclared identifier 'AF_INET6'
  } else if (af == AF_INET6) {
                   ^
src/lib/net/ipv6.c:45:34: error: incomplete definition of type 'struct in6_addr'
      words[i] = (((uint16_t)addr->s6_addr[2*i])<<8) + addr->s6_addr[2*i+1];
                             ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:45:60: error: incomplete definition of type 'struct in6_addr'
      words[i] = (((uint16_t)addr->s6_addr[2*i])<<8) + addr->s6_addr[2*i+1];
                                                       ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:53:26: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[12], addr->s6_addr[13],
                     ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:53:45: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[12], addr->s6_addr[13],
                                        ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:54:26: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[14], addr->s6_addr[15]);
                     ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:54:45: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[14], addr->s6_addr[15]);
                                        ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:57:26: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[12], addr->s6_addr[13],
                     ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:57:45: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[12], addr->s6_addr[13],
                                        ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:58:26: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[14], addr->s6_addr[15]);
                     ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:58:45: error: incomplete definition of type 'struct in6_addr'
                     addr->s6_addr[14], addr->s6_addr[15]);
                                        ~~~~^
src/lib/net/ipv6.c:39:18: note: forward declaration of 'struct in6_addr'
    const struct in6_addr *addr = src;
                 ^
src/lib/net/ipv6.c:122:13: error: use of undeclared identifier 'AF_INET'
  if (af == AF_INET) {
            ^
src/lib/net/ipv6.c:124:20: error: use of undeclared identifier 'AF_INET6'
  } else if (af == AF_INET6) {
                   ^
src/lib/net/ipv6.c:213:10: error: incomplete definition of type
      'struct in6_addr'
      out->s6_addr[2*i  ] = words[i] >> 8;
      ~~~^
src/lib/net/ipv6.c:125:12: note: forward declaration of 'struct in6_addr'
    struct in6_addr *out = dst;
           ^
src/lib/net/ipv6.c:214:10: error: incomplete definition of type
      'struct in6_addr'
      out->s6_addr[2*i+1] = words[i] & 0xff;
      ~~~^
src/lib/net/ipv6.c:125:12: note: forward declaration of 'struct in6_addr'
    struct in6_addr *out = dst;
           ^
16 errors generated.
*** Error code 1

Stop.
make[1]: stopped in /usr/home/neel/code/tor/tor
*** Error code 1

Stop.
make: stopped in /usr/home/neel/code/tor/tor
neel@xb3:~/code/tor/tor %

It seems the refactor has made compilation problems for *BSD.

comment:4 Changed 10 days ago by neel

Owner: neel deleted
Status: newassigned

comment:5 Changed 10 days ago by neel

Status: assignednew

comment:6 Changed 10 days ago by teor

Keywords: regression compile-error added
Milestone: Tor: 0.3.5.x-final
Priority: ImmediateMedium
Severity: BlockerNormal

comment:7 Changed 10 days ago by teor

Keywords: 035-must added

comment:8 Changed 10 days ago by nickm

If you don't have time to do a full patch, could you run "make -k" and attach the entire output as a file? That would make a fix much easier.

comment:9 Changed 10 days ago by neel

Cc: neel@… removed
Owner: set to neel
Status: newassigned

Sorry to change my mind again, but I decided that I will do a full patch. I hope to have something by the end of the day.

comment:11 Changed 9 days ago by nickm

Reviewer: nickm
Status: assignedneeds_review

comment:12 Changed 9 days ago by nickm

Status: needs_reviewmerge_ready

LGTM; I can merge this as soon as my branch for #26526 and #26532 is merged. (I'm expecting a small conflict, but it should be easy enough to resolve.

comment:13 Changed 9 days ago by nickm

Resolution: fixed
Status: merge_readyclosed

I've merged this. I had to resolve a conflict, since one of the files you patched just changed its name: please reopen if the merged patch doesn't fix the issue.

Note: See TracTickets for help on using tickets.