File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -852,10 +852,6 @@ def _token_changed(self, change):
852852 @default ('allow_remote_access' )
853853 def _default_allow_remote (self ):
854854 """Disallow remote access if we're listening only on loopback addresses"""
855- # Disable the check temporarily because of Mac issues:
856- # https://github.com/jupyter/notebook/issues/3754
857- return True
858-
859855 try :
860856 addr = ipaddress .ip_address (self .ip )
861857 except ValueError :
@@ -864,7 +860,18 @@ def _default_allow_remote(self):
864860 addr = info [4 ][0 ]
865861 if not py3compat .PY3 :
866862 addr = addr .decode ('ascii' )
867- if not ipaddress .ip_address (addr ).is_loopback :
863+
864+ try :
865+ parsed = ipaddress .ip_address (addr .split ('%' )[0 ])
866+ except ValueError :
867+ self .log .warning ("Unrecognised IP address: %r" , addr )
868+ continue
869+
870+ # Macs map localhost to 'fe80::1%lo0', a link local address
871+ # scoped to the loopback interface. For now, we'll assume that
872+ # any scoped link-local address is effectively local.
873+ if not (parsed .is_loopback
874+ or (('%' in addr ) and parsed .is_link_local )):
868875 return True
869876 return False
870877 else :
You can’t perform that action at this time.
0 commit comments