Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1044 from gonzalo-/master
Add OpenBSD share connection script
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/sh | ||
|
|
||
| USB_IFACE=$(ifconfig urndis0 | grep urndis0 | awk '{print $1}' | tr -d ':') | ||
| USB_IP=${2:-10.0.0.1} | ||
|
|
||
| if test $(whoami) != root; then | ||
| doas "$0" "$@" | ||
| exit $? | ||
| fi | ||
|
|
||
| if [ "${USB_IFACE}" == "urndis0" ]; then | ||
| ifconfig ${USB_IFACE} ${USB_IP} | ||
| sysctl -w net.inet.ip.forwarding=1 | ||
| echo "match out on egress inet from ${USB_IFACE}:network to any nat-to (egress:0)" | pfctl -f - | ||
| pfctl -f /etc/pf.conf | ||
| echo "sharing connecting from upstream interface to usb interface ${USB_IFACE} ..." | ||
| else | ||
| echo "can't find usb interface with ip ${USB_IFACE}" | ||
| exit 1 | ||
| fi |