Skip to contentSkip to conversation

2.6 X.25: When receiving a call, check listening sockets for matching call user data.

PATCH New Andrew Hendry 1 participant 1 message Nov 3, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6 X.25: When receiving a call, check listening sockets for matching call user data.

If a listening socket sets call user data, ensure it only receives calls with matching call user data. Also ensure incoming calls with matching call user data dont go to another listening socket.

include/net/x25.h +1 -0
diff -uprN -X dontdiff linux-2.6.8.1-vanilla/include/net/x25.h linux-2.6.8.1/include/net/x25.h
@@ -243,6 +243,7 @@ extern int  x25_validate_nr(struct sock 
 extern void x25_write_internal(struct sock *, int);
 extern int  x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *);
 extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char);
+extern int x25_check_calluserdata(struct x25_calluserdata *,struct x25_calluserdata *);
 
 /* x25_timer.c */
 extern void x25_start_heartbeat(struct sock *);
net/x25/af_x25.c +47 -15

109 lines not on this page · raw message

net/x25/x25_subr.c +19 -0
diff -uprN -X dontdiff linux-2.6.8.1-vanilla/net/x25/x25_subr.c linux-2.6.8.1/net/x25/x25_subr.c
@@ -367,3 +367,22 @@ void x25_check_rbuf(struct sock *sk)
 		x25_stop_timer(sk);
 	}
 }
+
+/*
+ * Compare 2 calluserdata structures, used to find correct listening sockets
+ * when call user data is used.
+ */
+int x25_check_calluserdata(struct x25_calluserdata *ours, struct x25_calluserdata *theirs)
+{
+	int i;
+	if (ours->cudlength != theirs->cudlength)
+		return 0;
+
+	for (i=0;i<ours->cudlength;i++) {
+		if (ours->cuddata[i] != theirs->cuddata[i]) {
+			return 0;
+		}
+	}
+	return 1;
+}
+