From: <li...@us...> - 2004-02-08 00:38:22
|
Update of /cvsroot/iptables-p2p/iptables-p2p/iptables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14402 Modified Files: libipt_p2p.c Log Message: print and save protocol names instead of numbers Index: libipt_p2p.c =================================================================== RCS file: /cvsroot/iptables-p2p/iptables-p2p/iptables/libipt_p2p.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- libipt_p2p.c 6 Feb 2004 19:37:20 -0000 1.9 +++ libipt_p2p.c 8 Feb 2004 00:35:23 -0000 1.10 @@ -198,9 +198,32 @@ static char *proto_to_arg(int proto) { - static char buf[16]; + static char buf[256]; + int firstrun = 1; + int i; + + if(proto == IPT_P2P_PROTO_ALL) + { + strcpy(buf, "all "); + return buf; + } + + buf[0] = '\0'; + + for (i = 0; i < PROTOMAP_NELEM; i++) + { + if(IPT_P2P_PROTO_ALL != protomap[i].proto && + proto & protomap[i].proto) + { + if(!firstrun) + strcat(buf,","); + strcat(buf, protomap[i].name); + firstrun = 0; + } + } + + strcat(buf, " "); - snprintf (buf, sizeof (buf), "%i", proto); return buf; } |