Change 30250 by [EMAIL PROTECTED] on 2007/02/12 22:50:56
Integrate:
[ 26897]
Make sure the most common IPPROTO_* constants are always available.
These are well known numbers so it should not be a problem to
hardcode values when no constant is provided by the C library.
Ref <http://www.iana.org/assignments/protocol-numbers>.
On some old glibc systems (eg Redhat 6) IPPROTO_TCP is an enum only
and this change workaround that problem as well.
[ 26902]
Use the IPPROTO_TCP constant instead of 6.
[ 26903]
Allow IPPROTO_ICMP and IPPROTO_UDP to be exported.
These were introduced in change 26897.
[ 27851]
Coverity is flagging a potential problem because it sees a check for
NULL and assumes that this means that the variable host could be
NULL. It can't, and the check added in change 13291 was a little bit
more than the minimal solution needed for the bug report
[ID 20011126.148]
Hence remove the NULL check.
Affected files ...
... //depot/maint-5.8/perl/ext/Socket/Makefile.PL#2 integrate
... //depot/maint-5.8/perl/ext/Socket/Socket.pm#5 integrate
... //depot/maint-5.8/perl/ext/Socket/Socket.xs#9 integrate
... //depot/maint-5.8/perl/ext/Socket/t/Socket.t#3 integrate
Differences ...
==== //depot/maint-5.8/perl/ext/Socket/Makefile.PL#2 (text) ====
Index: perl/ext/Socket/Makefile.PL
--- perl/ext/Socket/Makefile.PL#1~17645~ 2002-07-19 12:29:57.000000000
-0700
+++ perl/ext/Socket/Makefile.PL 2007-02-12 14:50:56.000000000 -0800
@@ -15,7 +15,7 @@
AF_LAST AF_LAT AF_LINK AF_MAX AF_NBS AF_NIT AF_NS
AF_OSI AF_OSINET AF_PUP AF_ROUTE AF_SNA
AF_UNIX AF_UNSPEC AF_USER AF_WAN AF_X25
- IOV_MAX IPPROTO_TCP
+ IOV_MAX
MSG_BCAST MSG_BTAG MSG_CTLFLAGS MSG_CTLIGNORE MSG_DONTWAIT
MSG_EOF MSG_EOR MSG_ERRQUEUE MSG_ETAG MSG_FIN
MSG_MAXIOVLEN MSG_MCAST MSG_NOSIGNAL MSG_RST MSG_SYN
@@ -45,6 +45,9 @@
TCP_KEEPALIVE TCP_MAXRT TCP_MAXSEG TCP_NODELAY TCP_STDURG
UIO_MAXIOV
),
+ {name=>"IPPROTO_ICMP", type=>"IV", default=>["IV", 1]},
+ {name=>"IPPROTO_TCP", type=>"IV", default=>["IV", 6]},
+ {name=>"IPPROTO_UDP", type=>"IV", default=>["IV", 17]},
{name=>"SHUT_RD", type=>"IV", default=>["IV", "0"]},
{name=>"SHUT_WR", type=>"IV", default=>["IV", "1"]},
{name=>"SHUT_RDWR", type=>"IV", default=>["IV", "2"]},
==== //depot/maint-5.8/perl/ext/Socket/Socket.pm#5 (text) ====
Index: perl/ext/Socket/Socket.pm
--- perl/ext/Socket/Socket.pm#4~26806~ 2006-01-12 11:23:34.000000000 -0800
+++ perl/ext/Socket/Socket.pm 2007-02-12 14:50:56.000000000 -0800
@@ -337,7 +337,10 @@
@EXPORT_OK = qw(CR LF CRLF $CR $LF $CRLF
+ IPPROTO_ICMP
IPPROTO_TCP
+ IPPROTO_UDP
+
TCP_KEEPALIVE
TCP_MAXRT
TCP_MAXSEG
==== //depot/maint-5.8/perl/ext/Socket/Socket.xs#9 (text) ====
Index: perl/ext/Socket/Socket.xs
--- perl/ext/Socket/Socket.xs#8~25572~ 2005-09-22 09:46:28.000000000 -0700
+++ perl/ext/Socket/Socket.xs 2007-02-12 14:50:56.000000000 -0800
@@ -231,10 +231,7 @@
{
struct in_addr ip_address;
struct hostent * phe;
- int ok =
- (host != NULL) &&
- (*host != '\0') &&
- inet_aton(host, &ip_address);
+ int ok = (*host != '\0') && inet_aton(host, &ip_address);
if (!ok && (phe = gethostbyname(host))) {
Copy( phe->h_addr, &ip_address, phe->h_length, char );
==== //depot/maint-5.8/perl/ext/Socket/t/Socket.t#3 (xtext) ====
Index: perl/ext/Socket/t/Socket.t
--- perl/ext/Socket/t/Socket.t#2~22632~ 2004-04-01 07:55:23.000000000 -0800
+++ perl/ext/Socket/t/Socket.t 2007-02-12 14:50:56.000000000 -0800
@@ -12,7 +12,7 @@
$has_alarm = $Config{d_alarm};
}
-use Socket;
+use Socket qw(:all);
print "1..17\n";
@@ -22,7 +22,7 @@
sub alarmed { $alarmed = 1 }
$SIG{ALRM} = 'alarmed' if $has_alarm;
-if (socket(T,PF_INET,SOCK_STREAM,6)) {
+if (socket(T, PF_INET, SOCK_STREAM, IPPROTO_TCP)) {
print "ok 1\n";
arm(5);
@@ -70,7 +70,7 @@
print "not ok 1\n";
}
-if( socket(S,PF_INET,SOCK_STREAM,6) ){
+if( socket(S, PF_INET,SOCK_STREAM, IPPROTO_TCP) ){
print "ok 4\n";
arm(5);
End of Patch.