Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipvs: sctp implementation #949

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/conf/inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static inline const char *inet_proto_name(uint8_t proto)
const static char *proto_names[256] = {
[IPPROTO_TCP] = "TCP",
[IPPROTO_UDP] = "UDP",
[IPPROTO_SCTP] = "SCTP",
[IPPROTO_ICMP] = "ICMP",
[IPPROTO_ICMPV6] = "ICMPV6",
};
Expand Down
2 changes: 2 additions & 0 deletions include/conf/match.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ static inline int parse_match(const char *pattern, uint8_t *proto,
*proto = IPPROTO_TCP;
} else if (strcmp(tok, "udp") == 0) {
*proto = IPPROTO_UDP;
} else if (strcmp(tok, "sctp") == 0) {
*proto = IPPROTO_SCTP;
} else if (strcmp(tok, "icmp") == 0) {
*proto = IPPROTO_ICMP;
} else if (strcmp(tok, "icmp6") == 0) {
Expand Down
5 changes: 3 additions & 2 deletions include/conf/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@
#define DEST_HC_PASSIVE 0x01
#define DEST_HC_TCP 0x02
#define DEST_HC_UDP 0x04
#define DEST_HC_PING 0x08
#define DEST_HC_MASK_EXTERNAL 0x0e
#define DEST_HC_SCTP 0x08
#define DEST_HC_PING 0x10
#define DEST_HC_MASK_EXTERNAL 0x1e

/* defaults for dest passive health check */
#define DEST_DOWN_NOTICE_DEFAULT 1
Expand Down
66 changes: 66 additions & 0 deletions include/ipvs/proto_sctp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* DPVS is a software load balancer (Virtual Server) based on DPDK.
*
* Copyright (C) 2021 iQIYI (www.iqiyi.com).
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __DP_VS_PROTO_SCTP_H__
#define __DP_VS_PROTO_SCTP_H__

#include <netinet/in.h>
#include "sctp/sctp.h"

enum dpvs_sctp_event_t {
DPVS_SCTP_DATA = 0, /* DATA, SACK, HEARTBEATs */
DPVS_SCTP_INIT,
DPVS_SCTP_INIT_ACK,
DPVS_SCTP_COOKIE_ECHO,
DPVS_SCTP_COOKIE_ACK,
DPVS_SCTP_SHUTDOWN,
DPVS_SCTP_SHUTDOWN_ACK,
DPVS_SCTP_SHUTDOWN_COMPLETE,
DPVS_SCTP_ERROR,
DPVS_SCTP_ABORT,
DPVS_SCTP_EVENT_LAST
};

/* ip_vs_conn handling functions
* (from ip_vs_conn.c)
*/
enum { DPVS_DIR_INPUT = 0,
DPVS_DIR_OUTPUT,
DPVS_DIR_INPUT_ONLY,
DPVS_DIR_LAST,
};

/* SCTP State Values */
enum dpvs_sctp_states {
DPVS_SCTP_S_NONE,
DPVS_SCTP_S_INIT1,
DPVS_SCTP_S_INIT,
DPVS_SCTP_S_COOKIE_SENT,
DPVS_SCTP_S_COOKIE_REPLIED,
DPVS_SCTP_S_COOKIE_WAIT,
DPVS_SCTP_S_COOKIE,
DPVS_SCTP_S_COOKIE_ECHOED,
DPVS_SCTP_S_ESTABLISHED,
DPVS_SCTP_S_SHUTDOWN_SENT,
DPVS_SCTP_S_SHUTDOWN_RECEIVED,
DPVS_SCTP_S_SHUTDOWN_ACK_SENT,
DPVS_SCTP_S_REJECTED,
DPVS_SCTP_S_CLOSED,
DPVS_SCTP_S_LAST
};

#endif
1 change: 1 addition & 0 deletions include/ipvs/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ enum dp_vs_estats_type {
SYNPROXY_CONN_REUSED_CLOSEWAIT,
SYNPROXY_CONN_REUSED_LASTACK,
DEFENCE_IP_FRAG_DROP,
DEFENCE_SCTP_DROP,
DEFENCE_TCP_DROP,
DEFENCE_UDP_DROP,
FAST_XMIT_REJECT,
Expand Down
Loading
Loading