Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inbound TCP/IP support #96

Open
mwvaughn opened this issue Mar 12, 2021 · 11 comments
Open

Inbound TCP/IP support #96

mwvaughn opened this issue Mar 12, 2021 · 11 comments

Comments

@mwvaughn
Copy link

mwvaughn commented Mar 12, 2021

Basic Information

  • Platform (Mac, iOS, Android, Linux, etc): Mac
  • Built from source? (yes/no): No
    • If yes, source branch/revision ID:
    • If no, release version: 2020.4.1

Description of issue

I've managed to get the PCMCIA networking stack running for accessing the Internet from my emulated Newton, but I am unable to access services running on the Newton from my localhost. Specifically, I am trying to get an NPDS server running under Einstein. Specifically, I get a connection refused error when I try to access my Newton's nascent HTTP server.

Expected behaviour

I am able to visit http://localhost:8080 (which is what I have the NPDS server configured to use) and receive a response.

Steps to reproduce issue

  1. Install network packages
  2. Configure Internet to use host IP, mask, and DNS with PCMCIA Ethernet Card
  3. Install NPDS and configure it to use port 8080
  4. Start the NPDS server
  5. Visit http://localhost:8080 in a browser
@MatthiasWM
Copy link
Collaborator

The current version has no inbound TCP/IP support. Sorry.

@mwvaughn
Copy link
Author

Thanks, Matthias. I'm one of the original NPDS devs and I was hoping (against all odds) for a miracle on this front!

@MatthiasWM
Copy link
Collaborator

I'll check if it is possible to implement this. No promises ;-)

@pguyot
Copy link
Owner

pguyot commented Mar 15, 2021

Hello @mwvaughn!
I think at some point I tried and got something to work, maybe when I worked on SSL. I'll have a look now that @MatthiasWM has merged his work into the master branch.

@mwvaughn
Copy link
Author

Awesome! I am happy to test any time.

@pguyot
Copy link
Owner

pguyot commented Mar 15, 2021

I confirm it does work, using documentation from 2010 and some help from an article about getting similar results with qemu :-)

Screenshot 2021-03-15 at 22 50 08

To get this working in 2021 on an Intel mac running BigSur, I had to:

  1. Install tap & tun kernel extensions, notarized, from https://github.com/Tunnelblick/Tunnelblick/tree/master/third_party
    (this is the bit that wouldn't work on M1 Mac, I guess)
  • Copied .kext to /Library/Extensions
  • Fixed them with chown -R 0:0
  • Loaded them with
cd /Library/Extensions/
sudo kextload tap-notarized.kext
  • Restarted, gave permissions in System preferences.

  • Loaded them again with

cd /Library/Extensions/
sudo kextload tap-notarized.kext
  1. Fix permissions as per 2010 doc:
sudo chmod ugo+rw /dev/tap0
  1. Create a bridge interface:
sudo ifconfig bridge1 create
sudo ifconfig bridge1 192.168.100.1/24
sudo ifconfig bridge1 addm en0
  1. Configure pf (instead of ipfw in 2010):
echo "nat on en0 from bridge1:network to any -> (en0)" > pf-config
sudo pfctl -F all
sudo pfctl -f pf-config 
  1. Configure and start the DHCP server
    Create /etc/bootpd.list with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>bootp_enabled</key>
        <false/>
        <key>dhcp_enabled</key>
        <array>
            <string>bridge1</string>
        </array>
        <key>netboot_enabled</key>
        <false/>
        <key>relay_enabled</key>
        <false/>
        <key>Subnets</key>
        <array>
            <dict>
                <key>name</key>
                <string>VM NAT Network (192.168.100.0/24)</string>
                <key>net_mask</key>
                <string>255.255.255.0</string>
                <key>net_address</key>
                <string>192.168.100.0</string>
                <key>net_range</key>
                <array>
                    <string>192.168.100.2</string>
                    <string>192.168.100.254</string>
                </array>
                <key>allocate</key>
                <true/>
                <key>dhcp_router</key>
                <string>192.168.100.1</string>
                <key>dhcp_domain_name_server</key>
                <array>
                    <string>8.8.8.8</string>
                </array>
            </dict>
        </array>
    </dict>
</plist>

Start the server in foreground with:

sudo /usr/libexec/bootpd -D -d
  1. Start Einstein (master branch, after Steve's latest commit)
  2. Select the TAP Network driver
  3. Configure the other end of the bridge interface with:
sudo ifconfig bridge1 addm tap0
  1. Install the 5 Internet packages on Einstein, configure Internet connection, experience a bug with the PCMCIA network card producing a -48807. Install NPDS package as well as GIF Server.

  2. Connect with Safari on the IP address provided by the DHCP server (192.168.1.20).

Now, we can keep this ticket open for a long-term goal that would be to get Internet servers available in user-mode networking. Something emulators usually perform by defining a port mapping (you tell the emulator to listen on port X and forward to port Y to the guest).

@MatthiasWM
Copy link
Collaborator

MatthiasWM commented Mar 15, 2021 via email

@INDIGI-CO-UK
Copy link

INDIGI-CO-UK commented Mar 16, 2021 via email

@pguyot
Copy link
Owner

pguyot commented Mar 16, 2021

Yes, it does work, and it probably has been working since 2010.

@INDIGI-CO-UK
Copy link

What is the current state of this ticket? Do I still need to do that 'magic' things from Paul's post in MacOS to make NPDS work 'both ways' or is it now implemented in the new version of Einstein?

@MatthiasWM
Copy link
Collaborator

Incoming TCP connections work on what I can the "native" or "cocoa" version of Einstein on macOS. It does require installing all the drivers that Paul listed up here.

I will leave this open until I have a chance to copy Paul's comments somewhere into the documentation.

The FLTK version of Einstein will not honour incoming requests, and there is no plan to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants