2 * Copyright (C) 1993-2005 by Darren Reed.
3 * See the IPFILTER.LICENCE file for details on licencing.
8 int getport(fr
, name
, port
)
17 if (fr
== NULL
|| fr
->fr_type
!= FR_T_IPF
) {
18 s
= getservbyname(name
, NULL
);
26 if ((fr
->fr_flx
& FI_TCPUDP
) != 0) {
28 * If a rule is "tcp/udp" then check that both TCP and UDP
29 * mappings for this protocol name match ports.
31 s
= getservbyname(name
, "tcp");
35 s
= getservbyname(name
, "udp");
36 if (s
== NULL
|| s
->s_port
!= p1
)
42 p
= getprotobynumber(fr
->fr_proto
);
43 s
= getservbyname(name
, p
? p
->p_name
: NULL
);