Skip to content

Commit 9bc87c3

Browse files
Hakon-BuggeSomasundaram Krishnasamy
authored andcommitted
rds: Fix heartbeat
RDS' heartbeat mechanism sends probes back and forth from source port zero to destination port zero. uek-4.1-qu7 commit 041dc3e ("Backport multipath RDS from upstream to UEK4") tosses all receives where said ports are zero. The consequence is that no heartbeat pongs are ever sent back, and the active heart-beater will time-out and tear down the connection. Orabug: 30418039 Fixes: 041dc3e ("Backport multipath RDS from upstream to UEK4") Signed-off-by: Håkon Bugge <[email protected]> Tested-by: Michael Nowak <[email protected]> Reviewed-by: Ka-Cheong Poon <[email protected]> --- v1->v2: * Tightened the check for probes, which must have zero-length and one and only one of the heartbeat probe bits is set in the header. v2->v3: * Re-factored inline function rds_valid_hb_flags() in rds.h into rds_recv_local() to avoid code duplication, as suggested by Ka-Cheong. * Added Ka-Cheong's r-b Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 82f8de8 commit 9bc87c3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

net/rds/rds.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ void rds_conn_net_set(struct rds_connection *conn, struct net *net)
402402
#define RDS_FLAG_RETRANSMITTED 0x04
403403
#define RDS_FLAG_HB_PING 0x08
404404
#define RDS_FLAG_HB_PONG 0x10
405+
#define RDS_FLAG_ANY_HB (RDS_FLAG_HB_PING | RDS_FLAG_HB_PONG)
405406
#define RDS_FLAG_EXTHDR_EXTENSION 0x20
406407
#define RDS_MAX_ADV_CREDIT 127
407408

net/rds/recv.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,14 +685,23 @@ rds_recv_local(struct rds_conn_path *cp, struct in6_addr *saddr,
685685
cp->cp_next_rx_seq = inc_hdr_h_sequence + 1;
686686

687687
if (rds_sysctl_ping_enable && inc->i_hdr.h_dport == 0) {
688-
if (inc->i_hdr.h_sport == 0) {
688+
bool is_hb_ping = (inc->i_hdr.h_flags & RDS_FLAG_ANY_HB) == RDS_FLAG_HB_PING;
689+
bool is_hb_pong = (inc->i_hdr.h_flags & RDS_FLAG_ANY_HB) == RDS_FLAG_HB_PONG;
690+
691+
if (inc->i_hdr.h_len) {
692+
rdsdebug("ignore ping with non-zero length from %pI6c\n", &saddr);
693+
goto out;
694+
}
695+
696+
/* One and only one of the heart-beat flags must be set */
697+
if (inc->i_hdr.h_sport == 0 && !(is_hb_ping ^ is_hb_pong)) {
689698
rdsdebug("ignore ping with 0 sport from %pI6c\n",
690699
&saddr);
691700
goto out;
692701
}
693-
if (inc->i_hdr.h_flags & RDS_FLAG_HB_PING) {
702+
if (is_hb_ping) {
694703
rds_send_hb(conn, 1);
695-
} else if (inc->i_hdr.h_flags & RDS_FLAG_HB_PONG) {
704+
} else if (is_hb_pong) {
696705
cp->cp_hb_start = 0;
697706
} else {
698707
rds_stats_inc(s_recv_ping);

0 commit comments

Comments
 (0)