Skip to content

Commit

Permalink
Fix build for macos (semigodking#143)
Browse files Browse the repository at this point in the history
* opensource-apple/xnu removed the version tags

* Use the up-to-date xnu repo: apple/darwin-xnu

* `v4` in pfvar.h is changed to `v4addr`

darkk#75 (comment)

* update macos document url
  • Loading branch information
livelazily authored Mar 10, 2020
1 parent 2b8fe69 commit a11c058
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ base.c: $(CONF)

ifeq ($(OS), Darwin)
$(OSX_HEADERS_PATH)/net/pfvar.h:
mkdir -p $(OSX_HEADERS_PATH)/net && curl -o $(OSX_HEADERS_PATH)/net/pfvar.h https://raw.githubusercontent.com/opensource-apple/xnu/$(OSX_VERSION)/bsd/net/pfvar.h
mkdir -p $(OSX_HEADERS_PATH)/net && curl -o $(OSX_HEADERS_PATH)/net/pfvar.h https://raw.githubusercontent.com/apple/darwin-xnu/master/bsd/net/pfvar.h
$(OSX_HEADERS_PATH)/net/radix.h:
mkdir -p $(OSX_HEADERS_PATH)/net && curl -o $(OSX_HEADERS_PATH)/net/radix.h https://raw.githubusercontent.com/opensource-apple/xnu/$(OSX_VERSION)/bsd/net/radix.h
mkdir -p $(OSX_HEADERS_PATH)/net && curl -o $(OSX_HEADERS_PATH)/net/radix.h https://raw.githubusercontent.com/apple/darwin-xnu/master/bsd/net/radix.h
$(OSX_HEADERS_PATH)/libkern/tree.h:
mkdir -p $(OSX_HEADERS_PATH)/libkern && curl -o $(OSX_HEADERS_PATH)/libkern/tree.h https://raw.githubusercontent.com/opensource-apple/xnu/$(OSX_VERSION)/libkern/libkern/tree.h
mkdir -p $(OSX_HEADERS_PATH)/libkern && curl -o $(OSX_HEADERS_PATH)/libkern/tree.h https://raw.githubusercontent.com/apple/darwin-xnu/master/libkern/libkern/tree.h
endif

$(DEPS): $(OSX_HEADERS) $(SRCS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $ brew install openssl libevent
Makefile include the folder of openssl headers and lib installed by brew.

To build with PF and run on MacOS, you will need some pf headers that are not included with a standard MacOS installation.
You can find them on this repository : https://github.com/opensource-apple/xnu
You can find them on this repository : https://github.com/apple/darwin-xnu
And the Makefile will going find this file for you

Configurations
Expand Down
6 changes: 3 additions & 3 deletions base.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ static int getdestaddr_pf(
char clientaddr_str[INET6_ADDRSTRLEN], bindaddr_str[INET6_ADDRSTRLEN];

memset(&nl, 0, sizeof(struct pfioc_natlook));
nl.saddr.v4.s_addr = client->sin_addr.s_addr;
nl.saddr.v4addr.s_addr = client->sin_addr.s_addr;
nl.sport = client->sin_port;
nl.daddr.v4.s_addr = bindaddr->sin_addr.s_addr;
nl.daddr.v4addr.s_addr = bindaddr->sin_addr.s_addr;
nl.dport = bindaddr->sin_port;
nl.af = AF_INET;
nl.proto = IPPROTO_TCP;
Expand All @@ -219,7 +219,7 @@ static int getdestaddr_pf(
}
destaddr->sin_family = AF_INET;
destaddr->sin_port = nl.rdport;
destaddr->sin_addr = nl.rdaddr.v4;
destaddr->sin_addr = nl.rdaddr.v4addr;
return 0;

fail:
Expand Down

0 comments on commit a11c058

Please sign in to comment.