import tetrinetx
tetrinetx provides a server for hosting TetriNet games (a multiplayer variant of Tetris for up to six players). When the ipv6 flavor is used, IPv4 support is disabled. ok jasper@
This commit is contained in:
parent
324a878467
commit
6e84edd2ca
51
games/tetrinetx/Makefile
Normal file
51
games/tetrinetx/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
|
||||
COMMENT= tetrinet server
|
||||
|
||||
DISTNAME= tetrinetx-1.13.16+qirc-1.40c
|
||||
PKGNAME= tetrinetx-1.13.16
|
||||
CATEGORIES= games
|
||||
|
||||
HOMEPAGE= http://tetrinetx.sourceforge.net/
|
||||
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=tetrinetx/}
|
||||
|
||||
MAINTAINER= Simon Bertrang <simon@openbsd.org>
|
||||
|
||||
# GPLv2
|
||||
PERMIT_PACKAGE_CDROM= Yes
|
||||
PERMIT_PACKAGE_FTP= Yes
|
||||
PERMIT_DISTFILES_CDROM= Yes
|
||||
PERMIT_DISTFILES_FTP= Yes
|
||||
WANTLIB= c
|
||||
|
||||
LIB_DEPENDS= adns::net/adns
|
||||
|
||||
WRKSRC= ${WRKDIST}/src
|
||||
|
||||
NO_REGRESS= Yes
|
||||
|
||||
FLAVORS= ipv6
|
||||
FLAVOR?=
|
||||
|
||||
.if ${FLAVOR:L:Mipv6}
|
||||
CFLAGS+= -DUSE_IPV6
|
||||
.endif
|
||||
|
||||
CFLAGS+= -fno-strength-reduce -DCONFDIR="\"${SYSCONFDIR}/tetrinetx\""
|
||||
|
||||
post-patch:
|
||||
@rm -f ${WRKDIST}/bin/game.*.orig
|
||||
|
||||
do-build:
|
||||
cd ${WRKSRC} && ${CC} ${CFLAGS} -I${LOCALBASE}/include \
|
||||
main.c -o tetrinetx -L${LOCALBASE}/lib -ladns
|
||||
|
||||
do-install:
|
||||
@${INSTALL_PROGRAM} ${WRKSRC}/tetrinetx ${PREFIX}/bin
|
||||
@${INSTALL_DATA_DIR} ${PREFIX}/share/doc/tetrinetx
|
||||
@${INSTALL_DATA} ${WRKDIST}/README* ${PREFIX}/share/doc/tetrinetx
|
||||
@${INSTALL_DATA_DIR} ${PREFIX}/share/examples/tetrinetx
|
||||
@${INSTALL_DATA} ${WRKDIST}/bin/game.* ${PREFIX}/share/examples/tetrinetx
|
||||
|
||||
.include <bsd.port.mk>
|
5
games/tetrinetx/distinfo
Normal file
5
games/tetrinetx/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
MD5 (tetrinetx-1.13.16+qirc-1.40c.tar.gz) = MuUwa8Jq/J5azcqcCTlHwA==
|
||||
RMD160 (tetrinetx-1.13.16+qirc-1.40c.tar.gz) = RHwdI5kZ8jkHSMiAjNHAJtAjavw=
|
||||
SHA1 (tetrinetx-1.13.16+qirc-1.40c.tar.gz) = O8CozlO+8+9osCiDRonW/oXIFQo=
|
||||
SHA256 (tetrinetx-1.13.16+qirc-1.40c.tar.gz) = K3IQoMiVDBPmSNirw2t7yozlgDWZlSYwGnFarNQNFdQ=
|
||||
SIZE (tetrinetx-1.13.16+qirc-1.40c.tar.gz) = 81447
|
13
games/tetrinetx/patches/patch-bin_game_allow_example
Normal file
13
games/tetrinetx/patches/patch-bin_game_allow_example
Normal file
@ -0,0 +1,13 @@
|
||||
$OpenBSD: patch-bin_game_allow_example,v 1.1.1.1 2007/09/06 17:58:56 simon Exp $
|
||||
--- bin/game.allow.example.orig Thu Sep 6 16:02:20 2007
|
||||
+++ bin/game.allow.example Thu Sep 6 16:02:32 2007
|
||||
@@ -3,6 +3,6 @@
|
||||
# game.allow has lower priority than game.ban
|
||||
# game.ban.compromise will ban people if they fail in game.allow
|
||||
|
||||
-nickname1 password1
|
||||
-nickname2 password2
|
||||
-nickname3 password3
|
||||
+#nickname1 password1
|
||||
+#nickname2 password2
|
||||
+#nickname3 password3
|
@ -0,0 +1,7 @@
|
||||
$OpenBSD: patch-bin_game_ban_compromise_example,v 1.1.1.1 2007/09/06 17:58:56 simon Exp $
|
||||
--- bin/game.ban.compromise.example.orig Thu Sep 6 16:02:20 2007
|
||||
+++ bin/game.ban.compromise.example Thu Sep 6 16:02:34 2007
|
||||
@@ -1,2 +1,2 @@
|
||||
#Same format as game.ban
|
||||
-*.ipt.aol.com
|
||||
+#*.ipt.aol.com
|
23
games/tetrinetx/patches/patch-bin_game_ban_example
Normal file
23
games/tetrinetx/patches/patch-bin_game_ban_example
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-bin_game_ban_example,v 1.1.1.1 2007/09/06 17:58:56 simon Exp $
|
||||
--- bin/game.ban.example.orig Thu Sep 6 16:02:20 2007
|
||||
+++ bin/game.ban.example Thu Sep 6 16:02:44 2007
|
||||
@@ -5,15 +5,15 @@
|
||||
# All lines beginning with "#" are treated as a comment
|
||||
|
||||
#Cheating from host 1cust007.tnt2.billgates.da.uu.net
|
||||
-*.tnt*.billgates.da.uu.net
|
||||
+#*.tnt*.billgates.da.uu.net
|
||||
|
||||
#Flooding from 192.168.33.200. Ban all C class IP block
|
||||
#Date: 08/28/1999
|
||||
-192.168.33.*
|
||||
+#192.168.33.*
|
||||
|
||||
#Ban all hostname contain the word foobar
|
||||
-*foobar*
|
||||
+#*foobar*
|
||||
|
||||
#Ban IP block from 192.168.10.0 to 192.168.19.255
|
||||
-192.168.1?.*
|
||||
+#192.168.1?.*
|
||||
|
16
games/tetrinetx/patches/patch-bin_game_conf
Normal file
16
games/tetrinetx/patches/patch-bin_game_conf
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-bin_game_conf,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
--- bin/game.conf.orig Mon Sep 6 14:14:38 1999
|
||||
+++ bin/game.conf Thu Sep 6 09:41:35 2007
|
||||
@@ -8,10 +8,10 @@
|
||||
# Any text after a # is ignored, and can be used as comments.
|
||||
|
||||
# pidfile [game.pid] - Where should the Process ID be written
|
||||
-pidfile=game.pid
|
||||
+pidfile=/var/run/tetrinetx/game.pid
|
||||
|
||||
# bindip [0.0.0.0] - What IP should server be bound to (0.0.0.0 means all)
|
||||
-bindip=0.0.0.0
|
||||
+#bindip=0.0.0.0
|
||||
|
||||
# maxchannels [1] - How many channels should be available on server
|
||||
maxchannels=8
|
23
games/tetrinetx/patches/patch-bin_game_secure
Normal file
23
games/tetrinetx/patches/patch-bin_game_secure
Normal file
@ -0,0 +1,23 @@
|
||||
$OpenBSD: patch-bin_game_secure,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
--- bin/game.secure.orig Sat Sep 11 04:10:52 1999
|
||||
+++ bin/game.secure Thu Sep 6 09:41:35 2007
|
||||
@@ -8,15 +8,15 @@
|
||||
# Any text after a # is ignored, and can be used as comments.
|
||||
|
||||
# op_password [] - Typing /op <thispassword> will give player op status
|
||||
-op_password=pass4word
|
||||
+#op_password=pass4word
|
||||
|
||||
# query_password [] - For query irc client
|
||||
-query_password=pass4word
|
||||
+#query_password=pass4word
|
||||
|
||||
# spec_password [] - Use this as team name for gameplay watch
|
||||
-spec_password=pass4word
|
||||
+#spec_password=pass4word
|
||||
|
||||
# spec_op_password [] - Use this as team name for gameplay watch with extended capability (unused in this release)
|
||||
-spec_op_password=pass4word
|
||||
+#spec_op_password=pass4word
|
||||
|
||||
# End of File
|
47
games/tetrinetx/patches/patch-src_config_h
Normal file
47
games/tetrinetx/patches/patch-src_config_h
Normal file
@ -0,0 +1,47 @@
|
||||
$OpenBSD: patch-src_config_h,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
--- src/config.h.orig Tue Apr 24 04:31:29 2001
|
||||
+++ src/config.h Thu Sep 6 15:47:57 2007
|
||||
@@ -6,17 +6,31 @@
|
||||
|
||||
*/
|
||||
|
||||
+#ifndef CONFDIR
|
||||
+#define CONFDIR "."
|
||||
+#endif
|
||||
+
|
||||
/* Location of the various external files */
|
||||
-#define FILE_MOTD "game.motd" /* Message of the Day File */
|
||||
-#define FILE_PMOTD "game.pmotd" /* Playback motd */
|
||||
-#define FILE_CONF "game.conf" /* Game configuration File */
|
||||
-#define FILE_WINLIST "game.winlist" /* Winlist storage file */
|
||||
-#define FILE_WINLIST2 "game.winlist2" /* Winlist storage file */
|
||||
-#define FILE_WINLIST3 "game.winlist3" /* Winlist storage file */
|
||||
+/* Message of the Day File */
|
||||
+#define FILE_MOTD CONFDIR "/game.motd"
|
||||
+/* Playback motd */
|
||||
+#define FILE_PMOTD CONFDIR "/game.pmotd"
|
||||
+/* Game configuration File */
|
||||
+#define FILE_CONF CONFDIR "/game.conf"
|
||||
+/* List of Banned IP's */
|
||||
+#define FILE_BAN CONFDIR "/game.ban"
|
||||
+/* List of Banned IP's */
|
||||
+#define FILE_BAN_COMPROMISE CONFDIR "/game.ban.compromise"
|
||||
+/* List of allow IP's */
|
||||
+#define FILE_ALLOW CONFDIR "/game.allow"
|
||||
+/* Security file */
|
||||
+#define FILE_SECURE CONFDIR "/game.secure"
|
||||
|
||||
-#define FILE_BAN "game.ban" /* List of Banned IP's */
|
||||
-#define FILE_BAN_COMPROMISE "game.ban.compromise" /* List of Banned IP's */
|
||||
-#define FILE_ALLOW "game.allow" /* List of allow IP's */
|
||||
-#define FILE_LOG "game.log" /* Logfile */
|
||||
-#define FILE_PID "game.pid" /* Default PID */
|
||||
-#define FILE_SECURE "game.secure" /* Security file */
|
||||
+/* Winlist storage files */
|
||||
+#define FILE_WINLIST "/var/games/tetrinetx/game.winlist"
|
||||
+#define FILE_WINLIST2 "/var/games/tetrinetx/game.winlist2"
|
||||
+#define FILE_WINLIST3 "/var/games/tetrinetx/game.winlist3"
|
||||
+
|
||||
+/* Logfile & PID file */
|
||||
+#define FILE_LOG "/var/log/tetrinetx/game.log"
|
||||
+#define FILE_PID "/var/run/tetrinetx/game.pid"
|
256
games/tetrinetx/patches/patch-src_main_c
Normal file
256
games/tetrinetx/patches/patch-src_main_c
Normal file
@ -0,0 +1,256 @@
|
||||
$OpenBSD: patch-src_main_c,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
--- src/main.c.orig Tue Jul 9 05:53:49 2002
|
||||
+++ src/main.c Thu Sep 6 09:41:35 2007
|
||||
@@ -200,15 +200,23 @@ int is_valid_channelname(char *p)
|
||||
|
||||
char is_explicit_banned(struct net_t *n)
|
||||
{ /* I should use regex, but I've not used it before, and it was late. Easier to write a quick one of my own */
|
||||
+#ifdef USE_IPV6
|
||||
+ char ip_str[INET6_ADDRSTRLEN], host[INET6_ADDRSTRLEN];
|
||||
+#else
|
||||
char ip_str[UHOSTLEN+1], host[UHOSTLEN+1];
|
||||
char n1[4], n2[4], n3[4], n4[4];
|
||||
+#endif
|
||||
int i, j; int found;
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
+ inet_ntop(AF_INET6, &n->addr, (char *)ip_str, INET6_ADDRSTRLEN);
|
||||
+#else
|
||||
sprintf(n1,"%lu", (unsigned long)(n->addr&0xff000000)/(unsigned long)0x1000000);
|
||||
sprintf(n2,"%lu", (unsigned long)(n->addr&0x00ff0000)/(unsigned long)0x10000);
|
||||
sprintf(n3,"%lu", (unsigned long)(n->addr&0x0000ff00)/(unsigned long)0x100);
|
||||
sprintf(n4,"%lu", (unsigned long)n->addr&0x000000ff);
|
||||
sprintf(ip_str, "%s.%s.%s.%s", n1, n2, n3, n4);
|
||||
+#endif
|
||||
|
||||
found = 0;
|
||||
i = 0;
|
||||
@@ -228,8 +236,12 @@ char is_explicit_banned(struct net_t *n)
|
||||
|
||||
int is_banned(struct net_t *n)
|
||||
{ /* I should use regex, but I've not used it before, and it was late. Easier to write a quick one of my own */
|
||||
+#ifdef USE_IPV6
|
||||
+ char ip_str[INET6_ADDRSTRLEN], host[INET6_ADDRSTRLEN];
|
||||
+#else
|
||||
char ip_str[UHOSTLEN+1], host[UHOSTLEN+1];
|
||||
char n1[4], n2[4], n3[4], n4[4];
|
||||
+#endif
|
||||
int i, j; int found, allow;
|
||||
|
||||
allow = 0;
|
||||
@@ -247,11 +259,15 @@ int is_banned(struct net_t *n)
|
||||
return(0);
|
||||
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
+ inet_ntop(AF_INET6, &n->addr, (char *)ip_str, INET6_ADDRSTRLEN);
|
||||
+#else
|
||||
sprintf(n1,"%lu", (unsigned long)(n->addr&0xff000000)/(unsigned long)0x1000000);
|
||||
sprintf(n2,"%lu", (unsigned long)(n->addr&0x00ff0000)/(unsigned long)0x10000);
|
||||
sprintf(n3,"%lu", (unsigned long)(n->addr&0x0000ff00)/(unsigned long)0x100);
|
||||
sprintf(n4,"%lu", (unsigned long)n->addr&0x000000ff);
|
||||
sprintf(ip_str, "%s.%s.%s.%s", n1, n2, n3, n4);
|
||||
+#endif
|
||||
|
||||
found = 0;
|
||||
i = 0;
|
||||
@@ -404,7 +420,11 @@ void init_telnet_port()
|
||||
gnet=malloc(sizeof(struct net_t));
|
||||
gnet->next=NULL;
|
||||
n=gnet;
|
||||
+#ifdef USE_IPV6
|
||||
+ getmyip(&n->addr);
|
||||
+#else
|
||||
n->addr=getmyip();
|
||||
+#endif
|
||||
n->type=NET_TELNET;
|
||||
n->channel = malloc(sizeof(struct channel_t));
|
||||
n->channel->name[0] = '\0';
|
||||
@@ -452,7 +472,11 @@ void init_query_port()
|
||||
/* no existing entry */
|
||||
n->next = malloc(sizeof(struct net_t));
|
||||
n = n->next;
|
||||
+#ifdef USE_IPV6
|
||||
+ getmyip(&n->addr);
|
||||
+#else
|
||||
n->addr=getmyip();
|
||||
+#endif
|
||||
n->type=NET_QUERY;
|
||||
n->next=NULL;
|
||||
n->channel = malloc(sizeof(struct channel_t));
|
||||
@@ -496,7 +520,11 @@ void init_playback_port()
|
||||
/* no existing entry */
|
||||
n->next = malloc(sizeof(struct net_t));
|
||||
n = n->next;
|
||||
+#ifdef USE_IPV6
|
||||
+ getmyip(&n->addr);
|
||||
+#else
|
||||
n->addr=getmyip();
|
||||
+#endif
|
||||
n->type=NET_PLAYBACK;
|
||||
n->next=NULL;
|
||||
n->channel = malloc(sizeof(struct channel_t));
|
||||
@@ -2317,8 +2345,21 @@ int net_query_playerquery(struct net_t *n, char *buf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
int net_query_IPconvert(struct net_t *n, char *host)
|
||||
{
|
||||
+ char ip_str[INET6_ADDRSTRLEN];
|
||||
+
|
||||
+ inet_ntop(AF_INET6, &n->addr, (char *)ip_str, INET6_ADDRSTRLEN);
|
||||
+ if (n->host[0] == 0 || strlen(n->host) >= UHOSTLEN)
|
||||
+ sprintf(host, "%s",ip_str);
|
||||
+ else
|
||||
+ strcpy(host, n->host);
|
||||
+ return 1;
|
||||
+}
|
||||
+#else
|
||||
+int net_query_IPconvert(struct net_t *n, char *host)
|
||||
+{
|
||||
unsigned char x1, x2, x3, x4;
|
||||
IP ip;
|
||||
ip = n->addr;
|
||||
@@ -2333,6 +2374,7 @@ int net_query_IPconvert(struct net_t *n, char *host)
|
||||
strcpy(host, n->host);
|
||||
return 1;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Trim weird useless chars at the end */
|
||||
int net_query_TrimStr(char *p)
|
||||
@@ -3468,8 +3510,12 @@ void net_query_init(struct net_t *n, char *buf)
|
||||
/* Someone has just connected. So lets answer them */
|
||||
void net_query(struct net_t *n, char *buf)
|
||||
{
|
||||
+#ifdef USE_IPV6
|
||||
+ struct in6_addr ip;
|
||||
+#else
|
||||
IP ip;
|
||||
/* unsigned char x1, x2, x3, x4; */
|
||||
+#endif
|
||||
struct net_t *net;
|
||||
|
||||
net=malloc(sizeof(struct net_t));
|
||||
@@ -3481,7 +3527,11 @@ void net_query(struct net_t *n, char *buf)
|
||||
net->sock=answer(n->sock,&ip,0);
|
||||
setopt(net->sock, 0);
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
+ memcpy(&net->addr, &ip, sizeof(ip));
|
||||
+#else
|
||||
net->addr=ip;
|
||||
+#endif
|
||||
net->port=n->port;
|
||||
net->securitylevel=LEVEL_NORMAL;
|
||||
net->status=STAT_NOTPLAYING;
|
||||
@@ -3490,6 +3540,9 @@ void net_query(struct net_t *n, char *buf)
|
||||
strcpy(net->nick, "(telnet)");
|
||||
do_async_dns(net);
|
||||
net->type = NET_WAITINGFORDNS;
|
||||
+#ifdef USE_IPV6
|
||||
+net_donedns(net);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void net_query_donedns (struct net_t *net) {
|
||||
@@ -3646,8 +3699,12 @@ int net_playback_isvalidnick(char *p)
|
||||
/* Someone has just connected. So lets answer them */
|
||||
void net_playback(struct net_t *n, char *buf)
|
||||
{
|
||||
+#ifdef USE_IPV6
|
||||
+ struct in6_addr ip;
|
||||
+#else
|
||||
IP ip;
|
||||
/* unsigned char x1, x2, x3, x4; */
|
||||
+#endif
|
||||
struct net_t *net;
|
||||
|
||||
net=malloc(sizeof(struct net_t));
|
||||
@@ -3659,7 +3716,11 @@ void net_playback(struct net_t *n, char *buf)
|
||||
net->sock=answer(n->sock,&ip,0);
|
||||
setopt(net->sock, 0);
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
+ memcpy(&net->addr, &ip, sizeof(ip));
|
||||
+#else
|
||||
net->addr=ip;
|
||||
+#endif
|
||||
net->port=n->port;
|
||||
net->securitylevel=LEVEL_NORMAL;
|
||||
net->status=STAT_NOTPLAYING;
|
||||
@@ -3669,6 +3730,9 @@ void net_playback(struct net_t *n, char *buf)
|
||||
strcpy(net->nick, "(telnet)");
|
||||
do_async_dns(net);
|
||||
net->type = NET_WAITINGFORDNS;
|
||||
+#ifdef USE_IPV6
|
||||
+net_donedns(net);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void net_playback_donedns(struct net_t *net) {
|
||||
@@ -4348,7 +4412,11 @@ void net_telnet_init(struct net_t *n, char *buf)
|
||||
/* Someone has just connected. So lets answer them */
|
||||
void net_telnet(struct net_t *n, char *buf)
|
||||
{
|
||||
+#ifdef USE_IPV6
|
||||
+ static struct in6_addr ip;
|
||||
+#else
|
||||
unsigned long ip;
|
||||
+#endif
|
||||
struct net_t *net;
|
||||
|
||||
|
||||
@@ -4361,7 +4429,11 @@ void net_telnet(struct net_t *n, char *buf)
|
||||
net->sock=answer(n->sock,&ip,0);
|
||||
setopt(net->sock, 0);
|
||||
/* Save the port stuff */
|
||||
+#ifdef USE_IPV6
|
||||
+ memcpy(&net->addr, &ip, sizeof(ip));
|
||||
+#else
|
||||
net->addr=ip;
|
||||
+#endif
|
||||
net->port=n->port;
|
||||
net->securitylevel=LEVEL_NORMAL;
|
||||
net->status=STAT_NOTPLAYING;
|
||||
@@ -4373,12 +4445,24 @@ void net_telnet(struct net_t *n, char *buf)
|
||||
net->timeout_ingame = 30;
|
||||
do_async_dns(net);
|
||||
net->type = NET_WAITINGFORDNS;
|
||||
+#ifdef USE_IPV6
|
||||
+net_donedns(net);
|
||||
+#endif
|
||||
/* net has not been added to socket list */
|
||||
/* EOF on this will be EOF on unknown socket */
|
||||
|
||||
}
|
||||
|
||||
+#ifdef USE_IPV6
|
||||
void do_async_dns (struct net_t *n) {
|
||||
+ char ip_str[INET6_ADDRSTRLEN];
|
||||
+
|
||||
+ inet_ntop(AF_INET6, &n->addr, (char *)ip_str, INET6_ADDRSTRLEN);
|
||||
+ sprintf(n->host, "%s", ip_str);
|
||||
+ sprintf(n->ip, "%s", ip_str);
|
||||
+}
|
||||
+#else
|
||||
+void do_async_dns (struct net_t *n) {
|
||||
char n1[4], n2[4], n3[4], n4[4];
|
||||
char buf[1024];
|
||||
int res_id;
|
||||
@@ -4393,11 +4477,14 @@ void do_async_dns (struct net_t *n) {
|
||||
res_id = query_do(buf);
|
||||
add_rnet(n, res_id);
|
||||
}
|
||||
+#endif
|
||||
|
||||
void net_donedns(struct net_t *net) {
|
||||
|
||||
if (net->type != NET_WAITINGFORDNS) return;
|
||||
+#ifndef USE_IPV6
|
||||
rem_rnet(net);
|
||||
+#endif
|
||||
switch(net->port) {
|
||||
case TELNET_PORT: { net_telnet_donedns (net); break; }
|
||||
case QUERY_PORT: { net_query_donedns (net); break; }
|
28
games/tetrinetx/patches/patch-src_main_h
Normal file
28
games/tetrinetx/patches/patch-src_main_h
Normal file
@ -0,0 +1,28 @@
|
||||
$OpenBSD: patch-src_main_h,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
--- src/main.h.orig Sun Apr 29 21:00:28 2001
|
||||
+++ src/main.h Thu Sep 6 09:41:35 2007
|
||||
@@ -47,7 +47,11 @@
|
||||
|
||||
/* Defines */
|
||||
#define TETVERSION "1.13" /* What Tetrinet version we are for */
|
||||
-#define SERVERBUILD "16+qirc-1.40b" /* What build we are at */
|
||||
+#ifdef USE_IPV6
|
||||
+#define SERVERBUILD "16+qirc-1.40c-IPv6" /* What build we are at */
|
||||
+#else
|
||||
+#define SERVERBUILD "16+qirc-1.40c" /* What build we are at */
|
||||
+#endif
|
||||
#define NICKLEN 30 /* Maximum length of Nickname */
|
||||
#define VERLEN 10 /* Maximum length of Tetrinet version */
|
||||
#define UHOSTLEN 121 /* Maximum length of Hostname */
|
||||
@@ -240,7 +244,11 @@ struct game_t {
|
||||
|
||||
struct net_t {
|
||||
int sock; /* Socket this player is on */
|
||||
+#ifdef USE_IPV6
|
||||
+ struct in6_addr addr;
|
||||
+#else
|
||||
IP addr; /* IP address of player */
|
||||
+#endif
|
||||
unsigned int port; /* Port number they connected to */
|
||||
char nick[NICKLEN+1]; /* Nickname of player */
|
||||
char team[TEAMLEN+1]; /* Teamname of player */
|
206
games/tetrinetx/patches/patch-src_net_c
Normal file
206
games/tetrinetx/patches/patch-src_net_c
Normal file
@ -0,0 +1,206 @@
|
||||
$OpenBSD: patch-src_net_c,v 1.1.1.1 2007/09/06 17:58:56 simon Exp $
|
||||
--- src/net.c.orig Tue Apr 24 04:31:29 2001
|
||||
+++ src/net.c Thu Sep 6 10:14:52 2007
|
||||
@@ -6,21 +6,25 @@
|
||||
|
||||
|
||||
/* i read somewhere that memcpy() is broken on some machines */
|
||||
-/* it's easy to replace, so i'm not gonna take any chances, because it's
|
||||
-*/
|
||||
+/* it's easy to replace, so i'm not gonna take any chances, because it's */
|
||||
/* pretty important that it work correctly here */
|
||||
-void my_memcpy(dest,src,len)
|
||||
+/* XXX until the contrary is proved, I'll use ISO C functions instead of
|
||||
+ * my_*. */
|
||||
+/* void my_memcpy(dest,src,len)
|
||||
char *dest,*src; int len;
|
||||
{
|
||||
while (len--) *dest++=*src++;
|
||||
}
|
||||
+*/
|
||||
|
||||
/* bzero() is bsd-only, so here's one for non-bsd systems */
|
||||
+/* XXX but memset is ISO C, replaced.
|
||||
void my_bzero(dest,len)
|
||||
char *dest; int len;
|
||||
{
|
||||
while (len--) *dest++=0;
|
||||
}
|
||||
+*/
|
||||
|
||||
/* initialize the socklist */
|
||||
void init_net()
|
||||
@@ -52,14 +56,39 @@ int expmem_net()
|
||||
void getmyhostname(s)
|
||||
char *s;
|
||||
{
|
||||
- struct hostent *hp; char *p;
|
||||
+ /* struct hostent *hp; */
|
||||
+ char *p;
|
||||
|
||||
- p=getenv("HOSTNAME"); if (p!=NULL) {
|
||||
- strncpy(s,p, UHOSTLEN);
|
||||
- s[UHOSTLEN] = 0;
|
||||
- if (strchr(s,'.')!=NULL) return;
|
||||
+ if ( (p=getenv("HOSTNAME")) != NULL )
|
||||
+ {
|
||||
+ strncpy(s, p, UHOSTLEN);
|
||||
+ s[UHOSTLEN] = '\0';
|
||||
+ if (strchr(s,'.') == NULL)
|
||||
+ {
|
||||
+ strncat(s,".localnet", UHOSTLEN - strlen(s));
|
||||
+ setenv("HOSTNAME",(const char*)s, 1);
|
||||
+ }
|
||||
+ return;
|
||||
}
|
||||
- gethostname(s,80);
|
||||
+ else if (gethostname(s,MYMAXHOSTNAMELEN) == 0)
|
||||
+ {
|
||||
+ s[UHOSTLEN] = '\0';
|
||||
+ if (strchr(s,'.') == NULL)
|
||||
+ {
|
||||
+ strncat(s,".localnet", UHOSTLEN - strlen(s));
|
||||
+ setenv("HOSTNAME",(const char*)s, 1);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ memset(s,'\0',UHOSTLEN);
|
||||
+ strncpy(s, "localhost.localnet", UHOSTLEN);
|
||||
+ s[UHOSTLEN] = '\0';
|
||||
+ setenv("HOSTNAME",(const char*)s,1);
|
||||
+ return;
|
||||
+ }
|
||||
+/* gethostname(s,MYMAXHOSTNAMELEN);
|
||||
if (strchr(s,'.')!=NULL) return;
|
||||
hp=gethostbyname(s);
|
||||
if (hp==NULL)
|
||||
@@ -73,9 +102,27 @@ char *s;
|
||||
s[UHOSTLEN] = 0;
|
||||
if (strchr(s,'.')==NULL)
|
||||
fatal("Can't determine your hostname!",0);
|
||||
+*/
|
||||
}
|
||||
|
||||
/* get my ip number */
|
||||
+#ifdef USE_IPV6
|
||||
+void getmyip(struct in6_addr *ip)
|
||||
+{
|
||||
+ struct addrinfo hints, *res;
|
||||
+ char s[121];
|
||||
+
|
||||
+ gethostname(s,120);
|
||||
+ memset(&hints, 0, sizeof(hints));
|
||||
+ hints.ai_family = AF_UNSPEC;
|
||||
+ hints.ai_socktype = SOCK_STREAM;
|
||||
+ if (getaddrinfo(s, NULL, &hints, &res)) {
|
||||
+ fatal("Hostname self-lookup failed.",0);
|
||||
+ }
|
||||
+ memcpy(ip, res->ai_addr, res->ai_addrlen);
|
||||
+ freeaddrinfo(res);
|
||||
+}
|
||||
+#else
|
||||
IP getmyip()
|
||||
{
|
||||
struct hostent *hp; char s[121]; IP ip; struct in_addr *in;
|
||||
@@ -88,6 +135,7 @@ IP getmyip()
|
||||
ip=(IP)(in->s_addr);
|
||||
return ip;
|
||||
}
|
||||
+#endif
|
||||
|
||||
void neterror(s)
|
||||
char *s;
|
||||
@@ -185,7 +233,13 @@ int parm, x;
|
||||
int getsock(options)
|
||||
int options;
|
||||
{
|
||||
- int sock=socket(AF_INET,SOCK_STREAM,0);
|
||||
+ int sock;
|
||||
+#ifdef USE_IPV6
|
||||
+ if ( (sock = socket(AF_INET6,SOCK_STREAM,0)) <0 )
|
||||
+ sock=socket(AF_INET,SOCK_STREAM,0);
|
||||
+#else
|
||||
+ sock=socket(AF_INET,SOCK_STREAM,0);
|
||||
+#endif
|
||||
if (sock<0) fatal("Can't open a socket at all!",0);
|
||||
setsock(sock,options); return sock;
|
||||
}
|
||||
@@ -228,10 +282,28 @@ int sock;
|
||||
int open_listen_socket(port,bindip)
|
||||
int *port; char *bindip;
|
||||
{
|
||||
+#ifdef USE_IPV6
|
||||
+ int sock,addrlen; struct sockaddr_in6 name;
|
||||
+
|
||||
+ sock=getsock(SOCK_LISTEN);
|
||||
+ memset((char *)&name,'\0',sizeof(struct sockaddr_in6));
|
||||
+ name.sin6_family=AF_INET6;
|
||||
+ name.sin6_port=htons(*port); /* 0 = just assign us a port */
|
||||
+ if (bind(sock,(struct sockaddr *)&name,sizeof(name))<0) {
|
||||
+printf("ERROR\n");
|
||||
+ killsock(sock); return -1;
|
||||
+ }
|
||||
+ /* what port are we on? */
|
||||
+ addrlen=sizeof(name);
|
||||
+ if (getsockname(sock,(struct sockaddr *)&name,&addrlen)<0) {
|
||||
+ killsock(sock); return -1;
|
||||
+ }
|
||||
+ *port=ntohs(name.sin6_port);
|
||||
+#else
|
||||
int sock,addrlen; struct sockaddr_in name;
|
||||
|
||||
sock=getsock(SOCK_LISTEN);
|
||||
- my_bzero((char *)&name,sizeof(struct sockaddr_in));
|
||||
+ memset((char *)&name,'\0',sizeof(struct sockaddr_in));
|
||||
name.sin_family=AF_INET;
|
||||
name.sin_port=htons(*port); /* 0 = just assign us a port */
|
||||
name.sin_addr.s_addr=getip(bindip);
|
||||
@@ -246,6 +318,7 @@ printf("ERROR\n");
|
||||
killsock(sock); return -1;
|
||||
}
|
||||
*port=ntohs(name.sin_port);
|
||||
+#endif
|
||||
if (listen(sock,5)<0) { printf("Erk\n"); killsock(sock); return -1; }
|
||||
return sock;
|
||||
}
|
||||
@@ -280,7 +353,21 @@ unsigned long ip;
|
||||
|
||||
/* short routine to answer a connect received on a socket made previously
|
||||
*/
|
||||
+#ifdef USE_IPV6
|
||||
int answer(sock,ip,binary)
|
||||
+int sock; struct in6_addr *ip; int binary;
|
||||
+{
|
||||
+ int new_sock,addrlen; struct sockaddr_in6 from;
|
||||
+ addrlen=sizeof(struct sockaddr_in6);
|
||||
+ new_sock=accept(sock,(struct sockaddr *)&from,&addrlen);
|
||||
+ if (new_sock<0) return -1;
|
||||
+ memcpy(ip, &from.sin6_addr, sizeof(struct in6_addr));
|
||||
+ /* set up all the normal socket crap */
|
||||
+ // setsock(new_sock,(binary ? SOCK_BINARY : 0));
|
||||
+ return new_sock;
|
||||
+}
|
||||
+#else
|
||||
+int answer(sock,ip,binary)
|
||||
int sock; unsigned long *ip; int binary;
|
||||
{
|
||||
int new_sock,addrlen; struct sockaddr_in from;
|
||||
@@ -293,6 +380,7 @@ int sock; unsigned long *ip; int binary;
|
||||
// setsock(new_sock,(binary ? SOCK_BINARY : 0));
|
||||
return new_sock;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* attempts to read from all the sockets in socklist */
|
||||
/* fills s with up to 1023 bytes if available, and returns 0 */
|
||||
@@ -437,7 +525,7 @@ char *s; int *len;
|
||||
s[0]=0; return slist->sock;
|
||||
}
|
||||
if (slist->flags & SOCK_BINARY) {
|
||||
- my_memcpy(s,xx,*len);
|
||||
+ memcpy(s,xx,*len);
|
||||
return slist->sock;
|
||||
}
|
||||
if (slist->flags & SOCK_LISTEN) return slist->sock;
|
55
games/tetrinetx/patches/patch-src_net_h
Normal file
55
games/tetrinetx/patches/patch-src_net_h
Normal file
@ -0,0 +1,55 @@
|
||||
$OpenBSD: patch-src_net_h,v 1.1.1.1 2007/09/06 17:58:56 simon Exp $
|
||||
--- src/net.h.orig Tue Apr 24 04:31:29 2001
|
||||
+++ src/net.h Thu Sep 6 10:08:07 2007
|
||||
@@ -37,6 +37,9 @@
|
||||
#define SOCK_NONSOCK 0x10 /* used for file i/o on debug */
|
||||
#define SOCK_STRONGCONN 0x20 /* don't report success until sure */
|
||||
|
||||
+/* some hard-coded values are better with #define :) */
|
||||
+#define MYMAXHOSTNAMELEN 80
|
||||
+
|
||||
/* this is used by the net module to keep track of sockets and what's
|
||||
queued on them */
|
||||
struct sock_list {
|
||||
@@ -51,15 +54,10 @@ struct sock_list {
|
||||
/*#define MAXSOCKS MAXNET*2*/
|
||||
struct sock_list *socklist; /* enough to be safe */
|
||||
|
||||
-/* i read somewhere that memcpy() is broken on some machines */
|
||||
-/* it's easy to replace, so i'm not gonna take any chances, because it's
|
||||
-*/
|
||||
-/* pretty important that it work correctly here */
|
||||
+/* XXX: deleted, see .c for explanations.
|
||||
void my_memcpy(char *dest,char *src,int len);
|
||||
-
|
||||
-
|
||||
-/* bzero() is bsd-only, so here's one for non-bsd systems */
|
||||
void my_bzero(char *dest,int len);
|
||||
+*/
|
||||
|
||||
|
||||
/* initialize the socklist */
|
||||
@@ -75,7 +73,11 @@ void getmyhostname(char *s);
|
||||
|
||||
|
||||
/* get my ip number */
|
||||
+#ifdef USE_IPV6
|
||||
+void getmyip(struct in6_addr *ip);
|
||||
+#else
|
||||
IP getmyip(void);
|
||||
+#endif
|
||||
|
||||
|
||||
void neterror(char *s);
|
||||
@@ -106,7 +108,11 @@ char *hostnamefromip(unsigned long ip);
|
||||
*/
|
||||
/* by open_listen ... returns hostname of the caller & the new socket */
|
||||
/* does NOT dispose of old "public" socket! */
|
||||
+#ifdef USE_IPV6
|
||||
+int answer(int sock,struct in6_addr *ip,int binary);
|
||||
+#else
|
||||
int answer(int sock,unsigned long *ip,int binary);
|
||||
+#endif
|
||||
|
||||
|
||||
/* attempts to read from all the sockets in socklist */
|
4
games/tetrinetx/pkg/DESCR
Normal file
4
games/tetrinetx/pkg/DESCR
Normal file
@ -0,0 +1,4 @@
|
||||
tetrinetx provides a server for hosting TetriNet games (a multiplayer
|
||||
variant of Tetris for up to six players).
|
||||
|
||||
When the ipv6 flavor is used, IPv4 support is disabled.
|
31
games/tetrinetx/pkg/PLIST
Normal file
31
games/tetrinetx/pkg/PLIST
Normal file
@ -0,0 +1,31 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2007/09/06 17:58:55 simon Exp $
|
||||
bin/tetrinetx
|
||||
share/doc/tetrinetx/
|
||||
share/doc/tetrinetx/README
|
||||
share/doc/tetrinetx/README.qirc.spectators
|
||||
share/examples/tetrinetx/
|
||||
@sample ${SYSCONFDIR}/tetrinetx/
|
||||
share/examples/tetrinetx/game.allow.example
|
||||
@mode o=
|
||||
@group games
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.allow
|
||||
@mode
|
||||
@group
|
||||
share/examples/tetrinetx/game.ban.compromise.example
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.ban.compromise
|
||||
share/examples/tetrinetx/game.ban.example
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.ban
|
||||
share/examples/tetrinetx/game.conf
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.conf
|
||||
share/examples/tetrinetx/game.motd
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.motd
|
||||
share/examples/tetrinetx/game.pmotd
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.pmotd
|
||||
share/examples/tetrinetx/game.secure
|
||||
@mode o=
|
||||
@group games
|
||||
@sample ${SYSCONFDIR}/tetrinetx/game.secure
|
||||
@mode g+w
|
||||
@sample /var/games/tetrinetx/
|
||||
@sample /var/log/tetrinetx/
|
||||
@sample /var/run/tetrinetx/
|
Loading…
x
Reference in New Issue
Block a user