X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fofp-parse.c;h=843765650a442150e95965c7d6da558dc976ebd1;hb=d787ad39b8eb8fb9136837e1c65d0a18a1056eda;hp=5950f06eecaf2fc6ce5eade9e55724ab42c25a2d;hpb=9daf23484fb1f0d8fe8bf807a82c3d5b571a3dea;p=cascardo%2Fovs.git diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 5950f06ee..843765650 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "byte-order.h" #include "dynamic-string.h" @@ -168,6 +169,20 @@ str_to_ip(const char *str, ovs_be32 *ip) return NULL; } +/* Parses 'str' as a conntrack helper into 'alg'. + * + * Returns NULL if successful, otherwise a malloc()'d string describing the + * error. The caller is responsible for freeing the returned string. */ +char * OVS_WARN_UNUSED_RESULT +str_to_connhelper(const char *str, uint16_t *alg) +{ + if (!strcmp(str, "ftp")) { + *alg = IPPORT_FTP; + return NULL; + } + return xasprintf("invalid conntrack helper \"%s\"", str); +} + struct protocol { const char *name; uint16_t dl_type;