}
}
-static int
-service_to_port(const char *name, const char *proto)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, proto)) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_port(const char *port, const char *proto)
{
{0}
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "tcp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_tcp_port(const char *port)
{
unsigned int portnum;
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "tcp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
{0}
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "udp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_udp_port(const char *port)
{
unsigned int portnum;
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "udp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
{ .name = 0 }
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "dccp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_dccp_port(const char *port)
{
DEBUGP("%s\n", port);
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "dccp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
{0}
};
-static int
-service_to_port(const char *name, const char *proto)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, proto)) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_port(const char *port, const char *proto)
{
}
}
-static int
-service_to_port(const char *name, const char *proto)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, proto)) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_port(const char *port, const char *proto)
{
{ .name = 0 }
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "sctp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_sctp_port(const char *port)
{
DEBUGP("%s\n", port);
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "sctp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
{0}
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "tcp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_tcp_port(const char *port)
{
unsigned int portnum;
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "tcp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
{0}
};
-static int
-service_to_port(const char *name)
-{
- struct servent *service;
-
- if ((service = getservbyname(name, "udp")) != NULL)
- return ntohs((unsigned short) service->s_port);
-
- return -1;
-}
-
static u_int16_t
parse_udp_port(const char *port)
{
unsigned int portnum;
if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port)) != -1)
+ (portnum = service_to_port(port, "udp")) != -1)
return (u_int16_t)portnum;
exit_error(PARAMETER_PROBLEM,
extern void register_match6(struct ip6tables_match *me);
extern void register_target6(struct ip6tables_target *me);
+extern int service_to_port(const char *name, const char *proto);
extern int do_command6(int argc, char *argv[], char **table,
ip6tc_handle_t *handle);
/* Keeping track of external matches and targets: linked lists. */
extern void register_match(struct iptables_match *me);
extern void register_target(struct iptables_target *me);
+extern int service_to_port(const char *name, const char *proto);
extern struct in_addr *dotted_to_addr(const char *dotted);
extern char *addr_to_dotted(const struct in_addr *addrp);
extern char *addr_to_anyname(const struct in_addr *addr);
return NULL;
}
+int
+service_to_port(const char *name, const char *proto)
+{
+ struct servent *service;
+
+ if ((service = getservbyname(name, proto)) != NULL)
+ return ntohs((unsigned short) service->s_port);
+
+ return -1;
+}
+
static void
in6addrcpy(struct in6_addr *dst, struct in6_addr *src)
{
return NULL;
}
+int
+service_to_port(const char *name, const char *proto)
+{
+ struct servent *service;
+
+ if ((service = getservbyname(name, proto)) != NULL)
+ return ntohs((unsigned short) service->s_port);
+
+ return -1;
+}
+
struct in_addr *
dotted_to_addr(const char *dotted)
{