ports/core (2.3): netkit-base: split into iana-etc/inetd
commit e884d88f8622656a9fa2832ee5f39141de23c676 Author: Simone Rota <sip@crux.nu> Date: Wed Feb 21 02:55:11 2007 +0100 netkit-base: split into iana-etc/inetd diff --git a/iana-etc/.footprint b/iana-etc/.footprint new file mode 100644 index 0000000..d1dad6e --- /dev/null +++ b/iana-etc/.footprint @@ -0,0 +1,3 @@ +drwxr-xr-x root/root etc/ +-rw-r--r-- root/root etc/protocols +-rw-r--r-- root/root etc/services diff --git a/iana-etc/.md5sum b/iana-etc/.md5sum new file mode 100644 index 0000000..80ec1cc --- /dev/null +++ b/iana-etc/.md5sum @@ -0,0 +1,2 @@ +b32c83ae6886e0525995f7028b2c2967 protocols +d546c1eaab6b990b739cb9f918be4bd4 services diff --git a/iana-etc/Pkgfile b/iana-etc/Pkgfile new file mode 100644 index 0000000..b8c6daa --- /dev/null +++ b/iana-etc/Pkgfile @@ -0,0 +1,13 @@ +# Description: Services and protocols files for /etc +# URL: http://www.iana.org/ +# Maintainer: CRUX System Team, core-ports at crux dot nu + +name=iana-etc +version=2.3 +release=1 +source=(services protocols) + +build() { + mkdir -m 755 $PKG/etc + install -m 644 {services,protocols} $PKG/etc +} diff --git a/iana-etc/protocols b/iana-etc/protocols new file mode 100644 index 0000000..becf37f --- /dev/null +++ b/iana-etc/protocols @@ -0,0 +1,147 @@ +# $NetBSD: protocols,v 1.12.4.1 2006/12/02 12:58:19 bouyer Exp $ +# +# Internet (IP) protocols +# +# originally from: @(#)protocols 8.1 (Berkeley) 6/9/93 +# see http://www.iana.org/assignments/protocol-numbers +# +ip 0 IP # internet protocol, pseudo protocol number +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # internet group management protocol +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +cbt 7 CBT +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway protocol +bbn-rcc-mon 10 BBN-RCC-MON # BBN RCC Monitoring +nvp-ii 11 NVP-II # Network Voice Protocol +pup 12 PUP # PARC universal packet protocol +argus 13 ARGUS +emcon 14 EMCON +xnet 15 XNET # Cross net debugger +chaos 16 CHAOS # Chaos +udp 17 UDP # user datagram protocol +mux 18 MUX # Multiplexing +dcn-meas 19 DCN-MEAS # DCN Measurement Subsystems +hmp 20 HMP # host monitoring protocol +prm 21 PRM # Packet Radio Measurement +xns-idp 22 XNS-IDP # Xerox NS IDP +trunk-1 23 TRUNK-1 +trunk-2 24 TRUNK-2 +leaf-1 25 LEAF-1 +leaf-2 26 LEAF-2 +rdp 27 RDP # reliable data protocol +irtp 28 IRTP # Internet Reliable Transaction +iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4 +netblt 30 NETBLT # Bulk Data Transfer Protocol +mfe-nsp 31 MFE-NSP # MFE Network Services Protocol +merit-inp 32 MERIT-INP # MERIT Internodal Protocol +sep 33 SEP # Sequential Exchange Protocol +3pc 34 3PC # Third Party Connect Protocol +idpr 35 IDPR # Inter-Domain Policy Routing Protocol +xtp 36 XTP # Xpress Transfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport +tp++ 39 TP++ # TP++ Transport Protocol +il 40 IL # IL Transport Protocol +ipv6 41 IPv6 # Internet Protocol, version 6 +sdrp 42 SDRP # Source Demand Routing Protocol +ipv6-route 43 IPv6-Route # Routing Header for IPv6 +ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Resource ReSerVation Protocol +gre 47 GRE # General Routing Encapsulation +mhrp 48 MHRP # Mobile Host Routing Protocol +bna 49 BNA +esp 50 ESP # Encapsulating Security Payload +ah 51 AH # Authentication Header +i-nlsp 52 I-NLSP # Integrated Net Layer Security +swipe 53 SWIPE # IP with Encryption +narp 54 NARP # NBMA Address Resolution Protocol +mobile 55 MOBILE # IP Mobility (IP tunneling) +tlsp 56 TLSP # Transport Layer Security Protocol +skip 57 SKIP +ipv6-icmp 58 IPv6-ICMP icmp6 # ICMP version 6 +ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 +ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 +# 61 # any host internal protocol +cftp 62 CFTP # CFTP +# 63 # any local network +sat-expak 64 SAT-expak # SATNET and Backroom EXPAK +kryptolan 65 KRYPTOLAN # Kryptolan +rvd 66 RVD # MIT Remote Virtual Disk Protocol +ippc 67 IPPC # Internet Pluribus Packet Core +# 68 # any distributed file system +sat-mon 69 SAT-MON # SATNET Monitoring +visa 70 VISA # VISA Protocol +ipcv 71 IPCV # Internet Packet Core Utility +cpnx 72 CPNX # Computer Protocol Network Executive +cphb 73 CPHB # Computer Protocol Heart Beat +wsn 74 WSN # Wang Span Network +pvp 75 PVP # Packet Video Protocol +br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring +sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary +wb-mon 78 WB-MON # WIDEBAND Monitoring +wb-expak 79 WB-EXPAK # WIDEBAND EXPAK +iso-ip 80 ISO-IP # ISO Internet Protocol +vmtp 81 VMTP # Versatile Message Transport +secure-vmtp 82 SECURE-VMTP # SECURE-VMTP +vines 83 VINES +ttp 84 TTP +nsfnet-igp 85 NSFNET-IGP +dgp 86 DGP # Dissimilar Gateway Protocol +tcf 87 TCF +eigrp 88 EIGRP # Enhanced Inter-Gateway Routing Protocol +ospf 89 OSPFIGP # Open Shortest Path First IGP +sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol +larp 91 LARP # Locus Address Resolution Protocol +mtp 92 MTP # Multicast Transport Protocol +ax.25 93 AX.25 # AX.25 Frames +ipip 94 IPIP # Yet Another IP encapsulation +micp 95 MICP # Mobile Internetworking Control Pro. +scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro. +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation +encap 98 ENCAP # RFC1241 encapsulation +# 99 # any private encryption scheme +gmtp 100 GMTP +ifmp 101 IFMP # Ipsilon Flow Management Protocol +pnni 102 PNNI # PNNI over IP +pim 103 PIM # Protocol Independent Multicast +aris 104 ARIS +scps 105 SCPS +qnx 106 QNX +a/n 107 A/N # Active Networks +ipcomp 108 IPCOMP # IP Payload Compression Protocol +snp 109 SNP # Sitara Networks Protocol +compaq-peer 110 Compaq-Peer # Compaq Peer Protocol +ipx-in-ip 111 IPX-in-IP # IPX in IP +carp 112 CARP vrrp # Virtual Router Redundancy Protocol +pgm 113 PGM # PGM Reliable Transport Protocol +# 114 # any 0-hop protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol +ddx 116 DDX # D-II Data Exchange (DDX) +iatp 117 IATP # Interactive Agent Transfer Protocol +stp 118 STP # Schedule Transfer Protocol +srp 119 SRP # SpectraLink Radio Protocol +uti 120 UTI +smp 121 SMP # Simple Message Protocol +sm 122 SM +ptp 123 PTP # Performance Transparency Protocol +isis 124 ISIS # IS-IS over IPv4 +fire 125 FIRE +crtp 126 CRTP # Combat Radio Transport Protocol +crudp 127 CRUDP # Combat Radio User Datagram +sscopmce 128 SSCOPMCE +iplt 129 IPLT +sps 130 SPS # Secure Packet Shield +pipe 131 PIPE # Private IP Encapsulation within IP +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel +rsvp-e2e-ignore 134 RSVP-E2E-IGNORE +mobility-header 135 MOBILITY-HEADER # Mobility Header +udplite 136 UDPLite +mpls-in-ip 137 MPLS-in-IP # MPLS in IP +# 138-254 # Unassigned +# 255 # Reserved diff --git a/iana-etc/services b/iana-etc/services new file mode 100644 index 0000000..f3d1461 --- /dev/null +++ b/iana-etc/services @@ -0,0 +1,384 @@ +# $NetBSD: services,v 1.84 2007/02/10 19:39:02 reed Exp $ +# +# Network services, Internet style +# +# Note that it is presently the policy of IANA to assign a single well-known +# port number for both TCP and UDP; hence, most entries here have two entries +# even if the protocol doesn't support UDP operations. +# Updated from RFC 1340, ``Assigned Numbers'' (July 1992). Not all ports +# are included, only the more common ones. +# The latest IANA list is available from: +# http://www.iana.org/assignments/port-numbers +# +# from: @(#)services 8.2 (Berkeley) 3/26/95 +# +tcpmux 1/tcp # TCP port multiplexer (RFC1078) +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +msp 18/tcp # message send protocol +msp 18/udp +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp # default ftp data port +ftp 21/tcp # File Transfer Protocol +ssh 22/tcp # Secure Shell +ssh 22/udp +telnet 23/tcp +# 24 - private +smtp 25/tcp mail +# 26 - unassigned +time 37/tcp timserver +time 37/udp timserver +rlp 39/udp resource # resource location +nameserver 42/tcp name # IEN 116 +whois 43/tcp nicname +tacacs 49/tcp # Login Host Protocol (TACACS) +tacacs 49/udp # Login Host Protocol (TACACS) +domain 53/tcp # name-domain server +domain 53/udp +mtp 57/tcp # deprecated +bootps 67/tcp # BOOTP server +bootps 67/udp +bootpc 68/tcp # BOOTP client +bootpc 68/udp +tftp 69/udp # Trivial File Transfer Protocol +gopher 70/tcp # Internet Gopher +gopher 70/udp +rje 77/tcp netrjs +finger 79/tcp +http 80/tcp www www-http # WorldWideWeb HTTP +http 80/udp www www-http # HyperText Transfer Protocol +link 87/tcp ttylink +kerberos 88/tcp krb5 # Kerberos v5 +kerberos 88/udp +supdup 95/tcp +# 100 - reserved +hostnames 101/tcp hostname # usually from sri-nic +iso-tsap 102/tcp tsap # part of ISODE. +csnet-ns 105/tcp cso-ns # also used by CSO name server +csnet-ns 105/udp cso-ns +poppass 106/tcp poppassd +rtelnet 107/tcp # Remote Telnet +rtelnet 107/udp +pop2 109/tcp postoffice # POP version 2 +pop2 109/udp +pop3 110/tcp # POP version 3 +pop3 110/udp +sunrpc 111/tcp rpcbind # Remote Procedure Call +sunrpc 111/udp rpcbind +auth 113/tcp authentication tap ident +sftp 115/tcp +uucp-path 117/tcp +sqlserv 118/tcp # SQL Services +nntp 119/tcp readnews untp # USENET News Transfer Protocol +erpc 121/udp # Encore Expedited Remote Pro.Call +ntp 123/tcp +ntp 123/udp # Network Time Protocol +netbios-ns 137/tcp # NETBIOS Name Service +netbios-ns 137/udp +netbios-dgm 138/tcp # NETBIOS Datagram Service +netbios-dgm 138/udp +netbios-ssn 139/tcp # NETBIOS session service +netbios-ssn 139/udp +imap 143/tcp imap2 imap4 # Internet Message Access Protocol +imap 143/udp imap2 imap4 +snmp 161/udp # Simple Net Mgmt Proto +snmp-trap 162/udp snmptrap # Traps for SNMP +cmip-man 163/tcp # ISO mgmt over IP (CMOT) +cmip-man 163/udp +cmip-agent 164/tcp +cmip-agent 164/udp +mailq 174/tcp # zmailer MTA +xdmcp 177/tcp # X Display Mgr. Control Proto +xdmcp 177/udp +nextstep 178/tcp NeXTStep NextStep # NeXTStep window +nextstep 178/udp NeXTStep NextStep # server +bgp 179/tcp # Border Gateway Proto. +bgp 179/udp +prospero 191/tcp # Cliff Neuman's Prospero +prospero 191/udp +irc 194/tcp # Internet Relay Chat +irc 194/udp +smux 199/tcp # SNMP Unix Multiplexer +smux 199/udp +at-rtmp 201/tcp # AppleTalk routing +at-rtmp 201/udp +at-nbp 202/tcp # AppleTalk name binding +at-nbp 202/udp +at-echo 204/tcp # AppleTalk echo +at-echo 204/udp +at-zis 206/tcp # AppleTalk zone information +at-zis 206/udp +z3950 210/tcp wais # NISO Z39.50 database +z3950 210/udp wais +ipx 213/tcp # IPX +ipx 213/udp +imap3 220/tcp # Interactive Mail Access +imap3 220/udp # Protocol v3 +rsh-spx 222/tcp # Berkeley rshd with SPX auth +ulistserv 372/tcp # UNIX Listserv +ulistserv 372/udp +nip 376/tcp # Amiga Envoy Net Inquiry Prot. +nip 376/udp # Amiga Envoy Net Inquiry Prot. +ldap 389/tcp # Lightweight Directory Access Protocol +ldap 389/udp # Lightweight Directory Access Protocol +imsp 406/tcp # Interactive Mail Support Protocol +imsp 406/udp # Interactive Mail Support Protocol +microsoft-ds 445/tcp # Microsoft-DS +microsoft-ds 445/udp # Microsoft-DS +isakmp 500/tcp # IPsec Key Management (ISAKMP/Oakley) +isakmp 500/udp # IPsec Key Management (ISAKMP/Oakley) +ripng 521/tcp # RIP for IPv6 +ripng 521/udp # RIP for IPv6 +submission 587/tcp # Message Submission +submission 587/udp # Message Submission +acap 674/tcp # Application Configuration Access Protocol +acap 674/udp # Application Configuration Access Protocol +silc 706/tcp # Secure Internet Live Conferencing +silc 706/udp # Secure Internet Live Conferencing +iscsi-rfc 860/tcp # RFC port used by iSCSI targets + +# +# UNIX specific services +# +exec 512/tcp # Remote execution +biff 512/udp comsat # Biff the dog +login 513/tcp # Remote login +who 513/udp whod # Remote who +shell 514/tcp cmd # Remote command shell +syslog 514/udp # System logger +printer 515/tcp spooler # line printer spooler +talk 517/udp # Talk protocols +ntalk 518/udp +route 520/udp router routed # RIP +timed 525/udp timeserver +tempo 526/tcp newdate +courier 530/tcp rpc +conference 531/tcp chat +netnews 532/tcp +netwall 533/udp # -for emergency broadcasts +uucp 540/tcp uucpd # uucp daemon +rdist 541/tcp rdistd # rdist daemon +afpovertcp 548/tcp # AppleshareIP protocol +afpovertcp 548/udp # AppleshareIP protocol +remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem +# +webster 765/tcp # Network dictionary +webster 765/udp +rsync 873/tcp # rsync +rsync 873/udp # rsync + +# +# Various SSL services +# +https 443/tcp # http protocol over TLS/SSL +https 443/udp # http protocol over TLS/SSL +smtps 465/tcp # smtp protocol over TLS/SSL +smtps 465/udp # smtp protocol over TLS/SSL +nntps 563/tcp # nntp protocol over TLS/SSL (was snntp) +nntps 563/udp # nntp protocol over TLS/SSL (was snntp) +ldaps 636/tcp # ldap protocol over TLS/SSL (was sldap) +ldaps 636/udp # ldap protocol over TLS/SSL (was sldap) +ftps-data 989/tcp # ftp protocol, data, over TLS/SSL +ftps-data 989/udp # ftp protocol, data, over TLS/SSL +ftps 990/tcp # ftp protocol, control, over TLS/SSL +ftps 990/udp # ftp protocol, control, over TLS/SSL +telnets 992/tcp # telnet protocol over TLS/SSL +telnets 992/udp # telnet protocol over TLS/SSL +imaps 993/tcp # imap4 protocol over TLS/SSL +imaps 993/udp # imap4 protocol over TLS/SSL +ircs 994/tcp # irc protocol over TLS/SSL +ircs 994/udp # irc protocol over TLS/SSL +pop3s 995/tcp # pop3 protocol over TLS/SSL (was spop3) +pop3s 995/udp # pop3 protocol over TLS/SSL (was spop3) + +# +# From ``Assigned Numbers'': +# +#> The Registered Ports are not controlled by the IANA and on most systems +#> can be used by ordinary user processes or programs executed by ordinary +#> users. +# +#> Ports are used in the TCP [45,106] to name the ends of logical +#> connections which carry long term conversations. For the purpose of +#> providing services to unknown callers, a service contact port is +#> defined. This list specifies the port used by the server process as its +#> contact port. While the IANA can not control uses of these ports it +#> does register or list uses of these ports as a convenience to the +#> community. +# +ingreslock 1524/tcp +ingreslock 1524/udp +prospero-np 1525/tcp # Prospero non-privileged +prospero-np 1525/udp +radius 1812/tcp +radius 1812/udp +radius-acct 1813/tcp radacct +radius-acct 1813/udp radacct +cvspserver 2401/tcp +cvspserver 2401/udp +isns 3205/tcp # iSNS server port +isns 3205/udp # iSNS server port +iscsi 3260/tcp # Draft port used by iSCSI targets + # Will be moved to 860 after RFC + # is published +iscsi-target 3260/tcp # Draft port used by iSCSI targets +mysql 3306/tcp # MySQL +mysql 3306/udp # MySQL +svn 3690/tcp # Subversion +svn 3690/udp # Subversion +rfe 5002/tcp # Radio Free Ethernet +rfe 5002/udp # Actually uses UDP only +sip 5060/tcp # SIP +sip 5060/udp # SIP +postgresql 5432/tcp # PostgreSQL Database +postgresql 5432/udp # PostgreSQL Database + +# +# Kerberos (Project Athena/MIT) services +# (note that kerberos @ port 88 is sorted in the list above) +# +kpasswd 464/udp # Kerberos password changing protocol +kpasswd 464/tcp # Kerberos password changing protocol +klogin 543/tcp # Kerberos `rlogin' +kshell 544/tcp krcmd # Kerberos `rsh' +ekshell 545/tcp # Encrypted kshell +kerberos-adm 749/tcp # Kerberos `kadmin' (v5) +kerberos-iv 750/udp kdc kerberos4 # Kerberos (server) udp +kerberos-iv 750/tcp kdc kerberos4 # Kerberos (server) tcp +kerberos-master 751/udp # Kerberos admin server udp +kerberos-master 751/tcp # Kerberos admin server tcp +hprop 754/tcp # Heimdal KDC database propagation +krbupdate 760/tcp kreg # BSD Kerberos registration +kpwd 761/tcp # old BSD Kerberos `passwd' + # (formerly `kpasswd') +kpop 1109/tcp # Kerberos POP server +eklogin 2105/tcp # Kerberos encrypted `rlogin' +ekshell2 2106/tcp # Encrypted kshell - UColorado, Boulder +krb524 4444/udp # krb5 -> krb4 ticket conversion + +# +# AFS services +# +# IANA has these registered as both UDP and TCP, but only the UDP +# ports are used by the protocol +# +afs3-fileserver 7000/tcp # file server itself +afs3-fileserver 7000/udp # file server itself +afs3-callback 7001/tcp # callbacks to cache managers +afs3-callback 7001/udp # callbacks to cache managers +afs3-prserver 7002/tcp # users & groups database +afs3-prserver 7002/udp # users & groups database +afs3-vlserver 7003/tcp # volume location database +afs3-vlserver 7003/udp # volume location database +afs3-kaserver 7004/tcp # AFS/Kerberos authentication service +afs3-kaserver 7004/udp # AFS/Kerberos authentication service +afs3-volser 7005/tcp # volume management server +afs3-volser 7005/udp # volume management server +afs3-errors 7006/tcp # error interpretation service +afs3-errors 7006/udp # error interpretation service +afs3-bos 7007/tcp # basic overseer process +afs3-bos 7007/udp # basic overseer process +afs3-update 7008/tcp # server-to-server updater +afs3-update 7008/udp # server-to-server updater +afs3-rmtsys 7009/tcp # remote cache manager service +afs3-rmtsys 7009/udp # remote cache manager service +afs3-resserver 7010/tcp # MR-AFS residence server +afs3-resserver 7010/udp # MR-AFS residence server +afs3-remio 7011/tcp # MR-AFS remote IO server +afs3-remio 7011/udp # MR-AFS remote IO server + +# +# Unofficial but necessary (for NetBSD) services +# +supfilesrv 871/tcp # SUP server +supfiledbg 1127/tcp # SUP debugging + +# +# other common ports +# +swat 901/tcp # Samba Web Administration Tool +sieve 2000/tcp # RFC3028 +lmtp 2003/tcp # Local Mail Transfer Protocol +nfs 2049/udp nfsd # Sun NFS +nfs 2049/tcp nfsd # Sun NFS +suucp 4031/tcp # UUCP over SSL +suucp 4031/udp # UUCP over SSL +fud 4201/udp # Cyrus IMAP finger-like service +X11 6000/tcp # X Window System +ircd 6667/tcp # Often used IRC port (also see 194) +sstp-2 9801/tcp # Sakura Script Transfer Protocol-2 +sstp-2 9801/udp # Sakura Script Transfer Protocol-2 +amanda 10080/udp # Amanda +kamanda 10081/udp # Amanda with Kerberos +amandaidx 10082/tcp # Amanda index server +amidxtape 10083/tcp # Amanda dump image server +italk 12345/tcp # Italk Chat System +italk 12345/udp # Italk Chat System +hunt 26740/udp # multi-player/multi-host maze-wars + +# +# Netatalk (in-kernel Appletalk) services +# Note: The running kernel must be configured with "options NETATALK" +# and software not included in NetBSD, such as Netatalk version 1.4b2 +# or later, must be used to take advantage of these services. +# +rtmp 1/ddp # Routing Table Maintenance Protocol +nbp 2/ddp # Name Binding Protocol +echo 4/ddp # AppleTalk Echo Protocol +zip 6/ddp # Zone Information Protocol + +# Iana registered Coda filesystem port numbers +rpc2portmap 369/tcp +rpc2portmap 369/udp # Coda portmapper +codaauth2 370/tcp +codaauth2 370/udp # Coda authentication server + +# Iana registered dict port numbers +dict 2628/tcp # DICT +dict 2628/udp + +venus 2430/tcp # codacon port +venus 2430/udp # Venus callback/wbc interface +venus-se 2431/tcp # tcp side effects +venus-se 2431/udp # udp sftp side effect +codasrv 2432/tcp # not used +codasrv 2432/udp # server port +codasrv-se 2433/tcp # tcp side effects +codasrv-se 2433/udp # udp sftp side effect + +# Iana registered ports commonly found in security logs +epmap 135/tcp # DCE endpoint resolution +epmap 135/udp # DCE endpoint resolution +rtsp 554/tcp # Real Time Stream Control Protocol +rtsp 554/udp # Real Time Stream Control Protocol +socks 1080/tcp # Socks +socks 1080/udp # Socks +kazaa 1214/tcp # KAZAA +kazaa 1214/udp # KAZAA +ms-sql-s 1433/tcp # Microsoft-SQL-Server +ms-sql-s 1433/udp # Microsoft-SQL-Server +ms-sql-m 1434/tcp # Microsoft-SQL-Monitor +ms-sql-m 1434/udp # Microsoft-SQL-Monitor +ms-wbt-server 3389/tcp # MS WBT Server +ms-wbt-server 3389/udp # MS WBT Server +terabase 4000/tcp icq # used for both Terabase and ICQ +terabase 4000/udp icq # used for both Terabase and ICQ +radmin-port 4899/tcp # RAdmin Port +radmin-port 4899/udp # RAdmin Port +mdns 5353/tcp # Multicast DNS +mdns 5353/udp # Multicast DNS +http-alt 8080/tcp # HTTP Alternate (see port 80) +http-alt 8080/udp # HTTP Alternate (see port 80) + +# Zephyr services +zephyr-clt 2103/udp # Zephyr serv-hm connection +zephyr-hm 2104/udp # Zephyr hostmanager +zephyr-hm-srv 2105/udp # Zephyr hm-serv connection diff --git a/inetd/.footprint b/inetd/.footprint new file mode 100644 index 0000000..f007248 --- /dev/null +++ b/inetd/.footprint @@ -0,0 +1,10 @@ +drwxr-xr-x root/root etc/ +-rw-r--r-- root/root etc/inetd.conf +drwxr-xr-x root/root etc/rc.d/ +-rwxr-xr-x root/root etc/rc.d/inetd +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/man/ +drwxr-xr-x root/root usr/man/man8/ +-rw-r--r-- root/root usr/man/man8/inetd.8.gz +drwxr-xr-x root/root usr/sbin/ +-rwxr-xr-x root/root usr/sbin/inetd diff --git a/inetd/.md5sum b/inetd/.md5sum new file mode 100644 index 0000000..1a4b542 --- /dev/null +++ b/inetd/.md5sum @@ -0,0 +1,6 @@ +87fdb9f85d8fc140b2f873e8e4e18440 inetd +0feee7f8e9d4fea8e8bce70bfc472e53 inetd-break.patch +f79bb838060f298957daf9d41fd32167 inetd-gcc4.patch +705b8a9ee47fb056c66c310732c06a56 inetd-usagi-20030214.patch +dd0d71e008809420edada02dda7a3149 inetd.conf +1f0193358e92559ec0f598b09ccbc0ec netkit-base-0.17.tar.gz diff --git a/inetd/Pkgfile b/inetd/Pkgfile new file mode 100644 index 0000000..b5e4e0a --- /dev/null +++ b/inetd/Pkgfile @@ -0,0 +1,30 @@ +# Description: Internet service daemon +# URL: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit +# Maintainer: CRUX System Team, core-ports at crux dot nu + +name=inetd +version=0.17 +release=1 +source=(ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/netkit-base-$version.tar.gz \ + $name-usagi-20030214.patch \ + $name-break.patch \ + $name-gcc4.patch \ + inetd.conf inetd) + +build() { + cd netkit-base-$version + patch -p1 < ../$name-usagi-20030214.patch + patch -p1 < ../$name-break.patch + patch -p1 < ../$name-gcc4.patch + ./configure --prefix=/usr \ + --installroot=$PKG \ + --enable-ipv6 + cd inetd + make + mkdir -p $PKG/etc/rc.d $PKG/usr/sbin $PKG/usr/man/man8 + install -m 755 inetd $PKG/usr/sbin + install -m 644 inetd.8 $PKG/usr/man/man8 + install -m 644 $SRC/inetd.conf $PKG/etc + install -m 755 $SRC/inetd $PKG/etc/rc.d + +} diff --git a/inetd/inetd b/inetd/inetd new file mode 100755 index 0000000..b70001c --- /dev/null +++ b/inetd/inetd @@ -0,0 +1,23 @@ +#!/bin/sh +# +# /etc/rc.d/inetd: start/stop inet daemon +# + +case $1 in +start) + /usr/sbin/inetd + ;; +stop) + killall -q /usr/sbin/inetd + ;; +restart) + $0 stop + sleep 2 + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/inetd/inetd-break.patch b/inetd/inetd-break.patch new file mode 100644 index 0000000..fe2705b --- /dev/null +++ b/inetd/inetd-break.patch @@ -0,0 +1,10 @@ +--- netkit-base-0.17/inetd/servtab.c 2005-02-03 22:15:45.261510456 +0100 ++++ netkit-base-0.17-new/inetd/servtab.c 2005-02-03 22:16:08.933911704 +0100 +@@ -176,6 +176,7 @@ + break; + default: + /*XXX*/ ++ break; + } + } + return NULL; diff --git a/inetd/inetd-gcc4.patch b/inetd/inetd-gcc4.patch new file mode 100644 index 0000000..41fbce9 --- /dev/null +++ b/inetd/inetd-gcc4.patch @@ -0,0 +1,12 @@ +diff -ur netkit-base-0.17/inetd/servtab.c netkit-base-0.17-patched/inetd/servtab.c +--- netkit-base-0.17/inetd/servtab.c 2000-07-22 15:20:50.000000000 -0500 ++++ netkit-base-0.17-patched/inetd/servtab.c 2005-04-30 21:23:52.649630720 -0500 +@@ -771,7 +771,7 @@ + return; + } + +-#define SWAP(type, a, b) {type c=(type)a; (type)a=(type)b; (type)b=(type)c;} ++#define SWAP(type, a, b) {type c=(type)a; a=(type)b; b=(type)c;} + + /* + * sep->se_wait may be holding the pid of a daemon diff --git a/inetd/inetd-usagi-20030214.patch b/inetd/inetd-usagi-20030214.patch new file mode 100644 index 0000000..fcc968c --- /dev/null +++ b/inetd/inetd-usagi-20030214.patch @@ -0,0 +1,1884 @@ +diff -Nru netkit-base-0.17/ChangeLog netkit-base/ChangeLog +--- netkit-base-0.17/ChangeLog 2000-07-25 01:48:33.000000000 +0200 ++++ netkit-base/ChangeLog 2001-01-29 19:38:19.000000000 +0100 +@@ -1,3 +1,37 @@ ++2001/01/30 yoshfuji ++ - MULOG support for new parser. ++ - removed old parser. ++ ++2001/01/29 yoshfuji ++ - remove inet6d things. ++ ++2001/01/29 yoshfuji ++ - identd over ipv6 support. ++ ++2001/01/28 yoshfuji ++ - do not compile inet6d by default. if you want inet6d ++ compiled, do configure with --build-inet6d. ++ ++2001/01/28 yoshfuji ++ inetd/{inetd,servtab}.c: revised. ++ - handle {tcp,udp}{4,6,46} more properly. ++ - set IPV6_V6ONLY / if it is not supported, ignore connection ++ via ipv4-mapped addresses for tcp6 entries. ++ - clean-up. ++ ++2001/01/27 yoshfuji ++ inetd/inetd.c ...: import patch to ipv6 integrated inetd from ++ Mauro Tortonesi <mauro@ferrara.linux.it>; ++ <ftp://ftp.ferrara.linux.it/pub/project6/patches/\ ++netkit-base_inetd-0.17-ipv6rel4pre1.patch.gz> ++ ++19-Jan-2000: ++ removed ipv6 patch from inet6 and introduce inet6d from KAME. ++ (yoshfuji) ++ ++4-Nov-2000: ++ IPv6 enabled inetd (mk@linux-ipv6.org) ++ + 24-Jul-2000: + Don't use OPEN_MAX. (Olaf Kirch) + +diff -Nru netkit-base-0.17/configure netkit-base/configure +--- netkit-base-0.17/configure 2000-07-29 20:00:28.000000000 +0200 ++++ netkit-base/configure 2001-01-29 05:47:51.000000000 +0100 +@@ -29,6 +29,7 @@ + --manmode=mode Mode for manual pages [644] + --suidmode=mode Mode for setuid programs [4755] + --with-c-compiler=cc Program for compiling C source [guessed] ++ --enable-ipv6 Enable IPv6 support + EOF + exit 0;; + --verbose) ;; +@@ -46,6 +47,11 @@ + --manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;; + --suidmode=*) SUIDMODE=`echo $1 | sed 's/^[^=]*=//'` ;; + --with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;; ++ ++ --disable-ipv6) ENABLE_IPV6=no;; ++ --enable-ipv6=*) ENABLE_IPV6=`echo $1 | sed 's/^[^=]*=//'`;; ++ --enable-ipv6) ENABLE_IPV6=yes;; ++ + *) echo "Unrecognized option: $1"; exit 1;; + esac + shift +@@ -167,6 +173,42 @@ + rm -f __conftest* + + ################################################## ++## Enable IPv6 ++echo -n "Whether to enable IPv6 support... " ++if [ x"$ENABLE_IPV6" = x"yes" ]; then ++ echo yes ++ CFLAGS="$CFLAGS -DINET6" ++else ++ echo no ++fi ++ ++rm -f __conftest* ++ ++## Search IPv6 Library / Headers ++if [ x"$ENABLE_IPV6" = x"yes" ]; then ++ echo -n "Search for IPv6 library... " ++ inet6libdirs="/usr/local/v6/lib /usr/local/lib /usr /usr/inet6/lib" ++ inet6libs="inet6" ++ inet6found=no ++ for inet6libdir in $inet6libdirs; do ++ for inet6lib in $inet6libs; do ++ if [ -d $inet6libdir ] && [ -f $inet6libdir/lib$inet6lib.a ]; then ++ inet6found=yes ++ break 2 ++ fi ++ done ++ done ++ if [ x"$inet6found" = x"yes" ]; then ++ echo "$inet6libdir/lib$inet6lib.a" ++ LIBS="$LIBS -L$inet6libdir -l$inet6lib" ++ else ++ echo "not found" ++ fi ++fi ++ ++rm -f __conftest* ++ ++################################################## + + echo -n 'Checking for BSD signal semantics... ' + cat <<EOF >__conftest.c +diff -Nru netkit-base-0.17/etc.sample/inetd.conf netkit-base/etc.sample/inetd.conf +--- netkit-base-0.17/etc.sample/inetd.conf 1999-07-16 04:27:26.000000000 +0200 ++++ netkit-base/etc.sample/inetd.conf 2001-03-02 14:35:46.000000000 +0100 +@@ -9,23 +9,35 @@ + # <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> + # + # It is generally considered safer to keep these off. ++#echo stream tcp6 nowait root internal + #echo stream tcp nowait root internal ++#echo dgram udp6 wait root internal + #echo dgram udp wait root internal ++#discard stream tcp6 nowait root internal + #discard stream tcp nowait root internal ++#discard dgram udp6 wait root internal + #discard dgram udp wait root internal ++#daytime stream tcp6 nowait root internal + #daytime stream tcp nowait root internal ++#daytime dgram udp6 wait root internal + #daytime dgram udp wait root internal ++#chargen stream tcp6 nowait root internal + #chargen stream tcp nowait root internal ++#chargen dgram udp6 wait root internal + #chargen dgram udp wait root internal ++#time stream tcp6 nowait root internal + #time stream tcp nowait root internal ++#time dgram udp6 wait root internal + #time dgram udp wait root internal + # + # These are standard services. + # ++ftp stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.ftpd + ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd +-telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd +-# nntp stream tcp nowait root tcpd in.nntpd +-# smtp stream tcp nowait root tcpd sendmail -v ++telnet stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.telnetd ++telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd ++# nntp stream tcp nowait root tcpd in.nntpd ++# smtp stream tcp nowait root tcpd sendmail -v + # + # Shell, login, exec and talk are BSD protocols. + # +@@ -36,11 +48,17 @@ + # The talkd from netkit-ntalk 0.12 and higher, however, can speak the + # old talk protocol and can be used safely. + # ++# The talkd for ipv6 and one for ipv4 should NOT be run at the same time. ++# ++#shell stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rshd -L + #shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L ++login stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rlogind -L + login stream tcp nowait root /usr/sbin/tcpd in.rlogind -L ++#exec stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rexecd + #exec stream tcp nowait root /usr/sbin/tcpd in.rexecd + # talk dgram udp wait root /usr/sbin/tcpd in.talkd +-ntalk dgram udp wait root /usr/sbin/tcpd in.talkd ++ntalk dgram udp46 wait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.talkd ++#ntalk dgram udp wait root /usr/sbin/tcpd in.talkd + # + # Kerberos authenticated services + # +@@ -61,6 +79,7 @@ + # + # Comsat - asynchronous new mail notification. Recommended to leave it off. + # ++# comsat dgram udp6 wait root /usr/local/v6/sbin/in.comsat + # comsat dgram udp wait root /usr/sbin/tcpd in.comsat + # + # The Internet UUCP service. +@@ -71,6 +90,7 @@ + # run this only on machines acting as "boot servers." If you don't + # need it, don't use it. + # ++# tftp dgram udp6 wait nobody /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.tftpd + # tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd + # bootps dgram udp wait root /usr/sbin/in.bootpd in.bootpd + # +@@ -78,6 +98,7 @@ + # valuable to potential "system crackers." Many sites choose to disable + # some or all of these services to improve security. + # ++finger stream tcp6 nowait nobody /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.fingerd -w + finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd -w + #systat stream tcp nowait nobody /usr/sbin/tcpd /bin/ps -auwwx + #netstat stream tcp nowait root /usr/sbin/tcpd /bin/netstat -a +diff -Nru netkit-base-0.17/inetd/Makefile netkit-base/inetd/Makefile +--- netkit-base-0.17/inetd/Makefile 2000-07-22 22:14:21.000000000 +0200 ++++ netkit-base/inetd/Makefile 2001-02-11 03:30:33.000000000 +0100 +@@ -3,7 +3,12 @@ + include ../MCONFIG + include ../MRULES + +-OBJS=inetd.o servtab.o builtins.o sig.o daemon.o setproctitle.o mysleep.o ++OBJS=inetd.o servtab.o builtins.o sig.o setproctitle.o doalloc.o mysleep.o ++ifeq ($(HAVE_DAEMON), 1) ++CFLAGS+=-DHAVE_DAEMON ++else ++OBJS+=daemon.o ++endif + + inetd: $(OBJS) + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ +@@ -16,7 +21,9 @@ + $(CC) $(CFLAGS) -MM *.c > depend.mk + + install: inetd ++ install -d $(INSTALLROOT)$(SBINDIR) + install -s -m$(DAEMONMODE) inetd $(INSTALLROOT)$(SBINDIR) ++ install -d $(INSTALLROOT)$(MANDIR)/man8 + install -m$(MANMODE) inetd.8 $(INSTALLROOT)$(MANDIR)/man8 + + clean: +diff -Nru netkit-base-0.17/inetd/builtins.c netkit-base/inetd/builtins.c +--- netkit-base-0.17/inetd/builtins.c 2000-07-22 22:13:07.000000000 +0200 ++++ netkit-base/inetd/builtins.c 2001-01-29 03:03:20.000000000 +0100 +@@ -1,3 +1,34 @@ ++/* $USAGI: builtins.c,v 1.11 2001/01/29 02:03:20 yoshfuji Exp $ */ ++ ++/* ++ * Copyright (C) 2001 USAGI/WIDE Project. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the project nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ + /* + * Internet services provided internally by inetd: + */ +@@ -13,6 +44,12 @@ + #include <stdlib.h> + #include <unistd.h> + ++#ifdef INET6 ++#include <netinet/ip6.h> ++#include <netdb.h> ++#endif ++#include <syslog.h> ++ + #include "servtab.h" + #include "builtins.h" + #include "setproctitle.h" +@@ -23,22 +60,68 @@ + char builtins_rcsid[] = + "$Id: builtins.c,v 1.5 2000/07/22 20:13:07 dholland Exp $"; + ++ ++unsigned short int ++sockaddr_port(struct sockaddr *sa, socklen_t salen) ++{ ++#ifdef INET6 ++ char sbuf[NI_MAXSERV]; ++#endif ++ unsigned short int port = 0; ++ ++#ifdef INET6 ++ if (getnameinfo(sa, salen, NULL, 0, sbuf, sizeof(sbuf), ++ NI_NUMERICSERV) == 0) ++ port = atoi(sbuf); ++ else ++#endif ++ switch (sa->sa_family) { ++ case AF_INET: ++ port = ntohs(((struct sockaddr_in *)sa)->sin_port); ++ break; ++#ifdef INET6 ++ case AF_INET6: ++ port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); ++ break; ++#endif ++ default: ++ /* everything went wrong :-P */ ++ syslog(LOG_ERR, "cannot find port number: %m"); ++ exit(1); ++ } ++ return port; ++} ++ ++ + static void + do_setproctitle(char *a, int s) + { +- struct sockaddr_in sn; +- socklen_t size = sizeof(sn); +- +- if (getpeername(s, (struct sockaddr *)&sn, &size) == 0) { +- setproctitle("-%s [%s]", a, inet_ntoa(sn.sin_addr)); +- } +- else { ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif ++ socklen_t size = sizeof(sa); ++ ++ if (getpeername(s, (struct sockaddr *)&sa, &size) == 0) { ++#ifdef INET6 ++ char buf[INET6_ADDRSTRLEN+1]; ++ ++ if(getnameinfo((struct sockaddr *)&sa, size, buf, sizeof(buf), ++ NULL, 0, NI_NUMERICHOST) == 0) { ++ setproctitle("-%s [%s]", a, buf); ++ } else { ++ setproctitle("-%s", a); ++ } ++#else ++ setproctitle("-%s [%s]", a, inet_ntoa(((struct sockaddr_in *)&sa)->sin_addr)); ++#endif ++ } else { + setproctitle("-%s", a); + } + } + + +- + /* Echo service -- echo data back */ + /* ARGSUSED */ + void +@@ -61,10 +144,12 @@ + { + char buffer[BUFSIZE]; + int i, port; +-/* size_t size; */ ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif + socklen_t size; +-/* struct sockaddr sa; */ +- struct sockaddr_in sa; + + (void)sep; + +@@ -73,10 +158,11 @@ + (struct sockaddr *)&sa, &size); + if (i < 0) + return; +- port = sa.sin_port; +- if (ntohs(port) < MINUDPSRCPORT) ++ ++ port = sockaddr_port((struct sockaddr *)&sa, size); ++ if (port < MINUDPSRCPORT) + return; +- (void) sendto(s, buffer, i, 0, (struct sockaddr *)&sa, sizeof(sa)); ++ (void) sendto(s, buffer, i, 0, (struct sockaddr *)&sa, size); + } + + /* Discard service -- ignore data */ +@@ -159,7 +245,11 @@ + chargen_dg(int s, struct servtab *sep) + { + /* struct sockaddr sa; */ +- struct sockaddr_in sa; ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif + static char *rs; + size_t len; + socklen_t size; +@@ -178,8 +268,8 @@ + (struct sockaddr *)&sa, &size) < 0) + return; + +- port = sa.sin_port; +- if (ntohs(port)<MINUDPSRCPORT) ++ port = sockaddr_port((struct sockaddr *)&sa, size); ++ if (port < MINUDPSRCPORT) + return; + + if ((len = endring - rs) >= LINESIZ) +@@ -193,7 +283,7 @@ + text[LINESIZ] = '\r'; + text[LINESIZ + 1] = '\n'; + (void) sendto(s, text, sizeof(text), 0, +- (struct sockaddr *)&sa, sizeof(sa)); ++ (struct sockaddr *)&sa, size); + } + + /* +@@ -236,7 +326,11 @@ + { + unsigned long result; + /* struct sockaddr sa; */ +- struct sockaddr_in sa; ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif + /* size_t size; */ + socklen_t size; + int port; +@@ -246,12 +340,13 @@ + if (recvfrom(s, (char *)&result, sizeof(result), 0, + (struct sockaddr *)&sa, &size) < 0) + return; +- port = sa.sin_port; +- if (ntohs(port) < MINUDPSRCPORT) ++ ++ port = sockaddr_port((struct sockaddr *)&sa, size); ++ if (port < MINUDPSRCPORT) + return; + result = machtime(); + (void) sendto(s, (char *) &result, sizeof(result), 0, +- (struct sockaddr *)&sa, sizeof(sa)); ++ (struct sockaddr *)&sa, size); + } + + /* Return human-readable time of day */ +@@ -274,8 +369,11 @@ + { + char buffer[256]; + time_t clocc; +- struct sockaddr_in sa; +-/* size_t size; */ ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif + socklen_t size; + int port; + +@@ -286,10 +384,11 @@ + if (recvfrom(s, buffer, sizeof(buffer), 0, + (struct sockaddr *)&sa, &size) < 0) + return; +- port = sa.sin_port; +- if (ntohs(port) < MINUDPSRCPORT) ++ ++ port = sockaddr_port((struct sockaddr *)&sa, size); ++ if (port < MINUDPSRCPORT) + return; + snprintf(buffer, sizeof(buffer), "%.24s\r\n", ctime(&clocc)); + sendto(s, buffer, strlen(buffer), 0, +- (struct sockaddr *)&sa, sizeof(sa)); ++ (struct sockaddr *)&sa, size); + } +diff -Nru netkit-base-0.17/inetd/builtins.h netkit-base/inetd/builtins.h +--- netkit-base-0.17/inetd/builtins.h 1999-08-23 04:30:24.000000000 +0200 ++++ netkit-base/inetd/builtins.h 2001-01-27 14:14:00.000000000 +0100 +@@ -8,3 +8,4 @@ + void machtime_dg(int, struct servtab *); + void daytime_dg(int, struct servtab *); + void chargen_dg(int, struct servtab *); ++unsigned short int sockaddr_port(struct sockaddr *sa, socklen_t salen); +diff -Nru netkit-base-0.17/inetd/depend.mk netkit-base/inetd/depend.mk +--- netkit-base-0.17/inetd/depend.mk 1999-08-23 04:30:24.000000000 +0200 ++++ netkit-base/inetd/depend.mk 2001-01-29 02:48:42.000000000 +0100 +@@ -1,7 +1,10 @@ + builtins.o: builtins.c servtab.h builtins.h setproctitle.h + daemon.o: daemon.c daemon.h ++doalloc.o: doalloc.c mysleep.h inetd.h ++inet6d.o: inet6d.c setproctitle.h mysleep.h pathnames.h + inetd.o: inetd.c ../version.h pathnames.h inetd.h servtab.h sig.h \ +- daemon.h setproctitle.h +-servtab.o: servtab.c inetd.h servtab.h builtins.h sig.h ++ daemon.h setproctitle.h builtins.h mysleep.h ++mysleep.o: mysleep.c mysleep.h ++servtab.o: servtab.c inetd.h servtab.h builtins.h sig.h mysleep.h + setproctitle.o: setproctitle.c setproctitle.h inetd.h + sig.o: sig.c sig.h +diff -Nru netkit-base-0.17/inetd/doalloc.c netkit-base/inetd/doalloc.c +--- netkit-base-0.17/inetd/doalloc.c 1970-01-01 01:00:00.000000000 +0100 ++++ netkit-base/inetd/doalloc.c 2001-01-28 02:31:14.000000000 +0100 +@@ -0,0 +1,90 @@ ++/* $USAGI: doalloc.c,v 1.3 2001/01/28 01:31:14 yoshfuji Exp $ */ ++ ++/* ++ * Copyright (c) 1983, 1991 The Regents of the University of California. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. All advertising materials mentioning features or use of this software ++ * must display the following acknowledgement: ++ * This product includes software developed by the University of ++ * California, Berkeley and its contributors. ++ * 4. Neither the name of the University nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#include <sys/types.h> ++#include <sys/time.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <sys/un.h> ++#include <netdb.h> ++#include <syslog.h> ++#include <signal.h> ++#include <unistd.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include "mysleep.h" ++#include "inetd.h" ++ ++/********* exit-resistant malloc ************************/ ++ ++/* ++ * On many systems, including presently Linux, this is bloat because ++ * malloc never returns null - if the system runs out of swap, it ++ * panics or randomly starts killing processes or does other weird ++ * stuff. However, it doesn't hurt to be prepared. This is the only ++ * place inetd can actually exit due to failure, now. ++ */ ++ ++void * ++domalloc(size_t len) ++{ ++ static int retries[] = { 2, 10, 60, 600, -1 }; ++ void *p; ++ int try = 0; ++ ++ while (retries[try]>0) { ++ p = malloc(len); ++ if (p != NULL) { ++ return p; ++ } ++ ++ syslog(LOG_ERR, "Out of memory - retrying in %d seconds.", ++ retries[try]); ++ mysleep(retries[try]); ++ try++; ++ } ++ /* Should this be LOG_EMERG? */ ++ syslog(LOG_ALERT, "Out of memory - GIVING UP!"); ++ exit(100); ++ return NULL; /* unreachable */ ++} ++ ++char * ++dostrdup(const char *cp) ++{ ++ char *x = domalloc(strlen(cp)+1); ++ strcpy(x, cp); ++ return x; ++} +diff -Nru netkit-base-0.17/inetd/inetd.8 netkit-base/inetd/inetd.8 +--- netkit-base-0.17/inetd/inetd.8 2000-07-31 01:56:58.000000000 +0200 ++++ netkit-base/inetd/inetd.8 2001-01-29 06:23:38.000000000 +0100 +@@ -1,3 +1,30 @@ ++.\" Copyright (C) 2001 USAGI/WIDE Project. ++.\" All rights reserved. ++.\" ++.\" Redistribution and use in source and binary forms, with or without ++.\" modification, are permitted provided that the following conditions ++.\" are met: ++.\" 1. Redistributions of source code must retain the above copyright ++.\" notice, this list of conditions and the following disclaimer. ++.\" 2. Redistributions in binary form must reproduce the above copyright ++.\" notice, this list of conditions and the following disclaimer in the ++.\" documentation and/or other materials provided with the distribution. ++.\" 3. Neither the name of the project nor the names of its contributors ++.\" may be used to endorse or promote products derived from this software ++.\" without specific prior written permission. ++.\" ++.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ++.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE ++.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++.\" SUCH DAMAGE. ++.\" + .\" Copyright (c) 1985, 1991 The Regents of the University of California. + .\" All rights reserved. + .\" +@@ -183,7 +210,27 @@ + Examples might be + .Dq tcp + or +-.Dq udp . ++.Dq udp , ++both of which imply IPv4 for backward compatibility. ++The names ++.Dq tcp4 ++and ++.Dq udp4 ++specify IPv4 only. ++The names ++.Dq tcp6 ++and ++.Dq udp6 ++specify IPv6 only; ++inetd will reject / ignore packets from ipv4 clients. ++The names ++.Dq tcp46 ++and ++.Dq udp46 ++specify that the entry accepts both IPv4 and IPv6 connections ++via a wildcard ++.Dv PF_INET6 ++socket. + Rpc based services are specified with the + .Dq rpc/tcp + or +@@ -315,3 +362,7 @@ + based services is modelled after that + provided by + .Em SunOS 4.1 . ++.Em IPv6 ++support was developed by USAGI Project, ++based on Mauro Tortonesi <mauro@ferrara.linux.it>'s patch. ++ +diff -Nru netkit-base-0.17/inetd/inetd.c netkit-base/inetd/inetd.c +--- netkit-base-0.17/inetd/inetd.c 2000-07-25 01:48:34.000000000 +0200 ++++ netkit-base/inetd/inetd.c 2001-02-11 03:30:33.000000000 +0100 +@@ -1,3 +1,34 @@ ++/* $USAGI: inetd.c,v 1.14 2001/02/11 02:30:33 yoshfuji Exp $ */ ++ ++/* ++ * Copyright (C) 2001 USAGI/WIDE Project. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the project nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ + /* + * Copyright (c) 1983, 1991 The Regents of the University of California. + * All rights reserved. +@@ -41,7 +72,11 @@ + char rcsid[] = + "$Id: inetd.c,v 1.38 2000/07/24 23:48:34 dholland Exp $"; + ++#ifdef _USAGI ++#include "version.h" ++#else + #include "../version.h" ++#endif + + /* + * Inetd - Internet super-server +@@ -137,7 +172,17 @@ + #include <getopt.h> + #include <stdlib.h> + #include <unistd.h> ++#ifndef HAVE_DAEMON ++#include "daemon.h" ++#endif ++#ifdef MULOG ++#include <signal.h> ++#endif + ++#ifdef INET6 ++#include <netinet/ip6.h> ++#endif ++ + #ifndef __linux__ + #ifndef RLIMIT_NOFILE + #define RLIMIT_NOFILE RLIMIT_OFILE +@@ -148,8 +193,8 @@ + #include "inetd.h" + #include "servtab.h" + #include "sig.h" +-#include "daemon.h" + #include "setproctitle.h" ++#include "builtins.h" + #include "mysleep.h" + + #ifdef RPC /* must come after inetd.h, which defines RPC */ +@@ -176,6 +221,12 @@ + + static void attempt_to_restart(void); + ++#ifdef MULOG ++static void dolog(struct servtab *, int); ++char *rfc931_name(struct sockaddr *, int); ++static void timeout(int); ++#endif ++ + struct servtab *servtab; /* service table */ + const char *configfile = _PATH_INETDCONF; /* config file path */ + int debug = 0; /* debug flag */ +@@ -189,7 +240,7 @@ + static int options; + static int timingout; + +-static long rlim_ofile_cur = DEFAULT_FILE_LIMIT; ++static unsigned long rlim_ofile_cur = DEFAULT_FILE_LIMIT; + + #ifdef RLIMIT_NOFILE + struct rlimit rlim_ofile; +@@ -457,6 +508,13 @@ + { + char buf[50]; + int ctrl, dofork; ++#ifdef INET6 ++ struct sockaddr_storage sa; ++#else ++ struct sockaddr sa; ++#endif ++ socklen_t salen = sizeof(&sa); ++ int nowait = 0; + + if (debug) { + fprintf(stderr, "launching: %s\n", sep->se_service); +@@ -465,9 +523,26 @@ + if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) { + /* Do nonblocking accept, just in case */ + fcntl(sep->se_fd, F_SETFL, O_NDELAY); +- ctrl = accept(sep->se_fd, NULL, NULL); ++ ctrl = accept(sep->se_fd, (struct sockaddr *)&sa, &salen); + fcntl(sep->se_fd, F_SETFL, 0); ++#ifdef INET6 ++ nowait = 1; ++#endif ++ } else { ++ ctrl = sep->se_fd; ++ } ++#ifdef INET6 ++ if (sep->se_sockopt_ipv6_only && ++ ((struct sockaddr *)&sa)->sa_family == AF_INET6 && ++ IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&sa)->sin6_addr)) { ++ syslog(LOG_WARNING, "packet arrived via ipv4 mapped address; ignored."); ++ if (nowait) ++ close(ctrl); ++ return; ++ } ++#endif + ++ if (nowait) { + if (debug) { + fprintf(stderr, "accept: new socket %d\n", ctrl); + } +@@ -485,9 +560,6 @@ + return; + } + } +- else { +- ctrl = sep->se_fd; +- } + + dofork = (sep->se_bi == NULL || sep->se_bi->bi_fork); + if (dofork) { +@@ -844,6 +916,9 @@ + (void)unlink(sep->se_service); + break; + case AF_INET: ++#ifdef INET6 ++ case AF_INET6: ++#endif + if (sep->se_wait == 1 && isrpcservice(sep)) + unregister_rpc(sep); + break; +@@ -886,6 +961,13 @@ + syslog(LOG_ERR, "setsockopt (SO_DEBUG): %m"); + if (turnon(sep->se_fd, SO_REUSEADDR) < 0) + syslog(LOG_ERR, "setsockopt (SO_REUSEADDR): %m"); ++#ifdef INET6 ++#ifdef IPV6_V6ONLY ++ if (sep->se_sockopt_ipv6_only == 1 && ++ setsockopt(sep->se_fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof (on)) <0) ++ syslog(LOG_ERR, "setsockopt (IPPROTO_IPV6, IPV6_V6ONLY): %m"); ++#endif ++#endif + #undef turnon + if (bind(sep->se_fd, &sep->se_ctrladdr, sep->se_ctrladdr_size) < 0) { + syslog(LOG_ERR, "%s: bind: %m", service_name(sep), +@@ -898,6 +980,10 @@ + } + return; + } ++#ifdef INET6 ++ if (debug) ++ fprintf(stderr, "bound to af: %i\n", sep->se_family); ++#endif + if (sep->se_socktype == SOCK_STREAM) + listen(sep->se_fd, global_queuelen); + +@@ -916,7 +1002,7 @@ + nsock++; + if (sep->se_fd > maxsock) { + maxsock = sep->se_fd; +- if (maxsock > rlim_ofile_cur - FD_MARGIN) ++ if ((unsigned int)maxsock + FD_MARGIN > rlim_ofile_cur) + bump_nofile(); + } + } +@@ -927,8 +1013,12 @@ + #ifdef RPC + /* size_t m; */ + socklen_t m; +- int i; ++ int i, port; ++#ifdef INET6 ++ struct sockaddr_storage sn; ++#else + struct sockaddr_in sn; ++#endif + struct protoent *pp; + + if ((pp = getprotobyname(sep->se_proto+4)) == NULL) { +@@ -943,16 +1033,18 @@ + return; + } + ++ port = sockaddr_port((struct sockaddr *)&sn, m); ++ + for (i = sep->se_rpcversl; i <= sep->se_rpcversh; i++) { + if (debug) + fprintf(stderr, "pmap_set: %u %u %u %u\n", + sep->se_rpcprog, i, +- pp->p_proto, ntohs(sn.sin_port)); ++ pp->p_proto, port); + (void)pmap_unset(sep->se_rpcprog, i); +- if (!pmap_set(sep->se_rpcprog, i, pp->p_proto, ntohs(sn.sin_port))) ++ if (!pmap_set(sep->se_rpcprog, i, pp->p_proto, port)) + syslog(LOG_ERR, "pmap_set: %u %u %u %u: %m", + sep->se_rpcprog, i, +- pp->p_proto, ntohs(sn.sin_port)); ++ pp->p_proto, port); + } + #endif /* RPC */ + } +@@ -1048,45 +1140,75 @@ + + + #ifdef MULOG ++static ++void + dolog(sep, ctrl) + struct servtab *sep; + int ctrl; + { ++#ifdef INET6 ++ struct sockaddr_storage sa; ++ char host[NI_MAXHOST]; ++#else + struct sockaddr sa; + struct sockaddr_in *sin = (struct sockaddr_in *)&sa; +- int len = sizeof(sa); + struct hostent *hp; +- char *host, *dp, buf[BUFSIZ], *rfc931_name(); ++ char *host; ++#endif ++ socklen_t len = sizeof(sa); ++ char buf[BUFSIZ]; + int connected = 1; + +- if (sep->se_family != AF_INET) ++ if (sep->se_family != AF_INET ++#ifdef INET6 ++ && sep->se_family != AF_INET6 ++#endif ++ ) + return; + +- if (getpeername(ctrl, &sa, &len) < 0) { ++ if (getpeername(ctrl, (struct sockaddr *)&sa, &len) < 0) { + if (errno != ENOTCONN) { + syslog(LOG_ERR, "getpeername: %m"); + return; + } +- if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, &sa, &len) < 0) { ++ if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, ++ (struct sockaddr *)&sa, &len) < 0) { + syslog(LOG_ERR, "recvfrom: %m"); + return; + } + connected = 0; + } +- if (sa.sa_family != AF_INET) { +- syslog(LOG_ERR, "unexpected address family %u", sa.sa_family); ++ if (((struct sockaddr *)&sa)->sa_family != AF_INET ++#ifdef INET6 ++ && ((struct sockaddr *)&sa)->sa_family != AF_INET6 ++#endif ++ ) { ++ syslog(LOG_ERR, "unexpected address family %u", ++ ((struct sockaddr *)&sa)->sa_family); + return; + } + ++#ifdef INET6 ++ if (getnameinfo((struct sockaddr *)&sa, len, ++ host, sizeof(host), NULL, 0, 0)) { ++ syslog(LOG_ERR, "cannot do getnameinfo: family %u", ++ ((struct sockaddr *)&sa)->sa_family); ++ return; ++ } ++#else + hp = gethostbyaddr((char *) &sin->sin_addr.s_addr, + sizeof (sin->sin_addr.s_addr), AF_INET); + + host = hp?hp->h_name:inet_ntoa(sin->sin_addr); ++#endif + + switch (sep->se_log & ~MULOG_RFC931) { + case 0: + return; + case 1: ++ { ++#if 0 /* XXX where is curdom? */ ++ char *dp; + if (curdom == NULL || *curdom == '\0') + break; + dp = host + strlen(host) - strlen(curdom); +@@ -1097,7 +1219,9 @@ + host, curdom); + if (strcasecmp(dp, curdom) == 0) + return; ++#endif + break; ++ } + case 2: + default: + break; +@@ -1107,7 +1231,7 @@ + + if (connected && (sep->se_log & MULOG_RFC931)) + syslog(LOG_INFO, "%s@%s wants %s", +- rfc931_name(sin, ctrl), host, sep->se_service); ++ rfc931_name((struct sockaddr *)&sa, ctrl), host, sep->se_service); + else + syslog(LOG_INFO, "%s wants %s", + host, sep->se_service); +@@ -1139,11 +1263,17 @@ + /* rfc931_name - return remote user name */ + + char * +-rfc931_name(struct sockaddr_in *there, int ctrl) ++rfc931_name(struct sockaddr *there, int ctrl) + { + /* "there" is remote link information */ +- struct sockaddr_in here; /* local link information */ +- struct sockaddr_in sin; /* for talking to RFC931 daemon */ ++#ifdef INET6 ++ struct sockaddr_storage here; /* local link information */ ++ struct sockaddr_storage sa; /* for talking to RFC931 daemon */ ++#else ++ struct sockaddr here; /* local link information */ ++ struct sockaddr sa; /* for talking to RFC931 daemon */ ++#endif ++ unsigned int there_port, here_port; + int length; + int s; + unsigned remote; +@@ -1152,7 +1282,7 @@ + char buf[256]; + char *cp; + char *result = "USER_UNKNOWN"; +- int len; ++ size_t len; + + /* Find out local port number of our stdin. */ + +@@ -1161,33 +1291,70 @@ + syslog(LOG_ERR, "getsockname: %m"); + return (result); + } +- /* Set up timer so we won't get stuck. */ + +- if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) { ++ memcpy(&sa, &here, sizeof(sa)); ++ switch(((struct sockaddr *) &here)->sa_family) { ++ case AF_INET: ++ ((struct sockaddr_in *)&sa)->sin_port = htons(0); ++ break; ++#ifdef INET6 ++ case AF_INET6: ++ ((struct sockaddr_in6 *)&sa)->sin6_port = htons(0); ++ break; ++#endif ++ default: ++ syslog(LOG_ERR, "getsockname: unsupported family %d", ++ ((struct sockaddr *) &here)->sa_family); ++ return (result); ++ } ++ ++ s = socket(((struct sockaddr*)&here)->sa_family, SOCK_STREAM, 0); ++ if (s == -1) { + syslog(LOG_ERR, "socket: %m"); + return (result); + } + +- sin = here; +- sin.sin_port = htons(0); +- if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) { ++ if (bind(s, (struct sockaddr *) &sa, length) == -1) { + syslog(LOG_ERR, "bind: %m"); + close(s); + return (result); + } + ++ /* Set up timer so we won't get stuck. */ ++ + signal(SIGALRM, timeout); +- if (sigsetjmp(timebuf)) { ++ if (sigsetjmp(timebuf, 0)) { + close(s); /* not: fclose(fp) */ + return (result); + } + alarm(TIMEOUT); + ++ /* ports */ ++ there_port = ntohs(((struct sockaddr_in *)there)->sin_port); ++ here_port = ntohs(((struct sockaddr_in *)&here)->sin_port); ++ + /* Connect to the RFC931 daemon. */ + +- sin = *there; +- sin.sin_port = htons(RFC931_PORT); +- if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) { ++ length = SA_LEN((struct sockaddr *)there); ++ memcpy(&sa, there, length); ++ switch(((struct sockaddr *) there)->sa_family) { ++ case AF_INET: ++ ((struct sockaddr_in *)&sa)->sin_port = htons(RFC931_PORT); ++ break; ++#ifdef INET6 ++ case AF_INET6: ++ ((struct sockaddr_in6 *)&sa)->sin6_port = htons(RFC931_PORT); ++ break; ++#endif ++ default: ++ syslog(LOG_ERR, "unsupported remote family %u", ++ ((struct sockaddr *) there)->sa_family); ++ close(s); ++ alarm(0); ++ return result; ++ } ++ ++ if (connect(s, (struct sockaddr *) &sa, length) == -1) { + close(s); + alarm(0); + return (result); +@@ -1195,7 +1362,7 @@ + + /* Query the RFC 931 server. Would 13-byte writes ever be broken up? */ + snprintf(buf, sizeof(buf), "%u,%u\r\n", +- ntohs(there->sin_port), ntohs(here.sin_port)); ++ there_port, here_port); + + + for (len = 0, cp = buf; len < strlen(buf); ) { +@@ -1224,11 +1391,11 @@ + *cp = '\0'; + + if (sscanf(buf, "%u , %u : USERID :%*[^:]:%255s", &remote, &local, user) == 3 +- && ntohs(there->sin_port) == remote +- && ntohs(here.sin_port) == local) { ++ && there_port == remote ++ && here_port == local) { + + /* Strip trailing carriage return. */ +- if (cp = strchr(user, '\r')) ++ if ((cp = strchr(user, '\r')) != NULL) + *cp = 0; + result = user; + } +diff -Nru netkit-base-0.17/inetd/pathnames.h netkit-base/inetd/pathnames.h +--- netkit-base-0.17/inetd/pathnames.h 2000-07-23 01:00:05.000000000 +0200 ++++ netkit-base/inetd/pathnames.h 2001-04-03 22:33:59.000000000 +0200 +@@ -36,6 +36,14 @@ + + #include <paths.h> + ++#ifndef _PATH_INETDCONF + #define _PATH_INETDCONF "/etc/inetd.conf" ++#endif ++ ++#ifndef _PATH_INETDPID + #define _PATH_INETDPID "/var/run/inetd.pid" ++#endif ++ ++#ifndef _PATH_INETD + #define _PATH_INETD "/usr/sbin/inetd" ++#endif +diff -Nru netkit-base-0.17/inetd/servtab.c netkit-base/inetd/servtab.c +--- netkit-base-0.17/inetd/servtab.c 2000-07-22 22:20:50.000000000 +0200 ++++ netkit-base/inetd/servtab.c 2001-01-29 19:38:19.000000000 +0100 +@@ -1,3 +1,34 @@ ++/* $USAGI: servtab.c,v 1.10 2001/01/29 18:38:19 yoshfuji Exp $ */ ++ ++/* ++ * Copyright (C) 2001 USAGI/WIDE Project. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. Neither the name of the project nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ + /* + * Copyright (c) 1983, 1991 The Regents of the University of California. + * All rights reserved. +@@ -42,6 +73,9 @@ + #include <unistd.h> + #include <stdlib.h> + #include <stdio.h> ++#ifdef MULOG ++#include <ctype.h> ++#endif + + #include "inetd.h" + #include "servtab.h" +@@ -49,6 +83,10 @@ + #include "sig.h" + #include "mysleep.h" + ++#ifdef INET6 ++#include <netinet/ip6.h> ++#endif ++ + char servtab_rcsid[] = + "$Id: servtab.c,v 1.6 2000/07/22 20:20:50 dholland Exp $"; + +@@ -104,6 +142,7 @@ + { + struct servtab *sep; + for (sep = servtab; sep; sep = sep->se_next) { ++ if (sep->se_family != cp->se_family) continue; + if (strcmp(sep->se_service, cp->se_service)) continue; + if (strcmp(sep->se_proto, cp->se_proto)) continue; + +@@ -123,8 +162,21 @@ + if (sep->se_address==NULL || cp->se_address==NULL) continue; + + /* Don't bother to compare the hostnames, just the IPs */ +- if (sep->se_ctrladdr_in.sin_addr.s_addr == +- cp->se_ctrladdr_in.sin_addr.s_addr) return sep; ++ switch(sep->se_family) { ++#ifdef INET6 ++ case AF_INET6: ++ if (memcmp(&sep->se_ctrladdr_in6.sin6_addr, ++ &cp->se_ctrladdr_in6.sin6_addr, ++ sizeof(struct in6_addr)) == 0) return sep; ++ break; ++#endif ++ case AF_INET: ++ if (sep->se_ctrladdr_in.sin_addr.s_addr == ++ cp->se_ctrladdr_in.sin_addr.s_addr) return sep; ++ break; ++ default: ++ /*XXX*/ ++ } + } + return NULL; + } +@@ -144,49 +196,6 @@ + return rv; + } + +-/********* exit-resistant malloc ************************/ +- +-/* +- * On many systems, including presently Linux, this is bloat because +- * malloc never returns null - if the system runs out of swap, it +- * panics or randomly starts killing processes or does other weird +- * stuff. However, it doesn't hurt to be prepared. This is the only +- * place inetd can actually exit due to failure, now. +- */ +- +-void * +-domalloc(size_t len) +-{ +- static int retries[] = { 2, 10, 60, 600, -1 }; +- void *p; +- int try = 0; +- +- while (retries[try]>0) { +- p = malloc(len); +- if (p != NULL) { +- return p; +- } +- +- syslog(LOG_ERR, "Out of memory - retrying in %d seconds.", +- retries[try]); +- mysleep(retries[try]); +- try++; +- } +- /* Should this be LOG_EMERG? */ +- syslog(LOG_ALERT, "Out of memory - GIVING UP!"); +- exit(100); +- return NULL; /* unreachable */ +-} +- +-char * +-dostrdup(const char *cp) +-{ +- char *x = domalloc(strlen(cp)+1); +- strcpy(x, cp); +- return x; +-} +- +- + /********* config parser ********************************/ + + static void loadconfigent(struct servtab *cp); +@@ -194,203 +203,6 @@ + static FILE *fconfig = NULL; + + +-#if 0 /* old version */ +-static struct servtab serv; +-static char line[256]; +- +-static +-char * +-nextline(FILE *fd) +-{ +- char *cp; +- +- if (fgets(line, sizeof (line), fd) == NULL) +- return ((char *)0); +- cp = strchr(line, '\n'); +- if (cp) +- *cp = '\0'; +- return (line); +-} +- +-static +-char * +-skip(char **cpp) +-{ +- register char *cp = *cpp; +- char *start; +- +- if (*cpp == NULL) +- return ((char *)0); +- +-again: +- while (*cp == ' ' || *cp == '\t') +- cp++; +- if (*cp == '\0') { +- int c; +- +- c = getc(fconfig); +- (void) ungetc(c, fconfig); +- if (c == ' ' || c == '\t') +- if ((cp = nextline(fconfig))!=NULL) +- goto again; +- *cpp = NULL; +- return NULL; +- } +- start = cp; +- while (*cp && *cp != ' ' && *cp != '\t') +- cp++; +- if (*cp != '\0') +- *cp++ = '\0'; +- *cpp = cp; +- return (start); +-} +- +-static +-struct servtab * +-getconfigent(void) +-{ +- register struct servtab *sep = &serv; +- int argc; +- char *cp, *arg; +- +-more: +- while ((cp = nextline(fconfig)) && *cp == '#') +- ; +- +- if (cp == NULL) { +- return NULL; +- } +- +- memset(sep, 0, sizeof(*sep)); +- sep->se_service = dostrdup(skip(&cp)); +- arg = skip(&cp); +- if (arg == NULL) +- goto more; +- +- if (strcmp(arg, "stream") == 0) +- sep->se_socktype = SOCK_STREAM; +- else if (strcmp(arg, "dgram") == 0) +- sep->se_socktype = SOCK_DGRAM; +- else if (strcmp(arg, "rdm") == 0) +- sep->se_socktype = SOCK_RDM; +- else if (strcmp(arg, "seqpacket") == 0) +- sep->se_socktype = SOCK_SEQPACKET; +- else if (strcmp(arg, "raw") == 0) +- sep->se_socktype = SOCK_RAW; +- else +- sep->se_socktype = -1; +- +- sep->se_proto = dostrdup(skip(&cp)); +- if (strcmp(sep->se_proto, "unix") == 0) { +- sep->se_family = AF_UNIX; +- } else { +- sep->se_family = AF_INET; +- if (strncmp(sep->se_proto, "rpc/", 4) == 0) { +-#ifdef RPC +- char *cp1, *ccp; +- cp1 = index(sep->se_service, '/'); +- if (cp1 == NULL) { +- syslog(LOG_ERR, "%s: no rpc version", +- sep->se_service); +- goto more; +- } +- *cp1++ = '\0'; +- sep->se_rpcversl = +- sep->se_rpcversh = strtol(cp1, &ccp, 0); +- if (ccp == cp1) { +- badafterall: +- syslog(LOG_ERR, "%s/%s: bad rpc version", +- sep->se_service, cp1); +- goto more; +- } +- if (*ccp == '-') { +- cp1 = ccp + 1; +- sep->se_rpcversh = strtol(cp1, &ccp, 0); +- if (ccp == cp1) +- goto badafterall; +- } +-#else +- syslog(LOG_ERR, "%s: rpc services not supported", +- sep->se_service); +- goto more; +-#endif /* RPC */ +- } +- } +- arg = skip(&cp); +- if (arg == NULL) +- goto more; +- { +- char *s = index(arg, '.'); +- if (s) { +- *s++ = '\0'; +- sep->se_max = atoi(s); +- } else +- sep->se_max = TOOMANY; +- } +- sep->se_wait = strcmp(arg, "wait") == 0; +- sep->se_user = dostrdup(skip(&cp)); +- sep->se_group = strchr(sep->se_user, '.'); +- if (sep->se_group) { +- *sep->se_group++ = '\0'; +- } +- sep->se_server = dostrdup(skip(&cp)); +- if (strcmp(sep->se_server, "internal") == 0) { +- register struct biltin *bi; +- +- for (bi = biltins; bi->bi_service; bi++) +- if (bi->bi_socktype == sep->se_socktype && +- strcmp(bi->bi_service, sep->se_service) == 0) +- break; +- if (bi->bi_service == 0) { +- syslog(LOG_ERR, "internal service %s unknown\n", +- sep->se_service); +- goto more; +- } +- sep->se_bi = bi; +- sep->se_wait = bi->bi_wait; +- } else +- sep->se_bi = NULL; +- argc = 0; +- for (arg = skip(&cp); cp; arg = skip(&cp)) { +-#if MULOG +- char *colon, *rindex(); +- +- if (argc == 0 && (colon = rindex(arg, ':'))) { +- while (arg < colon) { +- int x; +- char *ccp; +- +- switch (*arg++) { +- case 'l': +- x = 1; +- if (isdigit(*arg)) { +- x = strtol(arg, &ccp, 0); +- if (ccp == arg) +- break; +- arg = ccp; +- } +- sep->se_log &= ~MULOG_RFC931; +- sep->se_log |= x; +- break; +- case 'a': +- sep->se_log |= MULOG_RFC931; +- break; +- default: +- break; +- } +- } +- arg = colon + 1; +- } +-#endif +- if (argc < MAXARGV) +- sep->se_argv[argc++] = dostrdup(arg); +- } +- while (argc <= MAXARGV) +- sep->se_argv[argc++] = NULL; +- return (sep); +-} +-#else /* new version begins here */ +- + struct wordmap { + const char *word; + int val; +@@ -434,8 +246,18 @@ + const char * + assemble_entry(struct servtab *sep, int nfields, char **fields) + { ++ char *proto; ++ int use_family = PF_UNSPEC; ++#ifdef INET6 ++ int use_v6only = 0; ++ struct sockaddr_storage service_home; ++ struct addrinfo hints, *res0, *res; ++ char *serv = "discard"; /* discard(dummy) */ ++ int err; ++#else + struct in_addr service_home; + struct hostent *hp; ++#endif + char *s, *t; + int i; + +@@ -444,33 +266,138 @@ + } + + memset(sep, 0, sizeof(*sep)); ++ memset(&service_home, 0, sizeof(service_home)); ++ ++ proto = fields[2]; ++ if (!strcmp(fields[2], "unix")) { ++ use_family = PF_UNIX; ++ } else { ++ char *p = strchr(proto, '/'); ++ if (p) ++ proto = p + 1; ++ ++ if (strncmp(proto, "udp", 3) == 0 || ++ strncmp(proto, "tcp", 3) == 0) { ++ int len = strlen(proto); ++ ++ switch(len) { ++ case 3: ++ use_family = PF_INET; ++ break; ++ case 4: ++ if (*(proto + 3) == '4') ++ use_family = PF_INET; ++#ifdef INET6 ++ else if (*(proto + 3) == '6') { ++ use_family = PF_INET6; ++ use_v6only = 1; ++ } ++#endif ++ else ++ return "Invalid / unsupported protocol"; ++ break; ++ case 5: ++#ifdef INET6 ++ if (strcmp(proto + 3, "46") == 0) ++ use_family = PF_INET6; ++ else ++#endif ++ return "Invalid / unsupported protocol"; ++ break; ++ default: ++ return "Invalid / unsupported protocol"; ++ } + ++ /* now we shall set the protocol name back to the ++ standard value. */ ++ *(proto + 3) = '\0'; ++ } ++ } ++ + s = strchr(fields[0], '@'); + if (s) { + *s++ = 0; + sep->se_address = s; +- hp = gethostbyname(s); +- if (hp==NULL) return "Service hostname/address not found"; +- memcpy(&service_home, hp->h_addr, sizeof(service_home)); +- } +- else { +- service_home.s_addr = INADDR_ANY; +- } +- sep->se_service = fields[0]; +- sep->se_socktype = map_word(socket_types, fields[1]); +- free(fields[1]); + +- sep->se_proto = fields[2]; +- if (!strcmp(sep->se_proto, "unix")) { +- sep->se_family = AF_UNIX; +- if (sep->se_address!=NULL) { ++ if (use_family == PF_UNIX) { + return "@host given for unix socket"; + } + } +- else { +- sep->se_family = AF_INET; ++ ++#ifdef INET6 ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_family = use_family; ++ hints.ai_flags = AI_PASSIVE; ++ ++ err = getaddrinfo(s, s ? NULL : serv, &hints, &res0); ++ if (err) ++ return gai_strerror(err); ++ ++ for (res=res0; res; res=res->ai_next){ ++ switch(res->ai_family){ ++ case PF_INET: ++ ((struct sockaddr_in*)res->ai_addr)->sin_port = 0; ++ break; ++ case PF_INET6: ++ ((struct sockaddr_in6*)res->ai_addr)->sin6_port = 0; ++ break; ++ case PF_UNIX: ++ ((struct sockaddr_un*)res->ai_addr)->sun_path[0] = 0; ++ break; ++ default: ++ /*XXX*/ ++ break; ++ } ++ } ++ ++ if (res0==NULL) ++ return "Service hostname/address not found"; ++ ++ if ((size_t)res0->ai_addrlen > sizeof(sep->se_ctrladdr_storage)) { ++ freeaddrinfo(res0); ++ return "sockaddr got from getaddrinfo() was too large"; ++ } ++ ++ memcpy(&service_home, res0->ai_addr, res0->ai_addrlen); ++ sep->se_ctrladdr_storage = service_home; ++ sep->se_ctrladdr_size = res0->ai_addrlen; ++ if (use_v6only) ++ sep->se_sockopt_ipv6_only = 1; ++ ++ freeaddrinfo(res0); ++#else ++ switch (use_family) { ++ case PF_INET: ++ if (s) { ++ hp = gethostbyname(s); ++ if (hp==NULL) ++ return "Service hostname/address not found"; ++ memcpy(&service_home, hp->h_addr, sizeof(service_home)); ++ } ++ else ++ service_home.s_addr = INADDR_ANY; ++ sep->se_ctrladdr_size = sizeof(struct sockaddr_in); ++ sep->se_ctrladdr_in.sin_family = PF_INET; + sep->se_ctrladdr_in.sin_addr = service_home; ++ break; ++ case PF_UNIX: ++ sep->se_ctrladdr_size = sizeof(struct sockaddr_un); ++ sep->se_ctrladdr_un.sun_family = PF_UNIX; ++ strncpy(sep->se_ctrladdr_un.sun_path, sep->se_service, ++ sizeof(sep->se_ctrladdr_un.sun_path)); ++ sep->se_ctrladdr_un.sun_path[sizeof(sep->se_ctrladdr_un.sun_path)-1] = '\0'; ++ break; ++ default: ++ /*XXX*/ ++ } ++#endif ++ ++ sep->se_family = use_family; ++ sep->se_socktype = map_word(socket_types, fields[1]); ++ sep->se_proto = proto; ++ sep->se_service = fields[0]; + ++ if (strcmp(fields[2], "unix")) { + if (!strncmp(sep->se_proto, "rpc/", 4)) { + #ifdef RPC + s = strchr(sep->se_service, '/'); +@@ -501,7 +428,6 @@ + sep->se_max = TOOMANY; + } + sep->se_wait = !strcmp(fields[3], "wait"); +- free(fields[3]); + + s = strchr(fields[4], '.'); + if (s) { +@@ -527,6 +453,35 @@ + + /* The rest are argv[]. */ + for (i=6; i<nfields; i++) { ++#ifdef MULOG ++ char *arg = fields[i], *colon; ++ if (i == 6 && (colon = rindex(arg, ':'))) { ++ while (arg < colon) { ++ int x; ++ char *ccp; ++ ++ switch (*arg++) { ++ case 'l': ++ x = 1; ++ if (isdigit(*arg)) { ++ x = strtol(arg, &ccp, 0); ++ if (ccp == arg) ++ break; ++ arg = ccp; ++ } ++ sep->se_log &= ~MULOG_RFC931; ++ sep->se_log |= x; ++ break; ++ case 'a': ++ sep->se_log |= MULOG_RFC931; ++ break; ++ default: ++ break; ++ } ++ } ++ memmove(fields[i], colon+1, strlen(colon+1)+1); ++ } ++#endif + sep->se_argv[i-6] = fields[i]; + } + +@@ -535,6 +490,8 @@ + sep->se_argv[0] = dostrdup(sep->se_server); + } + ++ free(fields[1]); ++ free(fields[3]); + return NULL; + } + +@@ -604,6 +561,9 @@ + if (errmsg) { + syslog(LOG_WARNING, "Bad config for %s: %s" + " (skipped)", fields[0], errmsg); ++ /* fix memory leak */ ++ while (nfields) ++ free(fields[--nfields]); + } + else { + sendents(&assm); +@@ -630,8 +590,6 @@ + } + } + +-#endif +- + /********* config loading ****************************************/ + + static int +@@ -725,8 +683,13 @@ + * to key the table by port and protocol, not service name + * and protocol. + */ ++#ifdef INET6 ++ if ((cp->se_family==AF_INET || cp->se_family==AF_INET6) && ++ !isrpcservice(cp)) { ++#else + if (cp->se_family==AF_INET && !isrpcservice(cp)) { +- u_short port = htons(atoi(cp->se_service)); ++#endif ++ u_short port = atoi(cp->se_service); + + if (!port) { + struct servent *sp; +@@ -830,8 +793,17 @@ + setup(sep); + break; + case AF_INET: +- sep->se_ctrladdr_in.sin_family = AF_INET; +- sep->se_ctrladdr_size = sizeof sep->se_ctrladdr_in; ++#ifdef INET6 ++ case AF_INET6: ++#endif ++ sep->se_family = sep->se_family; ++#ifdef INET6 ++ sep->se_ctrladdr_size = sep->se_family == AF_INET ? ++ sizeof(struct sockaddr_in) : ++ sizeof(struct sockaddr_in6); ++#else ++ sep->se_ctrladdr_size = sizeof(struct sockaddr_in); ++#endif + if (isrpcservice(sep)) { + struct rpcent *rp; + +@@ -852,7 +824,7 @@ + register_rpc(sep); + } + else { +- u_short port = htons(atoi(sep->se_service)); ++ u_short port = atoi(sep->se_service); + + if (!port) { + struct servent *sp; +@@ -864,10 +836,20 @@ + service_name(sep)); + return; + } +- port = sp->s_port; +- } +- if (port != sep->se_ctrladdr_in.sin_port) { +- sep->se_ctrladdr_in.sin_port = port; ++ /* the s_port field of the struct servent ++ * returned by getservbyname is already in ++ * network byte order, so there is no need ++ * to call htons on sp->s_port. */ ++ port = ntohs(sp->s_port); ++ } ++ if (port != sockaddr_port(&(sep->se_ctrladdr), ++ sep->se_ctrladdr_size)) { ++#ifdef INET6 ++ if (sep->se_family == AF_INET6) ++ sep->se_ctrladdr_in6.sin6_port = htons(port); ++ else ++#endif ++ sep->se_ctrladdr_in.sin_port = htons(port); + if (sep->se_fd != -1) { + closeit(sep); + } +@@ -891,13 +873,8 @@ + } + for (sep = servtab; sep; sep = sep->se_next) + sep->se_checked = 0; +-#if 0 /* old version */ +- while ((cp = getconfigent())!=NULL) { +- loadconfigent(cp); +- } +-#else ++ + loadconfigfile(loadconfigent); +-#endif + + endconfig(); + /* +@@ -934,6 +911,9 @@ + if (sep->se_fd == -1) { + switch (sep->se_family) { + case AF_UNIX: ++#ifdef INET6 ++ case AF_INET6: ++#endif + case AF_INET: + setup(sep); + if (sep->se_fd != -1 && isrpcservice(sep)) +diff -Nru netkit-base-0.17/inetd/servtab.h netkit-base/inetd/servtab.h +--- netkit-base-0.17/inetd/servtab.h 1999-08-23 09:22:30.000000000 +0200 ++++ netkit-base/inetd/servtab.h 2001-01-28 02:31:14.000000000 +0100 +@@ -1,3 +1,5 @@ ++/* $USAGI: servtab.h,v 1.6 2001/01/28 01:31:14 yoshfuji Exp $ */ ++ + #define MAXARGV 20 + + struct servtab; +@@ -31,6 +33,10 @@ + struct sockaddr se_un_ctrladdr; + struct sockaddr_in se_un_ctrladdr_in; + struct sockaddr_un se_un_ctrladdr_un; ++#ifdef INET6 ++ struct sockaddr_in6 se_un_ctrladdr_in6; ++ struct sockaddr_storage se_un_ctrladdr_storage; ++#endif + } se_un; /* bound address */ + int se_ctrladdr_size; + int se_max; /* max # of instances of this service */ +@@ -40,6 +46,9 @@ + int se_log; + #define MULOG_RFC931 0x40000000 + #endif ++#ifdef INET6 ++ int se_sockopt_ipv6_only; ++#endif + struct servtab *se_next; + }; + +@@ -47,6 +56,10 @@ + #define se_ctrladdr_in se_un.se_un_ctrladdr_in + #define se_ctrladdr_un se_un.se_un_ctrladdr_un + ++#ifdef INET6 ++#define se_ctrladdr_in6 se_un.se_un_ctrladdr_in6 ++#define se_ctrladdr_storage se_un.se_un_ctrladdr_storage ++#endif + + extern struct servtab *servtab; + +diff -Nru netkit-base-0.17/ping/Makefile netkit-base/ping/Makefile +--- netkit-base-0.17/ping/Makefile 2000-02-04 10:38:37.000000000 +0100 ++++ netkit-base/ping/Makefile 2001-01-27 06:57:08.000000000 +0100 +@@ -9,7 +9,9 @@ + ping.o: ../version.h pingpack.h + + install: ping ++ install -d $(INSTALLROOT)$(ROOTBINDIR) + install -s -o root -m$(SUIDMODE) ping $(INSTALLROOT)$(ROOTBINDIR) ++ install -d $(INSTALLROOT)$(MANDIR)/man8 + install -m$(MANMODE) ping.8 $(INSTALLROOT)$(MANDIR)/man8 + + clean: diff --git a/inetd/inetd.conf b/inetd/inetd.conf new file mode 100644 index 0000000..00ac639 --- /dev/null +++ b/inetd/inetd.conf @@ -0,0 +1,23 @@ +# +# /etc/inetd.conf: inetd(8) configuration +# +# Do 'killall -HUP inetd' to make inetd re-read this file. +# + +# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> + +# ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd +# telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd +# nntp stream tcp nowait root /usr/sbin/tcpd in.nntpd +# smtp stream tcp nowait root /usr/sbin/tcpd sendmail -v +# shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L +# login stream tcp nowait root /usr/sbin/tcpd in.rlogind +# exec stream tcp nowait root /usr/sbin/tcpd in.rexecd +# talk dgram udp wait root /usr/sbin/tcpd in.talkd +# ntalk dgram udp wait root /usr/sbin/tcpd in.talkd +# pop2 stream tcp nowait root /usr/sbin/tcpd in.pop2d +# pop3 stream tcp nowait root /usr/sbin/tcpd in.pop3d +# imap stream tcp nowait root /usr/sbin/tcpd in.imapd +# auth stream tcp nowait nobody /usr/sbin/in.identd in.identd + +# End of file diff --git a/netkit-base/.footprint b/netkit-base/.footprint deleted file mode 100644 index 6e1401b..0000000 --- a/netkit-base/.footprint +++ /dev/null @@ -1,15 +0,0 @@ -drwxr-xr-x root/root bin/ --rwsr-xr-x root/root bin/ping -drwxr-xr-x root/root etc/ --rw-r--r-- root/root etc/inetd.conf --rw-r--r-- root/root etc/protocols -drwxr-xr-x root/root etc/rc.d/ --rwxr-xr-x root/root etc/rc.d/inetd --rw-r--r-- root/root etc/services -drwxr-xr-x root/root usr/ -drwxr-xr-x root/root usr/man/ -drwxr-xr-x root/root usr/man/man8/ --rw-r--r-- root/root usr/man/man8/inetd.8.gz --rw-r--r-- root/root usr/man/man8/ping.8.gz -drwxr-xr-x root/root usr/sbin/ --rwxr-xr-x root/root usr/sbin/inetd diff --git a/netkit-base/.md5sum b/netkit-base/.md5sum deleted file mode 100644 index 1543326..0000000 --- a/netkit-base/.md5sum +++ /dev/null @@ -1,8 +0,0 @@ -87fdb9f85d8fc140b2f873e8e4e18440 inetd -dd0d71e008809420edada02dda7a3149 inetd.conf -0feee7f8e9d4fea8e8bce70bfc472e53 netkit-base-0.17-break.patch -f79bb838060f298957daf9d41fd32167 netkit-base-0.17-gcc4.patch -705b8a9ee47fb056c66c310732c06a56 netkit-base-0.17-usagi-20030214.patch -1f0193358e92559ec0f598b09ccbc0ec netkit-base-0.17.tar.gz -95ede9740e0d48ebdf829d631fe8d06a protocols -6b1633c41e670506a513e1c32931628a services diff --git a/netkit-base/Pkgfile b/netkit-base/Pkgfile deleted file mode 100644 index f3bc59b..0000000 --- a/netkit-base/Pkgfile +++ /dev/null @@ -1,28 +0,0 @@ -# Description: Internet service daemon and Ping -# URL: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit -# Maintainer: CRUX System Team, core-ports at crux dot nu - -name=netkit-base -version=0.17 -release=8 -source=(ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/$name-$version.tar.gz \ - $name-$version-usagi-20030214.patch \ - $name-$version-break.patch \ - $name-$version-gcc4.patch \ - inetd.conf inetd services protocols) - -build() { - cd $name-$version - patch -p1 < ../$name-$version-usagi-20030214.patch - patch -p1 < ../$name-$version-break.patch - patch -p1 < ../$name-$version-gcc4.patch - ./configure --prefix=/usr \ - --installroot=$PKG \ - --enable-ipv6 - make - mkdir -p $PKG/bin $PKG/etc/rc.d $PKG/usr/sbin $PKG/usr/man/man8 - make install - install -m 644 ../inetd.conf $PKG/etc - install -m 644 ../{services,protocols} $PKG/etc - install -m 755 ../inetd $PKG/etc/rc.d -} diff --git a/netkit-base/inetd b/netkit-base/inetd deleted file mode 100755 index b70001c..0000000 --- a/netkit-base/inetd +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# /etc/rc.d/inetd: start/stop inet daemon -# - -case $1 in -start) - /usr/sbin/inetd - ;; -stop) - killall -q /usr/sbin/inetd - ;; -restart) - $0 stop - sleep 2 - $0 start - ;; -*) - echo "usage: $0 [start|stop|restart]" - ;; -esac - -# End of file diff --git a/netkit-base/inetd.conf b/netkit-base/inetd.conf deleted file mode 100644 index 00ac639..0000000 --- a/netkit-base/inetd.conf +++ /dev/null @@ -1,23 +0,0 @@ -# -# /etc/inetd.conf: inetd(8) configuration -# -# Do 'killall -HUP inetd' to make inetd re-read this file. -# - -# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> - -# ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -# telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -# nntp stream tcp nowait root /usr/sbin/tcpd in.nntpd -# smtp stream tcp nowait root /usr/sbin/tcpd sendmail -v -# shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L -# login stream tcp nowait root /usr/sbin/tcpd in.rlogind -# exec stream tcp nowait root /usr/sbin/tcpd in.rexecd -# talk dgram udp wait root /usr/sbin/tcpd in.talkd -# ntalk dgram udp wait root /usr/sbin/tcpd in.talkd -# pop2 stream tcp nowait root /usr/sbin/tcpd in.pop2d -# pop3 stream tcp nowait root /usr/sbin/tcpd in.pop3d -# imap stream tcp nowait root /usr/sbin/tcpd in.imapd -# auth stream tcp nowait nobody /usr/sbin/in.identd in.identd - -# End of file diff --git a/netkit-base/netkit-base-0.17-break.patch b/netkit-base/netkit-base-0.17-break.patch deleted file mode 100644 index fe2705b..0000000 --- a/netkit-base/netkit-base-0.17-break.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- netkit-base-0.17/inetd/servtab.c 2005-02-03 22:15:45.261510456 +0100 -+++ netkit-base-0.17-new/inetd/servtab.c 2005-02-03 22:16:08.933911704 +0100 -@@ -176,6 +176,7 @@ - break; - default: - /*XXX*/ -+ break; - } - } - return NULL; diff --git a/netkit-base/netkit-base-0.17-gcc4.patch b/netkit-base/netkit-base-0.17-gcc4.patch deleted file mode 100644 index 41fbce9..0000000 --- a/netkit-base/netkit-base-0.17-gcc4.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur netkit-base-0.17/inetd/servtab.c netkit-base-0.17-patched/inetd/servtab.c ---- netkit-base-0.17/inetd/servtab.c 2000-07-22 15:20:50.000000000 -0500 -+++ netkit-base-0.17-patched/inetd/servtab.c 2005-04-30 21:23:52.649630720 -0500 -@@ -771,7 +771,7 @@ - return; - } - --#define SWAP(type, a, b) {type c=(type)a; (type)a=(type)b; (type)b=(type)c;} -+#define SWAP(type, a, b) {type c=(type)a; a=(type)b; b=(type)c;} - - /* - * sep->se_wait may be holding the pid of a daemon diff --git a/netkit-base/netkit-base-0.17-usagi-20030214.patch b/netkit-base/netkit-base-0.17-usagi-20030214.patch deleted file mode 100644 index fcc968c..0000000 --- a/netkit-base/netkit-base-0.17-usagi-20030214.patch +++ /dev/null @@ -1,1884 +0,0 @@ -diff -Nru netkit-base-0.17/ChangeLog netkit-base/ChangeLog ---- netkit-base-0.17/ChangeLog 2000-07-25 01:48:33.000000000 +0200 -+++ netkit-base/ChangeLog 2001-01-29 19:38:19.000000000 +0100 -@@ -1,3 +1,37 @@ -+2001/01/30 yoshfuji -+ - MULOG support for new parser. -+ - removed old parser. -+ -+2001/01/29 yoshfuji -+ - remove inet6d things. -+ -+2001/01/29 yoshfuji -+ - identd over ipv6 support. -+ -+2001/01/28 yoshfuji -+ - do not compile inet6d by default. if you want inet6d -+ compiled, do configure with --build-inet6d. -+ -+2001/01/28 yoshfuji -+ inetd/{inetd,servtab}.c: revised. -+ - handle {tcp,udp}{4,6,46} more properly. -+ - set IPV6_V6ONLY / if it is not supported, ignore connection -+ via ipv4-mapped addresses for tcp6 entries. -+ - clean-up. -+ -+2001/01/27 yoshfuji -+ inetd/inetd.c ...: import patch to ipv6 integrated inetd from -+ Mauro Tortonesi <mauro@ferrara.linux.it>; -+ <ftp://ftp.ferrara.linux.it/pub/project6/patches/\ -+netkit-base_inetd-0.17-ipv6rel4pre1.patch.gz> -+ -+19-Jan-2000: -+ removed ipv6 patch from inet6 and introduce inet6d from KAME. -+ (yoshfuji) -+ -+4-Nov-2000: -+ IPv6 enabled inetd (mk@linux-ipv6.org) -+ - 24-Jul-2000: - Don't use OPEN_MAX. (Olaf Kirch) - -diff -Nru netkit-base-0.17/configure netkit-base/configure ---- netkit-base-0.17/configure 2000-07-29 20:00:28.000000000 +0200 -+++ netkit-base/configure 2001-01-29 05:47:51.000000000 +0100 -@@ -29,6 +29,7 @@ - --manmode=mode Mode for manual pages [644] - --suidmode=mode Mode for setuid programs [4755] - --with-c-compiler=cc Program for compiling C source [guessed] -+ --enable-ipv6 Enable IPv6 support - EOF - exit 0;; - --verbose) ;; -@@ -46,6 +47,11 @@ - --manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;; - --suidmode=*) SUIDMODE=`echo $1 | sed 's/^[^=]*=//'` ;; - --with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;; -+ -+ --disable-ipv6) ENABLE_IPV6=no;; -+ --enable-ipv6=*) ENABLE_IPV6=`echo $1 | sed 's/^[^=]*=//'`;; -+ --enable-ipv6) ENABLE_IPV6=yes;; -+ - *) echo "Unrecognized option: $1"; exit 1;; - esac - shift -@@ -167,6 +173,42 @@ - rm -f __conftest* - - ################################################## -+## Enable IPv6 -+echo -n "Whether to enable IPv6 support... " -+if [ x"$ENABLE_IPV6" = x"yes" ]; then -+ echo yes -+ CFLAGS="$CFLAGS -DINET6" -+else -+ echo no -+fi -+ -+rm -f __conftest* -+ -+## Search IPv6 Library / Headers -+if [ x"$ENABLE_IPV6" = x"yes" ]; then -+ echo -n "Search for IPv6 library... " -+ inet6libdirs="/usr/local/v6/lib /usr/local/lib /usr /usr/inet6/lib" -+ inet6libs="inet6" -+ inet6found=no -+ for inet6libdir in $inet6libdirs; do -+ for inet6lib in $inet6libs; do -+ if [ -d $inet6libdir ] && [ -f $inet6libdir/lib$inet6lib.a ]; then -+ inet6found=yes -+ break 2 -+ fi -+ done -+ done -+ if [ x"$inet6found" = x"yes" ]; then -+ echo "$inet6libdir/lib$inet6lib.a" -+ LIBS="$LIBS -L$inet6libdir -l$inet6lib" -+ else -+ echo "not found" -+ fi -+fi -+ -+rm -f __conftest* -+ -+################################################## - - echo -n 'Checking for BSD signal semantics... ' - cat <<EOF >__conftest.c -diff -Nru netkit-base-0.17/etc.sample/inetd.conf netkit-base/etc.sample/inetd.conf ---- netkit-base-0.17/etc.sample/inetd.conf 1999-07-16 04:27:26.000000000 +0200 -+++ netkit-base/etc.sample/inetd.conf 2001-03-02 14:35:46.000000000 +0100 -@@ -9,23 +9,35 @@ - # <service_name> <sock_type> <proto> <flags> <user> <server_path> <args> - # - # It is generally considered safer to keep these off. -+#echo stream tcp6 nowait root internal - #echo stream tcp nowait root internal -+#echo dgram udp6 wait root internal - #echo dgram udp wait root internal -+#discard stream tcp6 nowait root internal - #discard stream tcp nowait root internal -+#discard dgram udp6 wait root internal - #discard dgram udp wait root internal -+#daytime stream tcp6 nowait root internal - #daytime stream tcp nowait root internal -+#daytime dgram udp6 wait root internal - #daytime dgram udp wait root internal -+#chargen stream tcp6 nowait root internal - #chargen stream tcp nowait root internal -+#chargen dgram udp6 wait root internal - #chargen dgram udp wait root internal -+#time stream tcp6 nowait root internal - #time stream tcp nowait root internal -+#time dgram udp6 wait root internal - #time dgram udp wait root internal - # - # These are standard services. - # -+ftp stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.ftpd - ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd --telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd --# nntp stream tcp nowait root tcpd in.nntpd --# smtp stream tcp nowait root tcpd sendmail -v -+telnet stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.telnetd -+telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -+# nntp stream tcp nowait root tcpd in.nntpd -+# smtp stream tcp nowait root tcpd sendmail -v - # - # Shell, login, exec and talk are BSD protocols. - # -@@ -36,11 +48,17 @@ - # The talkd from netkit-ntalk 0.12 and higher, however, can speak the - # old talk protocol and can be used safely. - # -+# The talkd for ipv6 and one for ipv4 should NOT be run at the same time. -+# -+#shell stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rshd -L - #shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L -+login stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rlogind -L - login stream tcp nowait root /usr/sbin/tcpd in.rlogind -L -+#exec stream tcp6 nowait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.rexecd - #exec stream tcp nowait root /usr/sbin/tcpd in.rexecd - # talk dgram udp wait root /usr/sbin/tcpd in.talkd --ntalk dgram udp wait root /usr/sbin/tcpd in.talkd -+ntalk dgram udp46 wait root /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.talkd -+#ntalk dgram udp wait root /usr/sbin/tcpd in.talkd - # - # Kerberos authenticated services - # -@@ -61,6 +79,7 @@ - # - # Comsat - asynchronous new mail notification. Recommended to leave it off. - # -+# comsat dgram udp6 wait root /usr/local/v6/sbin/in.comsat - # comsat dgram udp wait root /usr/sbin/tcpd in.comsat - # - # The Internet UUCP service. -@@ -71,6 +90,7 @@ - # run this only on machines acting as "boot servers." If you don't - # need it, don't use it. - # -+# tftp dgram udp6 wait nobody /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.tftpd - # tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd - # bootps dgram udp wait root /usr/sbin/in.bootpd in.bootpd - # -@@ -78,6 +98,7 @@ - # valuable to potential "system crackers." Many sites choose to disable - # some or all of these services to improve security. - # -+finger stream tcp6 nowait nobody /usr/local/v6/sbin/tcpd /usr/local/v6/sbin/in.fingerd -w - finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd -w - #systat stream tcp nowait nobody /usr/sbin/tcpd /bin/ps -auwwx - #netstat stream tcp nowait root /usr/sbin/tcpd /bin/netstat -a -diff -Nru netkit-base-0.17/inetd/Makefile netkit-base/inetd/Makefile ---- netkit-base-0.17/inetd/Makefile 2000-07-22 22:14:21.000000000 +0200 -+++ netkit-base/inetd/Makefile 2001-02-11 03:30:33.000000000 +0100 -@@ -3,7 +3,12 @@ - include ../MCONFIG - include ../MRULES - --OBJS=inetd.o servtab.o builtins.o sig.o daemon.o setproctitle.o mysleep.o -+OBJS=inetd.o servtab.o builtins.o sig.o setproctitle.o doalloc.o mysleep.o -+ifeq ($(HAVE_DAEMON), 1) -+CFLAGS+=-DHAVE_DAEMON -+else -+OBJS+=daemon.o -+endif - - inetd: $(OBJS) - $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ -@@ -16,7 +21,9 @@ - $(CC) $(CFLAGS) -MM *.c > depend.mk - - install: inetd -+ install -d $(INSTALLROOT)$(SBINDIR) - install -s -m$(DAEMONMODE) inetd $(INSTALLROOT)$(SBINDIR) -+ install -d $(INSTALLROOT)$(MANDIR)/man8 - install -m$(MANMODE) inetd.8 $(INSTALLROOT)$(MANDIR)/man8 - - clean: -diff -Nru netkit-base-0.17/inetd/builtins.c netkit-base/inetd/builtins.c ---- netkit-base-0.17/inetd/builtins.c 2000-07-22 22:13:07.000000000 +0200 -+++ netkit-base/inetd/builtins.c 2001-01-29 03:03:20.000000000 +0100 -@@ -1,3 +1,34 @@ -+/* $USAGI: builtins.c,v 1.11 2001/01/29 02:03:20 yoshfuji Exp $ */ -+ -+/* -+ * Copyright (C) 2001 USAGI/WIDE Project. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. Neither the name of the project nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ - /* - * Internet services provided internally by inetd: - */ -@@ -13,6 +44,12 @@ - #include <stdlib.h> - #include <unistd.h> - -+#ifdef INET6 -+#include <netinet/ip6.h> -+#include <netdb.h> -+#endif -+#include <syslog.h> -+ - #include "servtab.h" - #include "builtins.h" - #include "setproctitle.h" -@@ -23,22 +60,68 @@ - char builtins_rcsid[] = - "$Id: builtins.c,v 1.5 2000/07/22 20:13:07 dholland Exp $"; - -+ -+unsigned short int -+sockaddr_port(struct sockaddr *sa, socklen_t salen) -+{ -+#ifdef INET6 -+ char sbuf[NI_MAXSERV]; -+#endif -+ unsigned short int port = 0; -+ -+#ifdef INET6 -+ if (getnameinfo(sa, salen, NULL, 0, sbuf, sizeof(sbuf), -+ NI_NUMERICSERV) == 0) -+ port = atoi(sbuf); -+ else -+#endif -+ switch (sa->sa_family) { -+ case AF_INET: -+ port = ntohs(((struct sockaddr_in *)sa)->sin_port); -+ break; -+#ifdef INET6 -+ case AF_INET6: -+ port = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); -+ break; -+#endif -+ default: -+ /* everything went wrong :-P */ -+ syslog(LOG_ERR, "cannot find port number: %m"); -+ exit(1); -+ } -+ return port; -+} -+ -+ - static void - do_setproctitle(char *a, int s) - { -- struct sockaddr_in sn; -- socklen_t size = sizeof(sn); -- -- if (getpeername(s, (struct sockaddr *)&sn, &size) == 0) { -- setproctitle("-%s [%s]", a, inet_ntoa(sn.sin_addr)); -- } -- else { -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif -+ socklen_t size = sizeof(sa); -+ -+ if (getpeername(s, (struct sockaddr *)&sa, &size) == 0) { -+#ifdef INET6 -+ char buf[INET6_ADDRSTRLEN+1]; -+ -+ if(getnameinfo((struct sockaddr *)&sa, size, buf, sizeof(buf), -+ NULL, 0, NI_NUMERICHOST) == 0) { -+ setproctitle("-%s [%s]", a, buf); -+ } else { -+ setproctitle("-%s", a); -+ } -+#else -+ setproctitle("-%s [%s]", a, inet_ntoa(((struct sockaddr_in *)&sa)->sin_addr)); -+#endif -+ } else { - setproctitle("-%s", a); - } - } - - -- - /* Echo service -- echo data back */ - /* ARGSUSED */ - void -@@ -61,10 +144,12 @@ - { - char buffer[BUFSIZE]; - int i, port; --/* size_t size; */ -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif - socklen_t size; --/* struct sockaddr sa; */ -- struct sockaddr_in sa; - - (void)sep; - -@@ -73,10 +158,11 @@ - (struct sockaddr *)&sa, &size); - if (i < 0) - return; -- port = sa.sin_port; -- if (ntohs(port) < MINUDPSRCPORT) -+ -+ port = sockaddr_port((struct sockaddr *)&sa, size); -+ if (port < MINUDPSRCPORT) - return; -- (void) sendto(s, buffer, i, 0, (struct sockaddr *)&sa, sizeof(sa)); -+ (void) sendto(s, buffer, i, 0, (struct sockaddr *)&sa, size); - } - - /* Discard service -- ignore data */ -@@ -159,7 +245,11 @@ - chargen_dg(int s, struct servtab *sep) - { - /* struct sockaddr sa; */ -- struct sockaddr_in sa; -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif - static char *rs; - size_t len; - socklen_t size; -@@ -178,8 +268,8 @@ - (struct sockaddr *)&sa, &size) < 0) - return; - -- port = sa.sin_port; -- if (ntohs(port)<MINUDPSRCPORT) -+ port = sockaddr_port((struct sockaddr *)&sa, size); -+ if (port < MINUDPSRCPORT) - return; - - if ((len = endring - rs) >= LINESIZ) -@@ -193,7 +283,7 @@ - text[LINESIZ] = '\r'; - text[LINESIZ + 1] = '\n'; - (void) sendto(s, text, sizeof(text), 0, -- (struct sockaddr *)&sa, sizeof(sa)); -+ (struct sockaddr *)&sa, size); - } - - /* -@@ -236,7 +326,11 @@ - { - unsigned long result; - /* struct sockaddr sa; */ -- struct sockaddr_in sa; -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif - /* size_t size; */ - socklen_t size; - int port; -@@ -246,12 +340,13 @@ - if (recvfrom(s, (char *)&result, sizeof(result), 0, - (struct sockaddr *)&sa, &size) < 0) - return; -- port = sa.sin_port; -- if (ntohs(port) < MINUDPSRCPORT) -+ -+ port = sockaddr_port((struct sockaddr *)&sa, size); -+ if (port < MINUDPSRCPORT) - return; - result = machtime(); - (void) sendto(s, (char *) &result, sizeof(result), 0, -- (struct sockaddr *)&sa, sizeof(sa)); -+ (struct sockaddr *)&sa, size); - } - - /* Return human-readable time of day */ -@@ -274,8 +369,11 @@ - { - char buffer[256]; - time_t clocc; -- struct sockaddr_in sa; --/* size_t size; */ -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif - socklen_t size; - int port; - -@@ -286,10 +384,11 @@ - if (recvfrom(s, buffer, sizeof(buffer), 0, - (struct sockaddr *)&sa, &size) < 0) - return; -- port = sa.sin_port; -- if (ntohs(port) < MINUDPSRCPORT) -+ -+ port = sockaddr_port((struct sockaddr *)&sa, size); -+ if (port < MINUDPSRCPORT) - return; - snprintf(buffer, sizeof(buffer), "%.24s\r\n", ctime(&clocc)); - sendto(s, buffer, strlen(buffer), 0, -- (struct sockaddr *)&sa, sizeof(sa)); -+ (struct sockaddr *)&sa, size); - } -diff -Nru netkit-base-0.17/inetd/builtins.h netkit-base/inetd/builtins.h ---- netkit-base-0.17/inetd/builtins.h 1999-08-23 04:30:24.000000000 +0200 -+++ netkit-base/inetd/builtins.h 2001-01-27 14:14:00.000000000 +0100 -@@ -8,3 +8,4 @@ - void machtime_dg(int, struct servtab *); - void daytime_dg(int, struct servtab *); - void chargen_dg(int, struct servtab *); -+unsigned short int sockaddr_port(struct sockaddr *sa, socklen_t salen); -diff -Nru netkit-base-0.17/inetd/depend.mk netkit-base/inetd/depend.mk ---- netkit-base-0.17/inetd/depend.mk 1999-08-23 04:30:24.000000000 +0200 -+++ netkit-base/inetd/depend.mk 2001-01-29 02:48:42.000000000 +0100 -@@ -1,7 +1,10 @@ - builtins.o: builtins.c servtab.h builtins.h setproctitle.h - daemon.o: daemon.c daemon.h -+doalloc.o: doalloc.c mysleep.h inetd.h -+inet6d.o: inet6d.c setproctitle.h mysleep.h pathnames.h - inetd.o: inetd.c ../version.h pathnames.h inetd.h servtab.h sig.h \ -- daemon.h setproctitle.h --servtab.o: servtab.c inetd.h servtab.h builtins.h sig.h -+ daemon.h setproctitle.h builtins.h mysleep.h -+mysleep.o: mysleep.c mysleep.h -+servtab.o: servtab.c inetd.h servtab.h builtins.h sig.h mysleep.h - setproctitle.o: setproctitle.c setproctitle.h inetd.h - sig.o: sig.c sig.h -diff -Nru netkit-base-0.17/inetd/doalloc.c netkit-base/inetd/doalloc.c ---- netkit-base-0.17/inetd/doalloc.c 1970-01-01 01:00:00.000000000 +0100 -+++ netkit-base/inetd/doalloc.c 2001-01-28 02:31:14.000000000 +0100 -@@ -0,0 +1,90 @@ -+/* $USAGI: doalloc.c,v 1.3 2001/01/28 01:31:14 yoshfuji Exp $ */ -+ -+/* -+ * Copyright (c) 1983, 1991 The Regents of the University of California. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. All advertising materials mentioning features or use of this software -+ * must display the following acknowledgement: -+ * This product includes software developed by the University of -+ * California, Berkeley and its contributors. -+ * 4. Neither the name of the University nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+#include <sys/types.h> -+#include <sys/time.h> -+#include <sys/socket.h> -+#include <netinet/in.h> -+#include <sys/un.h> -+#include <netdb.h> -+#include <syslog.h> -+#include <signal.h> -+#include <unistd.h> -+#include <stdlib.h> -+#include <stdio.h> -+#include "mysleep.h" -+#include "inetd.h" -+ -+/********* exit-resistant malloc ************************/ -+ -+/* -+ * On many systems, including presently Linux, this is bloat because -+ * malloc never returns null - if the system runs out of swap, it -+ * panics or randomly starts killing processes or does other weird -+ * stuff. However, it doesn't hurt to be prepared. This is the only -+ * place inetd can actually exit due to failure, now. -+ */ -+ -+void * -+domalloc(size_t len) -+{ -+ static int retries[] = { 2, 10, 60, 600, -1 }; -+ void *p; -+ int try = 0; -+ -+ while (retries[try]>0) { -+ p = malloc(len); -+ if (p != NULL) { -+ return p; -+ } -+ -+ syslog(LOG_ERR, "Out of memory - retrying in %d seconds.", -+ retries[try]); -+ mysleep(retries[try]); -+ try++; -+ } -+ /* Should this be LOG_EMERG? */ -+ syslog(LOG_ALERT, "Out of memory - GIVING UP!"); -+ exit(100); -+ return NULL; /* unreachable */ -+} -+ -+char * -+dostrdup(const char *cp) -+{ -+ char *x = domalloc(strlen(cp)+1); -+ strcpy(x, cp); -+ return x; -+} -diff -Nru netkit-base-0.17/inetd/inetd.8 netkit-base/inetd/inetd.8 ---- netkit-base-0.17/inetd/inetd.8 2000-07-31 01:56:58.000000000 +0200 -+++ netkit-base/inetd/inetd.8 2001-01-29 06:23:38.000000000 +0100 -@@ -1,3 +1,30 @@ -+.\" Copyright (C) 2001 USAGI/WIDE Project. -+.\" All rights reserved. -+.\" -+.\" Redistribution and use in source and binary forms, with or without -+.\" modification, are permitted provided that the following conditions -+.\" are met: -+.\" 1. Redistributions of source code must retain the above copyright -+.\" notice, this list of conditions and the following disclaimer. -+.\" 2. Redistributions in binary form must reproduce the above copyright -+.\" notice, this list of conditions and the following disclaimer in the -+.\" documentation and/or other materials provided with the distribution. -+.\" 3. Neither the name of the project nor the names of its contributors -+.\" may be used to endorse or promote products derived from this software -+.\" without specific prior written permission. -+.\" -+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND -+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE -+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+.\" SUCH DAMAGE. -+.\" - .\" Copyright (c) 1985, 1991 The Regents of the University of California. - .\" All rights reserved. - .\" -@@ -183,7 +210,27 @@ - Examples might be - .Dq tcp - or --.Dq udp . -+.Dq udp , -+both of which imply IPv4 for backward compatibility. -+The names -+.Dq tcp4 -+and -+.Dq udp4 -+specify IPv4 only. -+The names -+.Dq tcp6 -+and -+.Dq udp6 -+specify IPv6 only; -+inetd will reject / ignore packets from ipv4 clients. -+The names -+.Dq tcp46 -+and -+.Dq udp46 -+specify that the entry accepts both IPv4 and IPv6 connections -+via a wildcard -+.Dv PF_INET6 -+socket. - Rpc based services are specified with the - .Dq rpc/tcp - or -@@ -315,3 +362,7 @@ - based services is modelled after that - provided by - .Em SunOS 4.1 . -+.Em IPv6 -+support was developed by USAGI Project, -+based on Mauro Tortonesi <mauro@ferrara.linux.it>'s patch. -+ -diff -Nru netkit-base-0.17/inetd/inetd.c netkit-base/inetd/inetd.c ---- netkit-base-0.17/inetd/inetd.c 2000-07-25 01:48:34.000000000 +0200 -+++ netkit-base/inetd/inetd.c 2001-02-11 03:30:33.000000000 +0100 -@@ -1,3 +1,34 @@ -+/* $USAGI: inetd.c,v 1.14 2001/02/11 02:30:33 yoshfuji Exp $ */ -+ -+/* -+ * Copyright (C) 2001 USAGI/WIDE Project. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. Neither the name of the project nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ - /* - * Copyright (c) 1983, 1991 The Regents of the University of California. - * All rights reserved. -@@ -41,7 +72,11 @@ - char rcsid[] = - "$Id: inetd.c,v 1.38 2000/07/24 23:48:34 dholland Exp $"; - -+#ifdef _USAGI -+#include "version.h" -+#else - #include "../version.h" -+#endif - - /* - * Inetd - Internet super-server -@@ -137,7 +172,17 @@ - #include <getopt.h> - #include <stdlib.h> - #include <unistd.h> -+#ifndef HAVE_DAEMON -+#include "daemon.h" -+#endif -+#ifdef MULOG -+#include <signal.h> -+#endif - -+#ifdef INET6 -+#include <netinet/ip6.h> -+#endif -+ - #ifndef __linux__ - #ifndef RLIMIT_NOFILE - #define RLIMIT_NOFILE RLIMIT_OFILE -@@ -148,8 +193,8 @@ - #include "inetd.h" - #include "servtab.h" - #include "sig.h" --#include "daemon.h" - #include "setproctitle.h" -+#include "builtins.h" - #include "mysleep.h" - - #ifdef RPC /* must come after inetd.h, which defines RPC */ -@@ -176,6 +221,12 @@ - - static void attempt_to_restart(void); - -+#ifdef MULOG -+static void dolog(struct servtab *, int); -+char *rfc931_name(struct sockaddr *, int); -+static void timeout(int); -+#endif -+ - struct servtab *servtab; /* service table */ - const char *configfile = _PATH_INETDCONF; /* config file path */ - int debug = 0; /* debug flag */ -@@ -189,7 +240,7 @@ - static int options; - static int timingout; - --static long rlim_ofile_cur = DEFAULT_FILE_LIMIT; -+static unsigned long rlim_ofile_cur = DEFAULT_FILE_LIMIT; - - #ifdef RLIMIT_NOFILE - struct rlimit rlim_ofile; -@@ -457,6 +508,13 @@ - { - char buf[50]; - int ctrl, dofork; -+#ifdef INET6 -+ struct sockaddr_storage sa; -+#else -+ struct sockaddr sa; -+#endif -+ socklen_t salen = sizeof(&sa); -+ int nowait = 0; - - if (debug) { - fprintf(stderr, "launching: %s\n", sep->se_service); -@@ -465,9 +523,26 @@ - if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) { - /* Do nonblocking accept, just in case */ - fcntl(sep->se_fd, F_SETFL, O_NDELAY); -- ctrl = accept(sep->se_fd, NULL, NULL); -+ ctrl = accept(sep->se_fd, (struct sockaddr *)&sa, &salen); - fcntl(sep->se_fd, F_SETFL, 0); -+#ifdef INET6 -+ nowait = 1; -+#endif -+ } else { -+ ctrl = sep->se_fd; -+ } -+#ifdef INET6 -+ if (sep->se_sockopt_ipv6_only && -+ ((struct sockaddr *)&sa)->sa_family == AF_INET6 && -+ IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&sa)->sin6_addr)) { -+ syslog(LOG_WARNING, "packet arrived via ipv4 mapped address; ignored."); -+ if (nowait) -+ close(ctrl); -+ return; -+ } -+#endif - -+ if (nowait) { - if (debug) { - fprintf(stderr, "accept: new socket %d\n", ctrl); - } -@@ -485,9 +560,6 @@ - return; - } - } -- else { -- ctrl = sep->se_fd; -- } - - dofork = (sep->se_bi == NULL || sep->se_bi->bi_fork); - if (dofork) { -@@ -844,6 +916,9 @@ - (void)unlink(sep->se_service); - break; - case AF_INET: -+#ifdef INET6 -+ case AF_INET6: -+#endif - if (sep->se_wait == 1 && isrpcservice(sep)) - unregister_rpc(sep); - break; -@@ -886,6 +961,13 @@ - syslog(LOG_ERR, "setsockopt (SO_DEBUG): %m"); - if (turnon(sep->se_fd, SO_REUSEADDR) < 0) - syslog(LOG_ERR, "setsockopt (SO_REUSEADDR): %m"); -+#ifdef INET6 -+#ifdef IPV6_V6ONLY -+ if (sep->se_sockopt_ipv6_only == 1 && -+ setsockopt(sep->se_fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof (on)) <0) -+ syslog(LOG_ERR, "setsockopt (IPPROTO_IPV6, IPV6_V6ONLY): %m"); -+#endif -+#endif - #undef turnon - if (bind(sep->se_fd, &sep->se_ctrladdr, sep->se_ctrladdr_size) < 0) { - syslog(LOG_ERR, "%s: bind: %m", service_name(sep), -@@ -898,6 +980,10 @@ - } - return; - } -+#ifdef INET6 -+ if (debug) -+ fprintf(stderr, "bound to af: %i\n", sep->se_family); -+#endif - if (sep->se_socktype == SOCK_STREAM) - listen(sep->se_fd, global_queuelen); - -@@ -916,7 +1002,7 @@ - nsock++; - if (sep->se_fd > maxsock) { - maxsock = sep->se_fd; -- if (maxsock > rlim_ofile_cur - FD_MARGIN) -+ if ((unsigned int)maxsock + FD_MARGIN > rlim_ofile_cur) - bump_nofile(); - } - } -@@ -927,8 +1013,12 @@ - #ifdef RPC - /* size_t m; */ - socklen_t m; -- int i; -+ int i, port; -+#ifdef INET6 -+ struct sockaddr_storage sn; -+#else - struct sockaddr_in sn; -+#endif - struct protoent *pp; - - if ((pp = getprotobyname(sep->se_proto+4)) == NULL) { -@@ -943,16 +1033,18 @@ - return; - } - -+ port = sockaddr_port((struct sockaddr *)&sn, m); -+ - for (i = sep->se_rpcversl; i <= sep->se_rpcversh; i++) { - if (debug) - fprintf(stderr, "pmap_set: %u %u %u %u\n", - sep->se_rpcprog, i, -- pp->p_proto, ntohs(sn.sin_port)); -+ pp->p_proto, port); - (void)pmap_unset(sep->se_rpcprog, i); -- if (!pmap_set(sep->se_rpcprog, i, pp->p_proto, ntohs(sn.sin_port))) -+ if (!pmap_set(sep->se_rpcprog, i, pp->p_proto, port)) - syslog(LOG_ERR, "pmap_set: %u %u %u %u: %m", - sep->se_rpcprog, i, -- pp->p_proto, ntohs(sn.sin_port)); -+ pp->p_proto, port); - } - #endif /* RPC */ - } -@@ -1048,45 +1140,75 @@ - - - #ifdef MULOG -+static -+void - dolog(sep, ctrl) - struct servtab *sep; - int ctrl; - { -+#ifdef INET6 -+ struct sockaddr_storage sa; -+ char host[NI_MAXHOST]; -+#else - struct sockaddr sa; - struct sockaddr_in *sin = (struct sockaddr_in *)&sa; -- int len = sizeof(sa); - struct hostent *hp; -- char *host, *dp, buf[BUFSIZ], *rfc931_name(); -+ char *host; -+#endif -+ socklen_t len = sizeof(sa); -+ char buf[BUFSIZ]; - int connected = 1; - -- if (sep->se_family != AF_INET) -+ if (sep->se_family != AF_INET -+#ifdef INET6 -+ && sep->se_family != AF_INET6 -+#endif -+ ) - return; - -- if (getpeername(ctrl, &sa, &len) < 0) { -+ if (getpeername(ctrl, (struct sockaddr *)&sa, &len) < 0) { - if (errno != ENOTCONN) { - syslog(LOG_ERR, "getpeername: %m"); - return; - } -- if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, &sa, &len) < 0) { -+ if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, -+ (struct sockaddr *)&sa, &len) < 0) { - syslog(LOG_ERR, "recvfrom: %m"); - return; - } - connected = 0; - } -- if (sa.sa_family != AF_INET) { -- syslog(LOG_ERR, "unexpected address family %u", sa.sa_family); -+ if (((struct sockaddr *)&sa)->sa_family != AF_INET -+#ifdef INET6 -+ && ((struct sockaddr *)&sa)->sa_family != AF_INET6 -+#endif -+ ) { -+ syslog(LOG_ERR, "unexpected address family %u", -+ ((struct sockaddr *)&sa)->sa_family); - return; - } - -+#ifdef INET6 -+ if (getnameinfo((struct sockaddr *)&sa, len, -+ host, sizeof(host), NULL, 0, 0)) { -+ syslog(LOG_ERR, "cannot do getnameinfo: family %u", -+ ((struct sockaddr *)&sa)->sa_family); -+ return; -+ } -+#else - hp = gethostbyaddr((char *) &sin->sin_addr.s_addr, - sizeof (sin->sin_addr.s_addr), AF_INET); - - host = hp?hp->h_name:inet_ntoa(sin->sin_addr); -+#endif - - switch (sep->se_log & ~MULOG_RFC931) { - case 0: - return; - case 1: -+ { -+#if 0 /* XXX where is curdom? */ -+ char *dp; - if (curdom == NULL || *curdom == '\0') - break; - dp = host + strlen(host) - strlen(curdom); -@@ -1097,7 +1219,9 @@ - host, curdom); - if (strcasecmp(dp, curdom) == 0) - return; -+#endif - break; -+ } - case 2: - default: - break; -@@ -1107,7 +1231,7 @@ - - if (connected && (sep->se_log & MULOG_RFC931)) - syslog(LOG_INFO, "%s@%s wants %s", -- rfc931_name(sin, ctrl), host, sep->se_service); -+ rfc931_name((struct sockaddr *)&sa, ctrl), host, sep->se_service); - else - syslog(LOG_INFO, "%s wants %s", - host, sep->se_service); -@@ -1139,11 +1263,17 @@ - /* rfc931_name - return remote user name */ - - char * --rfc931_name(struct sockaddr_in *there, int ctrl) -+rfc931_name(struct sockaddr *there, int ctrl) - { - /* "there" is remote link information */ -- struct sockaddr_in here; /* local link information */ -- struct sockaddr_in sin; /* for talking to RFC931 daemon */ -+#ifdef INET6 -+ struct sockaddr_storage here; /* local link information */ -+ struct sockaddr_storage sa; /* for talking to RFC931 daemon */ -+#else -+ struct sockaddr here; /* local link information */ -+ struct sockaddr sa; /* for talking to RFC931 daemon */ -+#endif -+ unsigned int there_port, here_port; - int length; - int s; - unsigned remote; -@@ -1152,7 +1282,7 @@ - char buf[256]; - char *cp; - char *result = "USER_UNKNOWN"; -- int len; -+ size_t len; - - /* Find out local port number of our stdin. */ - -@@ -1161,33 +1291,70 @@ - syslog(LOG_ERR, "getsockname: %m"); - return (result); - } -- /* Set up timer so we won't get stuck. */ - -- if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) { -+ memcpy(&sa, &here, sizeof(sa)); -+ switch(((struct sockaddr *) &here)->sa_family) { -+ case AF_INET: -+ ((struct sockaddr_in *)&sa)->sin_port = htons(0); -+ break; -+#ifdef INET6 -+ case AF_INET6: -+ ((struct sockaddr_in6 *)&sa)->sin6_port = htons(0); -+ break; -+#endif -+ default: -+ syslog(LOG_ERR, "getsockname: unsupported family %d", -+ ((struct sockaddr *) &here)->sa_family); -+ return (result); -+ } -+ -+ s = socket(((struct sockaddr*)&here)->sa_family, SOCK_STREAM, 0); -+ if (s == -1) { - syslog(LOG_ERR, "socket: %m"); - return (result); - } - -- sin = here; -- sin.sin_port = htons(0); -- if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) { -+ if (bind(s, (struct sockaddr *) &sa, length) == -1) { - syslog(LOG_ERR, "bind: %m"); - close(s); - return (result); - } - -+ /* Set up timer so we won't get stuck. */ -+ - signal(SIGALRM, timeout); -- if (sigsetjmp(timebuf)) { -+ if (sigsetjmp(timebuf, 0)) { - close(s); /* not: fclose(fp) */ - return (result); - } - alarm(TIMEOUT); - -+ /* ports */ -+ there_port = ntohs(((struct sockaddr_in *)there)->sin_port); -+ here_port = ntohs(((struct sockaddr_in *)&here)->sin_port); -+ - /* Connect to the RFC931 daemon. */ - -- sin = *there; -- sin.sin_port = htons(RFC931_PORT); -- if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == -1) { -+ length = SA_LEN((struct sockaddr *)there); -+ memcpy(&sa, there, length); -+ switch(((struct sockaddr *) there)->sa_family) { -+ case AF_INET: -+ ((struct sockaddr_in *)&sa)->sin_port = htons(RFC931_PORT); -+ break; -+#ifdef INET6 -+ case AF_INET6: -+ ((struct sockaddr_in6 *)&sa)->sin6_port = htons(RFC931_PORT); -+ break; -+#endif -+ default: -+ syslog(LOG_ERR, "unsupported remote family %u", -+ ((struct sockaddr *) there)->sa_family); -+ close(s); -+ alarm(0); -+ return result; -+ } -+ -+ if (connect(s, (struct sockaddr *) &sa, length) == -1) { - close(s); - alarm(0); - return (result); -@@ -1195,7 +1362,7 @@ - - /* Query the RFC 931 server. Would 13-byte writes ever be broken up? */ - snprintf(buf, sizeof(buf), "%u,%u\r\n", -- ntohs(there->sin_port), ntohs(here.sin_port)); -+ there_port, here_port); - - - for (len = 0, cp = buf; len < strlen(buf); ) { -@@ -1224,11 +1391,11 @@ - *cp = '\0'; - - if (sscanf(buf, "%u , %u : USERID :%*[^:]:%255s", &remote, &local, user) == 3 -- && ntohs(there->sin_port) == remote -- && ntohs(here.sin_port) == local) { -+ && there_port == remote -+ && here_port == local) { - - /* Strip trailing carriage return. */ -- if (cp = strchr(user, '\r')) -+ if ((cp = strchr(user, '\r')) != NULL) - *cp = 0; - result = user; - } -diff -Nru netkit-base-0.17/inetd/pathnames.h netkit-base/inetd/pathnames.h ---- netkit-base-0.17/inetd/pathnames.h 2000-07-23 01:00:05.000000000 +0200 -+++ netkit-base/inetd/pathnames.h 2001-04-03 22:33:59.000000000 +0200 -@@ -36,6 +36,14 @@ - - #include <paths.h> - -+#ifndef _PATH_INETDCONF - #define _PATH_INETDCONF "/etc/inetd.conf" -+#endif -+ -+#ifndef _PATH_INETDPID - #define _PATH_INETDPID "/var/run/inetd.pid" -+#endif -+ -+#ifndef _PATH_INETD - #define _PATH_INETD "/usr/sbin/inetd" -+#endif -diff -Nru netkit-base-0.17/inetd/servtab.c netkit-base/inetd/servtab.c ---- netkit-base-0.17/inetd/servtab.c 2000-07-22 22:20:50.000000000 +0200 -+++ netkit-base/inetd/servtab.c 2001-01-29 19:38:19.000000000 +0100 -@@ -1,3 +1,34 @@ -+/* $USAGI: servtab.c,v 1.10 2001/01/29 18:38:19 yoshfuji Exp $ */ -+ -+/* -+ * Copyright (C) 2001 USAGI/WIDE Project. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * 3. Neither the name of the project nor the names of its contributors -+ * may be used to endorse or promote products derived from this software -+ * without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ - /* - * Copyright (c) 1983, 1991 The Regents of the University of California. - * All rights reserved. -@@ -42,6 +73,9 @@ - #include <unistd.h> - #include <stdlib.h> - #include <stdio.h> -+#ifdef MULOG -+#include <ctype.h> -+#endif - - #include "inetd.h" - #include "servtab.h" -@@ -49,6 +83,10 @@ - #include "sig.h" - #include "mysleep.h" - -+#ifdef INET6 -+#include <netinet/ip6.h> -+#endif -+ - char servtab_rcsid[] = - "$Id: servtab.c,v 1.6 2000/07/22 20:20:50 dholland Exp $"; - -@@ -104,6 +142,7 @@ - { - struct servtab *sep; - for (sep = servtab; sep; sep = sep->se_next) { -+ if (sep->se_family != cp->se_family) continue; - if (strcmp(sep->se_service, cp->se_service)) continue; - if (strcmp(sep->se_proto, cp->se_proto)) continue; - -@@ -123,8 +162,21 @@ - if (sep->se_address==NULL || cp->se_address==NULL) continue; - - /* Don't bother to compare the hostnames, just the IPs */ -- if (sep->se_ctrladdr_in.sin_addr.s_addr == -- cp->se_ctrladdr_in.sin_addr.s_addr) return sep; -+ switch(sep->se_family) { -+#ifdef INET6 -+ case AF_INET6: -+ if (memcmp(&sep->se_ctrladdr_in6.sin6_addr, -+ &cp->se_ctrladdr_in6.sin6_addr, -+ sizeof(struct in6_addr)) == 0) return sep; -+ break; -+#endif -+ case AF_INET: -+ if (sep->se_ctrladdr_in.sin_addr.s_addr == -+ cp->se_ctrladdr_in.sin_addr.s_addr) return sep; -+ break; -+ default: -+ /*XXX*/ -+ } - } - return NULL; - } -@@ -144,49 +196,6 @@ - return rv; - } - --/********* exit-resistant malloc ************************/ -- --/* -- * On many systems, including presently Linux, this is bloat because -- * malloc never returns null - if the system runs out of swap, it -- * panics or randomly starts killing processes or does other weird -- * stuff. However, it doesn't hurt to be prepared. This is the only -- * place inetd can actually exit due to failure, now. -- */ -- --void * --domalloc(size_t len) --{ -- static int retries[] = { 2, 10, 60, 600, -1 }; -- void *p; -- int try = 0; -- -- while (retries[try]>0) { -- p = malloc(len); -- if (p != NULL) { -- return p; -- } -- -- syslog(LOG_ERR, "Out of memory - retrying in %d seconds.", -- retries[try]); -- mysleep(retries[try]); -- try++; -- } -- /* Should this be LOG_EMERG? */ -- syslog(LOG_ALERT, "Out of memory - GIVING UP!"); -- exit(100); -- return NULL; /* unreachable */ --} -- --char * --dostrdup(const char *cp) --{ -- char *x = domalloc(strlen(cp)+1); -- strcpy(x, cp); -- return x; --} -- -- - /********* config parser ********************************/ - - static void loadconfigent(struct servtab *cp); -@@ -194,203 +203,6 @@ - static FILE *fconfig = NULL; - - --#if 0 /* old version */ --static struct servtab serv; --static char line[256]; -- --static --char * --nextline(FILE *fd) --{ -- char *cp; -- -- if (fgets(line, sizeof (line), fd) == NULL) -- return ((char *)0); -- cp = strchr(line, '\n'); -- if (cp) -- *cp = '\0'; -- return (line); --} -- --static --char * --skip(char **cpp) --{ -- register char *cp = *cpp; -- char *start; -- -- if (*cpp == NULL) -- return ((char *)0); -- --again: -- while (*cp == ' ' || *cp == '\t') -- cp++; -- if (*cp == '\0') { -- int c; -- -- c = getc(fconfig); -- (void) ungetc(c, fconfig); -- if (c == ' ' || c == '\t') -- if ((cp = nextline(fconfig))!=NULL) -- goto again; -- *cpp = NULL; -- return NULL; -- } -- start = cp; -- while (*cp && *cp != ' ' && *cp != '\t') -- cp++; -- if (*cp != '\0') -- *cp++ = '\0'; -- *cpp = cp; -- return (start); --} -- --static --struct servtab * --getconfigent(void) --{ -- register struct servtab *sep = &serv; -- int argc; -- char *cp, *arg; -- --more: -- while ((cp = nextline(fconfig)) && *cp == '#') -- ; -- -- if (cp == NULL) { -- return NULL; -- } -- -- memset(sep, 0, sizeof(*sep)); -- sep->se_service = dostrdup(skip(&cp)); -- arg = skip(&cp); -- if (arg == NULL) -- goto more; -- -- if (strcmp(arg, "stream") == 0) -- sep->se_socktype = SOCK_STREAM; -- else if (strcmp(arg, "dgram") == 0) -- sep->se_socktype = SOCK_DGRAM; -- else if (strcmp(arg, "rdm") == 0) -- sep->se_socktype = SOCK_RDM; -- else if (strcmp(arg, "seqpacket") == 0) -- sep->se_socktype = SOCK_SEQPACKET; -- else if (strcmp(arg, "raw") == 0) -- sep->se_socktype = SOCK_RAW; -- else -- sep->se_socktype = -1; -- -- sep->se_proto = dostrdup(skip(&cp)); -- if (strcmp(sep->se_proto, "unix") == 0) { -- sep->se_family = AF_UNIX; -- } else { -- sep->se_family = AF_INET; -- if (strncmp(sep->se_proto, "rpc/", 4) == 0) { --#ifdef RPC -- char *cp1, *ccp; -- cp1 = index(sep->se_service, '/'); -- if (cp1 == NULL) { -- syslog(LOG_ERR, "%s: no rpc version", -- sep->se_service); -- goto more; -- } -- *cp1++ = '\0'; -- sep->se_rpcversl = -- sep->se_rpcversh = strtol(cp1, &ccp, 0); -- if (ccp == cp1) { -- badafterall: -- syslog(LOG_ERR, "%s/%s: bad rpc version", -- sep->se_service, cp1); -- goto more; -- } -- if (*ccp == '-') { -- cp1 = ccp + 1; -- sep->se_rpcversh = strtol(cp1, &ccp, 0); -- if (ccp == cp1) -- goto badafterall; -- } --#else -- syslog(LOG_ERR, "%s: rpc services not supported", -- sep->se_service); -- goto more; --#endif /* RPC */ -- } -- } -- arg = skip(&cp); -- if (arg == NULL) -- goto more; -- { -- char *s = index(arg, '.'); -- if (s) { -- *s++ = '\0'; -- sep->se_max = atoi(s); -- } else -- sep->se_max = TOOMANY; -- } -- sep->se_wait = strcmp(arg, "wait") == 0; -- sep->se_user = dostrdup(skip(&cp)); -- sep->se_group = strchr(sep->se_user, '.'); -- if (sep->se_group) { -- *sep->se_group++ = '\0'; -- } -- sep->se_server = dostrdup(skip(&cp)); -- if (strcmp(sep->se_server, "internal") == 0) { -- register struct biltin *bi; -- -- for (bi = biltins; bi->bi_service; bi++) -- if (bi->bi_socktype == sep->se_socktype && -- strcmp(bi->bi_service, sep->se_service) == 0) -- break; -- if (bi->bi_service == 0) { -- syslog(LOG_ERR, "internal service %s unknown\n", -- sep->se_service); -- goto more; -- } -- sep->se_bi = bi; -- sep->se_wait = bi->bi_wait; -- } else -- sep->se_bi = NULL; -- argc = 0; -- for (arg = skip(&cp); cp; arg = skip(&cp)) { --#if MULOG -- char *colon, *rindex(); -- -- if (argc == 0 && (colon = rindex(arg, ':'))) { -- while (arg < colon) { -- int x; -- char *ccp; -- -- switch (*arg++) { -- case 'l': -- x = 1; -- if (isdigit(*arg)) { -- x = strtol(arg, &ccp, 0); -- if (ccp == arg) -- break; -- arg = ccp; -- } -- sep->se_log &= ~MULOG_RFC931; -- sep->se_log |= x; -- break; -- case 'a': -- sep->se_log |= MULOG_RFC931; -- break; -- default: -- break; -- } -- } -- arg = colon + 1; -- } --#endif -- if (argc < MAXARGV) -- sep->se_argv[argc++] = dostrdup(arg); -- } -- while (argc <= MAXARGV) -- sep->se_argv[argc++] = NULL; -- return (sep); --} --#else /* new version begins here */ -- - struct wordmap { - const char *word; - int val; -@@ -434,8 +246,18 @@ - const char * - assemble_entry(struct servtab *sep, int nfields, char **fields) - { -+ char *proto; -+ int use_family = PF_UNSPEC; -+#ifdef INET6 -+ int use_v6only = 0; -+ struct sockaddr_storage service_home; -+ struct addrinfo hints, *res0, *res; -+ char *serv = "discard"; /* discard(dummy) */ -+ int err; -+#else - struct in_addr service_home; - struct hostent *hp; -+#endif - char *s, *t; - int i; - -@@ -444,33 +266,138 @@ - } - - memset(sep, 0, sizeof(*sep)); -+ memset(&service_home, 0, sizeof(service_home)); -+ -+ proto = fields[2]; -+ if (!strcmp(fields[2], "unix")) { -+ use_family = PF_UNIX; -+ } else { -+ char *p = strchr(proto, '/'); -+ if (p) -+ proto = p + 1; -+ -+ if (strncmp(proto, "udp", 3) == 0 || -+ strncmp(proto, "tcp", 3) == 0) { -+ int len = strlen(proto); -+ -+ switch(len) { -+ case 3: -+ use_family = PF_INET; -+ break; -+ case 4: -+ if (*(proto + 3) == '4') -+ use_family = PF_INET; -+#ifdef INET6 -+ else if (*(proto + 3) == '6') { -+ use_family = PF_INET6; -+ use_v6only = 1; -+ } -+#endif -+ else -+ return "Invalid / unsupported protocol"; -+ break; -+ case 5: -+#ifdef INET6 -+ if (strcmp(proto + 3, "46") == 0) -+ use_family = PF_INET6; -+ else -+#endif -+ return "Invalid / unsupported protocol"; -+ break; -+ default: -+ return "Invalid / unsupported protocol"; -+ } - -+ /* now we shall set the protocol name back to the -+ standard value. */ -+ *(proto + 3) = '\0'; -+ } -+ } -+ - s = strchr(fields[0], '@'); - if (s) { - *s++ = 0; - sep->se_address = s; -- hp = gethostbyname(s); -- if (hp==NULL) return "Service hostname/address not found"; -- memcpy(&service_home, hp->h_addr, sizeof(service_home)); -- } -- else { -- service_home.s_addr = INADDR_ANY; -- } -- sep->se_service = fields[0]; -- sep->se_socktype = map_word(socket_types, fields[1]); -- free(fields[1]); - -- sep->se_proto = fields[2]; -- if (!strcmp(sep->se_proto, "unix")) { -- sep->se_family = AF_UNIX; -- if (sep->se_address!=NULL) { -+ if (use_family == PF_UNIX) { - return "@host given for unix socket"; - } - } -- else { -- sep->se_family = AF_INET; -+ -+#ifdef INET6 -+ memset(&hints, 0, sizeof(hints)); -+ hints.ai_family = use_family; -+ hints.ai_flags = AI_PASSIVE; -+ -+ err = getaddrinfo(s, s ? NULL : serv, &hints, &res0); -+ if (err) -+ return gai_strerror(err); -+ -+ for (res=res0; res; res=res->ai_next){ -+ switch(res->ai_family){ -+ case PF_INET: -+ ((struct sockaddr_in*)res->ai_addr)->sin_port = 0; -+ break; -+ case PF_INET6: -+ ((struct sockaddr_in6*)res->ai_addr)->sin6_port = 0; -+ break; -+ case PF_UNIX: -+ ((struct sockaddr_un*)res->ai_addr)->sun_path[0] = 0; -+ break; -+ default: -+ /*XXX*/ -+ break; -+ } -+ } -+ -+ if (res0==NULL) -+ return "Service hostname/address not found"; -+ -+ if ((size_t)res0->ai_addrlen > sizeof(sep->se_ctrladdr_storage)) { -+ freeaddrinfo(res0); -+ return "sockaddr got from getaddrinfo() was too large"; -+ } -+ -+ memcpy(&service_home, res0->ai_addr, res0->ai_addrlen); -+ sep->se_ctrladdr_storage = service_home; -+ sep->se_ctrladdr_size = res0->ai_addrlen; -+ if (use_v6only) -+ sep->se_sockopt_ipv6_only = 1; -+ -+ freeaddrinfo(res0); -+#else -+ switch (use_family) { -+ case PF_INET: -+ if (s) { -+ hp = gethostbyname(s); -+ if (hp==NULL) -+ return "Service hostname/address not found"; -+ memcpy(&service_home, hp->h_addr, sizeof(service_home)); -+ } -+ else -+ service_home.s_addr = INADDR_ANY; -+ sep->se_ctrladdr_size = sizeof(struct sockaddr_in); -+ sep->se_ctrladdr_in.sin_family = PF_INET; - sep->se_ctrladdr_in.sin_addr = service_home; -+ break; -+ case PF_UNIX: -+ sep->se_ctrladdr_size = sizeof(struct sockaddr_un); -+ sep->se_ctrladdr_un.sun_family = PF_UNIX; -+ strncpy(sep->se_ctrladdr_un.sun_path, sep->se_service, -+ sizeof(sep->se_ctrladdr_un.sun_path)); -+ sep->se_ctrladdr_un.sun_path[sizeof(sep->se_ctrladdr_un.sun_path)-1] = '\0'; -+ break; -+ default: -+ /*XXX*/ -+ } -+#endif -+ -+ sep->se_family = use_family; -+ sep->se_socktype = map_word(socket_types, fields[1]); -+ sep->se_proto = proto; -+ sep->se_service = fields[0]; - -+ if (strcmp(fields[2], "unix")) { - if (!strncmp(sep->se_proto, "rpc/", 4)) { - #ifdef RPC - s = strchr(sep->se_service, '/'); -@@ -501,7 +428,6 @@ - sep->se_max = TOOMANY; - } - sep->se_wait = !strcmp(fields[3], "wait"); -- free(fields[3]); - - s = strchr(fields[4], '.'); - if (s) { -@@ -527,6 +453,35 @@ - - /* The rest are argv[]. */ - for (i=6; i<nfields; i++) { -+#ifdef MULOG -+ char *arg = fields[i], *colon; -+ if (i == 6 && (colon = rindex(arg, ':'))) { -+ while (arg < colon) { -+ int x; -+ char *ccp; -+ -+ switch (*arg++) { -+ case 'l': -+ x = 1; -+ if (isdigit(*arg)) { -+ x = strtol(arg, &ccp, 0); -+ if (ccp == arg) -+ break; -+ arg = ccp; -+ } -+ sep->se_log &= ~MULOG_RFC931; -+ sep->se_log |= x; -+ break; -+ case 'a': -+ sep->se_log |= MULOG_RFC931; -+ break; -+ default: -+ break; -+ } -+ } -+ memmove(fields[i], colon+1, strlen(colon+1)+1); -+ } -+#endif - sep->se_argv[i-6] = fields[i]; - } - -@@ -535,6 +490,8 @@ - sep->se_argv[0] = dostrdup(sep->se_server); - } - -+ free(fields[1]); -+ free(fields[3]); - return NULL; - } - -@@ -604,6 +561,9 @@ - if (errmsg) { - syslog(LOG_WARNING, "Bad config for %s: %s" - " (skipped)", fields[0], errmsg); -+ /* fix memory leak */ -+ while (nfields) -+ free(fields[--nfields]); - } - else { - sendents(&assm); -@@ -630,8 +590,6 @@ - } - } - --#endif -- - /********* config loading ****************************************/ - - static int -@@ -725,8 +683,13 @@ - * to key the table by port and protocol, not service name - * and protocol. - */ -+#ifdef INET6 -+ if ((cp->se_family==AF_INET || cp->se_family==AF_INET6) && -+ !isrpcservice(cp)) { -+#else - if (cp->se_family==AF_INET && !isrpcservice(cp)) { -- u_short port = htons(atoi(cp->se_service)); -+#endif -+ u_short port = atoi(cp->se_service); - - if (!port) { - struct servent *sp; -@@ -830,8 +793,17 @@ - setup(sep); - break; - case AF_INET: -- sep->se_ctrladdr_in.sin_family = AF_INET; -- sep->se_ctrladdr_size = sizeof sep->se_ctrladdr_in; -+#ifdef INET6 -+ case AF_INET6: -+#endif -+ sep->se_family = sep->se_family; -+#ifdef INET6 -+ sep->se_ctrladdr_size = sep->se_family == AF_INET ? -+ sizeof(struct sockaddr_in) : -+ sizeof(struct sockaddr_in6); -+#else -+ sep->se_ctrladdr_size = sizeof(struct sockaddr_in); -+#endif - if (isrpcservice(sep)) { - struct rpcent *rp; - -@@ -852,7 +824,7 @@ - register_rpc(sep); - } - else { -- u_short port = htons(atoi(sep->se_service)); -+ u_short port = atoi(sep->se_service); - - if (!port) { - struct servent *sp; -@@ -864,10 +836,20 @@ - service_name(sep)); - return; - } -- port = sp->s_port; -- } -- if (port != sep->se_ctrladdr_in.sin_port) { -- sep->se_ctrladdr_in.sin_port = port; -+ /* the s_port field of the struct servent -+ * returned by getservbyname is already in -+ * network byte order, so there is no need -+ * to call htons on sp->s_port. */ -+ port = ntohs(sp->s_port); -+ } -+ if (port != sockaddr_port(&(sep->se_ctrladdr), -+ sep->se_ctrladdr_size)) { -+#ifdef INET6 -+ if (sep->se_family == AF_INET6) -+ sep->se_ctrladdr_in6.sin6_port = htons(port); -+ else -+#endif -+ sep->se_ctrladdr_in.sin_port = htons(port); - if (sep->se_fd != -1) { - closeit(sep); - } -@@ -891,13 +873,8 @@ - } - for (sep = servtab; sep; sep = sep->se_next) - sep->se_checked = 0; --#if 0 /* old version */ -- while ((cp = getconfigent())!=NULL) { -- loadconfigent(cp); -- } --#else -+ - loadconfigfile(loadconfigent); --#endif - - endconfig(); - /* -@@ -934,6 +911,9 @@ - if (sep->se_fd == -1) { - switch (sep->se_family) { - case AF_UNIX: -+#ifdef INET6 -+ case AF_INET6: -+#endif - case AF_INET: - setup(sep); - if (sep->se_fd != -1 && isrpcservice(sep)) -diff -Nru netkit-base-0.17/inetd/servtab.h netkit-base/inetd/servtab.h ---- netkit-base-0.17/inetd/servtab.h 1999-08-23 09:22:30.000000000 +0200 -+++ netkit-base/inetd/servtab.h 2001-01-28 02:31:14.000000000 +0100 -@@ -1,3 +1,5 @@ -+/* $USAGI: servtab.h,v 1.6 2001/01/28 01:31:14 yoshfuji Exp $ */ -+ - #define MAXARGV 20 - - struct servtab; -@@ -31,6 +33,10 @@ - struct sockaddr se_un_ctrladdr; - struct sockaddr_in se_un_ctrladdr_in; - struct sockaddr_un se_un_ctrladdr_un; -+#ifdef INET6 -+ struct sockaddr_in6 se_un_ctrladdr_in6; -+ struct sockaddr_storage se_un_ctrladdr_storage; -+#endif - } se_un; /* bound address */ - int se_ctrladdr_size; - int se_max; /* max # of instances of this service */ -@@ -40,6 +46,9 @@ - int se_log; - #define MULOG_RFC931 0x40000000 - #endif -+#ifdef INET6 -+ int se_sockopt_ipv6_only; -+#endif - struct servtab *se_next; - }; - -@@ -47,6 +56,10 @@ - #define se_ctrladdr_in se_un.se_un_ctrladdr_in - #define se_ctrladdr_un se_un.se_un_ctrladdr_un - -+#ifdef INET6 -+#define se_ctrladdr_in6 se_un.se_un_ctrladdr_in6 -+#define se_ctrladdr_storage se_un.se_un_ctrladdr_storage -+#endif - - extern struct servtab *servtab; - -diff -Nru netkit-base-0.17/ping/Makefile netkit-base/ping/Makefile ---- netkit-base-0.17/ping/Makefile 2000-02-04 10:38:37.000000000 +0100 -+++ netkit-base/ping/Makefile 2001-01-27 06:57:08.000000000 +0100 -@@ -9,7 +9,9 @@ - ping.o: ../version.h pingpack.h - - install: ping -+ install -d $(INSTALLROOT)$(ROOTBINDIR) - install -s -o root -m$(SUIDMODE) ping $(INSTALLROOT)$(ROOTBINDIR) -+ install -d $(INSTALLROOT)$(MANDIR)/man8 - install -m$(MANMODE) ping.8 $(INSTALLROOT)$(MANDIR)/man8 - - clean: diff --git a/netkit-base/protocols b/netkit-base/protocols deleted file mode 100644 index 3d46a43..0000000 --- a/netkit-base/protocols +++ /dev/null @@ -1,149 +0,0 @@ -# /etc/protocols: -# $Id: protocols,v 1.2 2003/03/09 01:01:06 per Exp $ -# -# Internet (IP) protocols -# -# from: @(#)protocols 5.1 (Berkeley) 4/17/89 -# -# Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992). -# -# See also http://www.iana.org/assignments/protocol-numbers - -ip 0 IP # internet protocol, pseudo protocol number -#hopopt 0 HOPOPT # hop-by-hop options for ipv6 -icmp 1 ICMP # internet control message protocol -igmp 2 IGMP # internet group management protocol -ggp 3 GGP # gateway-gateway protocol -ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') -st 5 ST # ST datagram mode -tcp 6 TCP # transmission control protocol -cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk> -egp 8 EGP # exterior gateway protocol -igp 9 IGP # any private interior gateway (Cisco: for IGRP) -bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring -nvp 11 NVP-II # Network Voice Protocol -pup 12 PUP # PARC universal packet protocol -argus 13 ARGUS # ARGUS -emcon 14 EMCON # EMCON -xnet 15 XNET # Cross Net Debugger -chaos 16 CHAOS # Chaos -udp 17 UDP # user datagram protocol -mux 18 MUX # Multiplexing protocol -dcn 19 DCN-MEAS # DCN Measurement Subsystems -hmp 20 HMP # host monitoring protocol -prm 21 PRM # packet radio measurement protocol -xns-idp 22 XNS-IDP # Xerox NS IDP -trunk-1 23 TRUNK-1 # Trunk-1 -trunk-2 24 TRUNK-2 # Trunk-2 -leaf-1 25 LEAF-1 # Leaf-1 -leaf-2 26 LEAF-2 # Leaf-2 -rdp 27 RDP # "reliable datagram" protocol -irtp 28 IRTP # Internet Reliable Transaction Protocol -iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4 -netblt 30 NETBLT # Bulk Data Transfer Protocol -mfe-nsp 31 MFE-NSP # MFE Network Services Protocol -merit-inp 32 MERIT-INP # MERIT Internodal Protocol -sep 33 SEP # Sequential Exchange Protocol -3pc 34 3PC # Third Party Connect Protocol -idpr 35 IDPR # Inter-Domain Policy Routing Protocol -xtp 36 XTP # Xpress Tranfer Protocol -ddp 37 DDP # Datagram Delivery Protocol -idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto -tp++ 39 TP++ # TP++ Transport Protocol -il 40 IL # IL Transport Protocol -ipv6 41 IPv6 # IPv6 -sdrp 42 SDRP # Source Demand Routing Protocol -ipv6-route 43 IPv6-Route # Routing Header for IPv6 -ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 -idrp 45 IDRP # Inter-Domain Routing Protocol -rsvp 46 RSVP # Resource ReSerVation Protocol -gre 47 GRE # Generic Routing Encapsulation -mhrp 48 MHRP # Mobile Host Routing Protocol -bna 49 BNA # BNA -ipv6-crypt 50 IPv6-Crypt # Encryption Header for IPv6 -ipv6-auth 51 IPv6-Auth # Authentication Header for IPv6 -i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA -swipe 53 SWIPE # IP with Encryption -narp 54 NARP # NBMA Address Resolution Protocol -mobile 55 MOBILE # IP Mobility -tlsp 56 TLSP # Transport Layer Security Protocol -skip 57 SKIP # SKIP -ipv6-icmp 58 IPv6-ICMP icmpv6 icmp6 # ICMP for IPv6 -ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 -ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 -# 61 # any host internal protocol -cftp 62 CFTP # CFTP -# 63 # any local network -sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK -kryptolan 65 KRYPTOLAN # Kryptolan -rvd 66 RVD # MIT Remote Virtual Disk Protocol -ippc 67 IPPC # Internet Pluribus Packet Core -# 68 # any distributed file system -sat-mon 69 SAT-MON # SATNET Monitoring -visa 70 VISA # VISA Protocol -ipcv 71 IPCV # Internet Packet Core Utility -cpnx 72 CPNX # Computer Protocol Network Executive -cphb 73 CPHB # Computer Protocol Heart Beat -wsn 74 WSN # Wang Span Network -pvp 75 PVP # Packet Video Protocol -br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring -sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary -wb-mon 78 WB-MON # WIDEBAND Monitoring -wb-expak 79 WB-EXPAK # WIDEBAND EXPAK -iso-ip 80 ISO-IP # ISO Internet Protocol -vmtp 81 VMTP # Versatile Message Transport -secure-vmtp 82 SECURE-VMTP # SECURE-VMTP -vines 83 VINES # VINES -ttp 84 TTP # TTP -nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP -dgp 86 DGP # Dissimilar Gateway Protocol -tcf 87 TCF # TCF -eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco) -ospf 89 OSPFIGP # Open Shortest Path First IGP -sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol -larp 91 LARP # Locus Address Resolution Protocol -mtp 92 MTP # Multicast Transport Protocol -ax.25 93 AX.25 # AX.25 Frames -ipip 94 IPIP # Yet Another IP encapsulation -micp 95 MICP # Mobile Internetworking Control Pro. -scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro. -etherip 97 ETHERIP # Ethernet-within-IP Encapsulation -encap 98 ENCAP # Yet Another IP encapsulation -# 99 # any private encryption scheme -gmtp 100 GMTP # GMTP -ifmp 101 IFMP # Ipsilon Flow Management Protocol -pnni 102 PNNI # PNNI over IP -pim 103 PIM # Protocol Independent Multicast -aris 104 ARIS # ARIS -scps 105 SCPS # SCPS -qnx 106 QNX # QNX -a/n 107 A/N # Active Networks -ipcomp 108 IPComp # IP Payload Compression Protocol -snp 109 SNP # Sitara Networks Protocol -compaq-peer 110 Compaq-Peer # Compaq Peer Protocol -ipx-in-ip 111 IPX-in-IP # IPX in IP -vrrp 112 VRRP # Virtual Router Redundancy Protocol -pgm 113 PGM # PGM Reliable Transport Protocol -# 114 # any 0-hop protocol -l2tp 115 L2TP # Layer Two Tunneling Protocol -ddx 116 DDX # D-II Data Exchange -iatp 117 IATP # Interactive Agent Transfer Protocol -stp 118 STP # Schedule Transfer -srp 119 SRP # SpectraLink Radio Protocol -uti 120 UTI # UTI -smp 121 SMP # Simple Message Protocol -sm 122 SM # SM -ptp 123 PTP # Performance Transparency Protocol -isis 124 ISIS # ISIS over IPv4 -fire 125 FIRE -crtp 126 CRTP # Combat Radio Transport Protocol -crdup 127 CRUDP # Combat Radio User Datagram -sscopmce 128 SSCOPMCE -iplt 129 IPLT -sps 130 SPS # Secure Packet Shield -pipe 131 PIPE # Private IP Encapsulation within IP -sctp 132 SCTP # Stream Control Transmission Protocol -fc 133 FC # Fibre Channel -# rsvp-e2e-ignore 134 RSVP-E2E-IGNORE -# 134-254 # Unassigned -# 255 # Reserved diff --git a/netkit-base/services b/netkit-base/services deleted file mode 100644 index 00dba8b..0000000 --- a/netkit-base/services +++ /dev/null @@ -1,512 +0,0 @@ -# /etc/services: -# $Id: services,v 1.1 2002/03/22 15:58:38 per Exp $ -# -# Network services, Internet style -# -# Note that it is presently the policy of IANA to assign a single well-known -# port number for both TCP and UDP; hence, most entries here have two entries -# even if the protocol doesn't support UDP operations. -# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports -# are included, only the more common ones. -# -# The latest IANA port assignments can be gotten from -# http://www.iana.org/assignments/port-numbers -# The Well Known Ports are those from 0 through 1023. -# The Registered Ports are those from 1024 through 49151 -# The Dynamic and/or Private Ports are those from 49152 through 65535 -# -# Each line describes one service, and is of the form: -# -# service-name port/protocol [aliases ...] [# comment] - -tcpmux 1/tcp # TCP port service multiplexer -tcpmux 1/udp # TCP port service multiplexer -rje 5/tcp # Remote Job Entry -rje 5/udp # Remote Job Entry -echo 7/tcp -echo 7/udp -discard 9/tcp sink null -discard 9/udp sink null -systat 11/tcp users -systat 11/udp users -daytime 13/tcp -daytime 13/udp -qotd 17/tcp quote -qotd 17/udp quote -msp 18/tcp # message send protocol -msp 18/udp # message send protocol -chargen 19/tcp ttytst source -chargen 19/udp ttytst source -ftp-data 20/tcp -ftp-data 20/udp -ftp 21/tcp -ftp 21/udp -ssh 22/tcp # SSH Remote Login Protocol -ssh 22/udp # SSH Remote Login Protocol -telnet 23/tcp -telnet 23/udp -# 24 - private mail system -smtp 25/tcp mail -smtp 25/udp mail -time 37/tcp timserver -time 37/udp timserver -rlp 39/tcp resource # resource location -rlp 39/udp resource # resource location -nameserver 42/tcp name # IEN 116 -nameserver 42/udp name # IEN 116 -nicname 43/tcp whois -nicname 43/udp whois -tacacs 49/tcp # Login Host Protocol (TACACS) -tacacs 49/udp # Login Host Protocol (TACACS) -re-mail-ck 50/tcp # Remote Mail Checking Protocol -re-mail-ck 50/udp # Remote Mail Checking Protocol -domain 53/tcp nameserver # name-domain server -domain 53/udp nameserver -whois++ 63/tcp -whois++ 63/udp -bootps 67/tcp # BOOTP server -bootps 67/udp -bootpc 68/tcp # BOOTP client -bootpc 68/udp -tftp 69/tcp -tftp 69/udp -gopher 70/tcp # Internet Gopher -gopher 70/udp -netrjs-1 71/tcp # Remote Job Service -netrjs-1 71/udp # Remote Job Service -netrjs-2 72/tcp # Remote Job Service -netrjs-2 72/udp # Remote Job Service -netrjs-3 73/tcp # Remote Job Service -netrjs-3 73/udp # Remote Job Service -netrjs-4 74/tcp # Remote Job Service -netrjs-4 74/udp # Remote Job Service -finger 79/tcp -finger 79/udp -http 80/tcp www www-http # WorldWideWeb HTTP -http 80/udp www www-http # HyperText Transfer Protocol -kerberos 88/tcp kerberos5 krb5 # Kerberos v5 -kerberos 88/udp kerberos5 krb5 # Kerberos v5 -supdup 95/tcp -supdup 95/udp -hostname 101/tcp hostnames # usually from sri-nic -hostname 101/udp hostnames # usually from sri-nic -iso-tsap 102/tcp tsap # part of ISODE. -csnet-ns 105/tcp cso # also used by CSO name server -csnet-ns 105/udp cso -# unfortunately the poppassd (Eudora) uses a port which has already -# been assigned to a different service. We list the poppassd as an -# alias here. This should work for programs asking for this service. -# (due to a bug in inetd the 3com-tsmux line is disabled) -#3com-tsmux 106/tcp poppassd -#3com-tsmux 106/udp poppassd -rtelnet 107/tcp # Remote Telnet -rtelnet 107/udp -pop2 109/tcp pop-2 postoffice # POP version 2 -pop2 109/udp pop-2 -pop3 110/tcp pop-3 # POP version 3 -pop3 110/udp pop-3 -sunrpc 111/tcp portmapper # RPC 4.0 portmapper TCP -sunrpc 111/udp portmapper # RPC 4.0 portmapper UDP -auth 113/tcp authentication tap ident -auth 113/udp authentication tap ident -sftp 115/tcp -sftp 115/udp -uucp-path 117/tcp -uucp-path 117/udp -nntp 119/tcp readnews untp # USENET News Transfer Protocol -nntp 119/udp readnews untp # USENET News Transfer Protocol -ntp 123/tcp -ntp 123/udp # Network Time Protocol -netbios-ns 137/tcp # NETBIOS Name Service -netbios-ns 137/udp -netbios-dgm 138/tcp # NETBIOS Datagram Service -netbios-dgm 138/udp -netbios-ssn 139/tcp # NETBIOS session service -netbios-ssn 139/udp -imap 143/tcp imap2 # Interim Mail Access Proto v2 -imap 143/udp imap2 -snmp 161/tcp # Simple Net Mgmt Proto -snmp 161/udp # Simple Net Mgmt Proto -snmptrap 162/udp snmp-trap # Traps for SNMP -cmip-man 163/tcp # ISO mgmt over IP (CMOT) -cmip-man 163/udp -cmip-agent 164/tcp -cmip-agent 164/udp -mailq 174/tcp # MAILQ -mailq 174/udp # MAILQ -xdmcp 177/tcp # X Display Mgr. Control Proto -xdmcp 177/udp -nextstep 178/tcp NeXTStep NextStep # NeXTStep window -nextstep 178/udp NeXTStep NextStep # server -bgp 179/tcp # Border Gateway Proto. -bgp 179/udp -prospero 191/tcp # Cliff Neuman's Prospero -prospero 191/udp -irc 194/tcp # Internet Relay Chat -irc 194/udp -smux 199/tcp # SNMP Unix Multiplexer -smux 199/udp -at-rtmp 201/tcp # AppleTalk routing -at-rtmp 201/udp -at-nbp 202/tcp # AppleTalk name binding -at-nbp 202/udp -at-echo 204/tcp # AppleTalk echo -at-echo 204/udp -at-zis 206/tcp # AppleTalk zone information -at-zis 206/udp -qmtp 209/tcp # Quick Mail Transfer Protocol -qmtp 209/udp # Quick Mail Transfer Protocol -z39.50 210/tcp z3950 wais # NISO Z39.50 database -z39.50 210/udp z3950 wais -ipx 213/tcp # IPX -ipx 213/udp -imap3 220/tcp # Interactive Mail Access -imap3 220/udp # Protocol v3 -link 245/tcp ttylink -link 245/ucp ttylink -rsvp_tunnel 363/tcp -rsvp_tunnel 363/udp -rpc2portmap 369/tcp -rpc2portmap 369/udp # Coda portmapper -codaauth2 370/tcp -codaauth2 370/udp # Coda authentication server -ulistproc 372/tcp ulistserv # UNIX Listserv -ulistproc 372/udp ulistserv -ldap 389/tcp -ldap 389/udp -svrloc 427/tcp # Server Location Protocl -svrloc 427/udp # Server Location Protocl -mobileip-agent 434/tcp -mobileip-agent 434/udp -mobilip-mn 435/tcp -mobilip-mn 435/udp -https 443/tcp # MCom -https 443/udp # MCom -snpp 444/tcp # Simple Network Paging Protocol -snpp 444/udp # Simple Network Paging Protocol -microsoft-ds 445/tcp -microsoft-ds 445/udp -kpasswd 464/tcp kpwd # Kerberos "passwd" -kpasswd 464/udp kpwd # Kerberos "passwd" -photuris 468/tcp -photuris 468/udp -saft 487/tcp # Simple Asynchronous File Transfer -saft 487/udp # Simple Asynchronous File Transfer -gss-http 488/tcp -gss-http 488/udp -pim-rp-disc 496/tcp -pim-rp-disc 496/udp -isakmp 500/tcp -isakmp 500/udp -gdomap 538/tcp # GNUstep distributed objects -gdomap 538/udp # GNUstep distributed objects -iiop 535/tcp -iiop 535/udp -dhcpv6-client 546/tcp -dhcpv6-client 546/udp -dhcpv6-server 547/tcp -dhcpv6-server 547/udp -rtsp 554/tcp # Real Time Stream Control Protocol -rtsp 554/udp # Real Time Stream Control Protocol -nntps 563/tcp # NNTP over SSL -nntps 563/udp # NNTP over SSL -whoami 565/tcp -whoami 565/udp -submission 587/tcp msa # mail message submission -submission 587/udp msa # mail message submission -npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS -npmp-local 610/udp dqs313_qmaster # npmp-local / DQS -npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS -npmp-gui 611/udp dqs313_execd # npmp-gui / DQS -hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS -hmmp-ind 612/udp dqs313_intercell # HMMP Indication / DQS -ldaps 636/tcp # LDAP over SSL -ldaps 636/udp # LDAP over SSL -acap 674/tcp -acap 674/udp -ha-cluster 694/tcp # Heartbeat HA-cluster -ha-cluster 694/udp # Heartbeat HA-cluster -kerberos-adm 749/tcp # Kerberos `kadmin' (v5) -kerberos-iv 750/udp kerberos4 kerberos-sec kdc -kerberos-iv 750/tcp kerberos4 kerberos-sec kdc -webster 765/tcp # Network dictionary -webster 765/udp -phonebook 767/tcp # Network phonebook -phonebook 767/udp -rsync 873/tcp # rsync -rsync 873/udp # rsync -telnets 992/tcp -telnets 992/udp -imaps 993/tcp # IMAP over SSL -imaps 993/udp # IMAP over SSL -ircs 994/tcp -ircs 994/udp -pop3s 995/tcp # POP-3 over SSL -pop3s 995/udp # POP-3 over SSL - -# -# UNIX specific services -# -exec 512/tcp -biff 512/udp comsat -login 513/tcp -who 513/udp whod -shell 514/tcp cmd # no passwords used -syslog 514/udp -printer 515/tcp spooler # line printer spooler -printer 515/udp spooler # line printer spooler -talk 517/udp -ntalk 518/udp -utime 519/tcp unixtime -utime 519/udp unixtime -efs 520/tcp -router 520/udp route routed # RIP -ripng 521/tcp -ripng 521/udp -timed 525/tcp timeserver -timed 525/udp timeserver -tempo 526/tcp newdate -courier 530/tcp rpc -conference 531/tcp chat -netnews 532/tcp readnews -netwall 533/udp # -for emergency broadcasts -uucp 540/tcp uucpd # uucp daemon -klogin 543/tcp # Kerberized `rlogin' (v5) -kshell 544/tcp krcmd # Kerberized `rsh' (v5) -afpovertcp 548/tcp # AFP over TCP -afpovertcp 548/udp # AFP over TCP -remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem - -# -# From ``PORT NUMBERS'': -# -#>REGISTERED PORT NUMBERS -#> -#>The Registered Ports are listed by the IANA and on most systems can be -#>used by ordinary user processes or programs executed by ordinary -#>users. -#> -#>Ports are used in the TCP [RFC793] to name the ends of logical -#>connections which carry long term conversations. For the purpose of -#>providing services to unknown callers, a service contact port is -#>defined. This list specifies the port used by the server process as -#>its contact port. -#> -#>The IANA registers uses of these ports as a convienence to the -#>community. -# -socks 1080/tcp # socks proxy server -socks 1080/udp # socks proxy server -h323hostcallsc 1300/tcp # H323 Host Call Secure -h323hostcallsc 1300/udp # H323 Host Call Secure -ms-sql-s 1433/tcp # Microsoft-SQL-Server -ms-sql-s 1433/udp # Microsoft-SQL-Server -ms-sql-m 1434/tcp # Microsoft-SQL-Monitor -ms-sql-m 1434/udp # Microsoft-SQL-Monitor -ica 1494/tcp # Citrix ICA Client -ica 1494/udp # Citrix ICA Client -wins 1512/tcp # Microsoft's Windows Internet Name Service -wins 1512/udp # Microsoft's Windows Internet Name Service -ingreslock 1524/tcp -ingreslock 1524/udp -prospero-np 1525/tcp # Prospero non-privileged -prospero-np 1525/udp -datametrics 1645/tcp old-radius # datametrics / old radius entry -datametrics 1645/udp old-radius # datametrics / old radius entry -sa-msg-port 1646/tcp old-radacct # sa-msg-port / old radacct entry -sa-msg-port 1646/udp old-radacct # sa-msg-port / old radacct entry -kermit 1649/tcp -kermit 1649/udp -l2tp 1701/tcp l2f -l2tp 1701/udp l2f -h323gatedisc 1718/tcp -h323gatedisc 1718/udp -h323gatestat 1719/tcp -h323gatestat 1719/udp -h323hostcall 1720/tcp -h323hostcall 1720/udp -tftp-mcast 1758/tcp -tftp-mcast 1758/udp -hello 1789/tcp -hello 1789/udp -radius 1812/tcp # Radius -radius 1812/udp # Radius -radius-acct 1813/tcp radacct # Radius Accounting -radius-acct 1813/udp radacct # Radius Accounting -mtp 1911/tcp # -mtp 1911/udp # -hsrp 1985/tcp # Cisco Hot Standby Router Protocol -hsrp 1985/udp # Cisco Hot Standby Router Protocol -licensedaemon 1986/tcp -licensedaemon 1986/udp -gdp-port 1997/tcp # Cisco Gateway Discovery Protocol -gdp-port 1997/udp # Cisco Gateway Discovery Protocol -nfs 2049/tcp nfsd -nfs 2049/udp nfsd -zephyr-srv 2102/tcp # Zephyr server -zephyr-srv 2102/udp # Zephyr server -zephyr-clt 2103/tcp # Zephyr serv-hm connection -zephyr-clt 2103/udp # Zephyr serv-hm connection -zephyr-hm 2104/tcp # Zephyr hostmanager -zephyr-hm 2104/udp # Zephyr hostmanager -cvspserver 2401/tcp # CVS client/server operations -cvspserver 2401/udp # CVS client/server operations -venus 2430/tcp # codacon port -venus 2430/udp # Venus callback/wbc interface -venus-se 2431/tcp # tcp side effects -venus-se 2431/udp # udp sftp side effect -codasrv 2432/tcp # not used -codasrv 2432/udp # server port -codasrv-se 2433/tcp # tcp side effects -codasrv-se 2433/udp # udp sftp side effectQ -corbaloc 2809/tcp # CORBA naming service locator -icpv2 3130/tcp # Internet Cache Protocol V2 (Squid) -icpv2 3130/udp # Internet Cache Protocol V2 (Squid) -mysql 3306/tcp # MySQL -mysql 3306/udp # MySQL -trnsprntproxy 3346/tcp # Trnsprnt Proxy -trnsprntproxy 3346/udp # Trnsprnt Proxy -rwhois 4321/tcp # Remote Who Is -rwhois 4321/udp # Remote Who Is -krb524 4444/tcp # Kerberos 5 to 4 ticket xlator -krb524 4444/udp # Kerberos 5 to 4 ticket xlator -rfe 5002/tcp # Radio Free Ethernet -rfe 5002/udp # Actually uses UDP only -cfengine 5308/tcp # CFengine -cfengine 5308/udp # CFengine -cvsup 5999/tcp CVSup # CVSup file transfer/John Polstra/FreeBSD -cvsup 5999/udp CVSup # CVSup file transfer/John Polstra/FreeBSD -x11 6000/tcp X # the X Window System -afs3-fileserver 7000/tcp # file server itself -afs3-fileserver 7000/udp # file server itself -afs3-callback 7001/tcp # callbacks to cache managers -afs3-callback 7001/udp # callbacks to cache managers -afs3-prserver 7002/tcp # users & groups database -afs3-prserver 7002/udp # users & groups database -afs3-vlserver 7003/tcp # volume location database -afs3-vlserver 7003/udp # volume location database -afs3-kaserver 7004/tcp # AFS/Kerberos authentication service -afs3-kaserver 7004/udp # AFS/Kerberos authentication service -afs3-volser 7005/tcp # volume managment server -afs3-volser 7005/udp # volume managment server -afs3-errors 7006/tcp # error interpretation service -afs3-errors 7006/udp # error interpretation service -afs3-bos 7007/tcp # basic overseer process -afs3-bos 7007/udp # basic overseer process -afs3-update 7008/tcp # server-to-server updater -afs3-update 7008/udp # server-to-server updater -afs3-rmtsys 7009/tcp # remote cache manager service -afs3-rmtsys 7009/udp # remote cache manager service -sd 9876/tcp # Session Director -sd 9876/udp # Session Director -amanda 10080/tcp # amanda backup services -amanda 10080/udp # amanda backup services -pgpkeyserver 11371/tcp # PGP/GPG public keyserver -pgpkeyserver 11371/udp # PGP/GPG public keyserver -h323callsigalt 11720/tcp # H323 Call Signal Alternate -h323callsigalt 11720/udp # H323 Call Signal Alternate -quake 26000/tcp -quake 26000/udp -wnn6-ds 26208/tcp -wnn6-ds 26208/udp -traceroute 33434/tcp -traceroute 33434/udp - -# -# Datagram Delivery Protocol services -# -rtmp 1/ddp # Routing Table Maintenance Protocol -nbp 2/ddp # Name Binding Protocol -echo 4/ddp # AppleTalk Echo Protocol -zip 6/ddp # Zone Information Protocol -# -# Kerberos (Project Athena/MIT) services -# Note that these are for Kerberos v4, and are unofficial. Sites running -# v4 should uncomment these and comment out the v5 entries above. -# -kerberos_master 751/udp # Kerberos authentication -kerberos_master 751/tcp # Kerberos authentication -passwd_server 752/udp # Kerberos passwd server -krbupdate 760/tcp kreg # Kerberos registration -kpop 1109/tcp # Pop with Kerberos -knetd 2053/tcp # Kerberos de-multiplexor -# -# Kerberos 5 services, also not registered with IANA -# -krb5_prop 754/tcp # Kerberos slave propagation -eklogin 2105/tcp # Kerberos encrypted rlogin -# -# Unofficial but necessary (for NetBSD) services -# -supfilesrv 871/tcp # SUP server -supfiledbg 1127/tcp # SUP debugging -# -# Unofficial but useful/necessary other services -# -netstat 15/tcp # (was once asssigned, no more) -fsp 21/udp fspd # -linuxconf 98/tcp # Linuxconf HTML access -poppassd 106/tcp # Eudora -poppassd 106/udp # Eudora -smtps 465/tcp # SMTP over SSL (TLS) -gii 616/tcp # gated interactive interface -omirr 808/tcp omirrd # online mirror -omirr 808/udp omirrd # online mirror -swat 901/tcp # Samba Web Administration Tool -rndc 953/tcp # rndc control sockets (BIND 9) -rndc 953/udp # rndc control sockets (BIND 9) -skkserv 1178/tcp # SKK Japanese input method -rmtcfg 1236/tcp # Gracilis Packeten remote config server -xtel 1313/tcp # french minitel -support 1529/tcp prmsd gnatsd # GNATS, cygnus bug tracker -cfinger 2003/tcp # GNU Finger -ninstall 2150/tcp # ninstall service -ninstall 2150/udp # ninstall service -afbackup 2988/tcp # Afbackup system -afbackup 2988/udp # Afbackup system -squid 3128/tcp # squid web proxy -prsvp 3455/tcp # RSVP Port -prsvp 3455/udp # RSVP Port -postgres 5432/tcp # POSTGRES -postgres 5432/udp # POSTGRES -fax 4557/tcp # FAX transmission service (old) -hylafax 4559/tcp # HylaFAX client-server protocol (new) -sgi-dgl 5232/tcp # SGI Distributed Graphics -sgi-dgl 5232/udp -noclog 5354/tcp # noclogd with TCP (nocol) -noclog 5354/udp # noclogd with UDP (nocol) -hostmon 5355/tcp # hostmon uses TCP (nocol) -hostmon 5355/udp # hostmon uses TCP (nocol) -x11-ssh-offset 6010/tcp # SSH X11 forwarding offset -ircd 6667/tcp # Internet Relay Chat -ircd 6667/udp # Internet Relay Chat -xfs 7100/tcp # X font server -tircproxy 7666/tcp # Tircproxy -http-alt 8008/tcp -http-alt 8008/udp -webcache 8080/tcp # WWW caching service -webcache 8080/udp # WWW caching service -tproxy 8081/tcp # Transparent Proxy -tproxy 8081/udp # Transparent Proxy -jetdirect 9100/tcp laserjet hplj # -mandelspawn 9359/udp mandelbrot # network mandelbrot -kamanda 10081/tcp # amanda backup services (Kerberos) -kamanda 10081/udp # amanda backup services (Kerberos) -amandaidx 10082/tcp # amanda backup services -amidxtape 10083/tcp # amanda backup services -isdnlog 20011/tcp # isdn logging system -isdnlog 20011/udp # isdn logging system -vboxd 20012/tcp # voice box system -vboxd 20012/udp # voice box system -binkp 24554/tcp # Binkley -binkp 24554/udp # Binkley -asp 27374/tcp # Address Search Protocol -asp 27374/udp # Address Search Protocol -canna 5680/tcp -tfido 60177/tcp # Ifmail -tfido 60177/udp # Ifmail -fido 60179/tcp # Ifmail -fido 60179/udp # Ifmail - -# Local services -
participants (1)
-
crux@crux.nu