mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
Add support for connection tracking helper/ALGs.
This patch adds support for specifying a "helper" or ALG to assist connection tracking for protocols that consist of multiple streams. Initially, only support for FTP is included. Below is an example set of flows to allow FTP control connections from port 1->2 to establish active data connections in the reverse direction: table=0,priority=1,action=drop table=0,arp,action=normal table=0,in_port=1,tcp,action=ct(alg=ftp,commit),2 table=0,in_port=2,tcp,ct_state=-trk,action=ct(table=1) table=1,in_port=2,tcp,ct_state=+trk+est,action=1 table=1,in_port=2,tcp,ct_state=+trk+rel,action=ct(commit),1 Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user