{0}
};
+static char *
+proto_to_name(u_int8_t proto)
+{
+ switch (proto) {
+ case IPPROTO_TCP:
+ return "tcp";
+ case IPPROTO_UDP:
+ return "udp";
+ case IPPROTO_SCTP:
+ return "sctp";
+ case IPPROTO_DCCP:
+ return "dccp";
+ default:
+ return NULL;
+ }
+}
+
static unsigned int
parse_multi_ports(const char *portstring, u_int16_t *ports, const char *proto)
{
exit_error(PARAMETER_PROBLEM,
"multiport only works with TCP or UDP");
- if ((proto = proto_to_name(entry->ip.proto, 1)) != NULL)
+ if ((proto = proto_to_name(entry->ip.proto)) != NULL)
return proto;
else if (!entry->ip.proto)
exit_error(PARAMETER_PROBLEM,
{
struct servent *service;
- if ((service = getservbyport(htons(port), proto_to_name(proto, 1))))
+ if ((service = getservbyport(htons(port), proto_to_name(proto))))
return service->s_name;
return NULL;
extern void register_match(struct iptables_match *me);
extern void register_target(struct iptables_target *me);
-extern char *proto_to_name(u_int8_t proto, int nolookup);
extern int service_to_port(const char *name, const char *proto);
extern u_int16_t parse_port(const char *port, const char *proto);
extern struct in_addr *dotted_to_addr(const char *dotted);
{ "esp", IPPROTO_ESP },
{ "ah", IPPROTO_AH },
{ "sctp", IPPROTO_SCTP },
- { "dccp", IPPROTO_DCCP },
};
-char *
+static char *
proto_to_name(u_int8_t proto, int nolookup)
{
unsigned int i;