patch-2.1.112 linux/net/x25/af_x25.c

Next file: linux/net/x25/x25_dev.c
Previous file: linux/net/packet/af_packet.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.111/linux/net/x25/af_x25.c linux/net/x25/af_x25.c
@@ -174,7 +174,8 @@
 	struct sock *s;
 
 	for (s = x25_list; s != NULL; s = s->next)
-		if (s->protinfo.x25->neighbour->dev == dev)
+		if (s->protinfo.x25->neighbour &&
+		    s->protinfo.x25->neighbour->dev == dev)
 			x25_disconnect(s, ENETUNREACH, 0, 0);
 }
 
@@ -621,6 +622,9 @@
 	if ((sk->protinfo.x25->neighbour = x25_get_neigh(dev)) == NULL)
 		return -ENETUNREACH;
 
+	x25_limit_facilities(&sk->protinfo.x25->facilities,
+			     sk->protinfo.x25->neighbour);
+
 	if ((sk->protinfo.x25->lci = x25_new_lci(sk->protinfo.x25->neighbour)) == 0)
 		return -ENETUNREACH;
 
@@ -787,6 +791,13 @@
 	}
 
 	/*
+	 * current neighbour/link might impose additional limits
+	 * on certain facilties
+	 */
+
+	x25_limit_facilities(&facilities,neigh);
+
+	/*
 	 *	Try to create a new socket.
 	 */
 	if ((make = x25_make_new(sk)) == NULL) {
@@ -1124,18 +1135,8 @@
 				return -EINVAL;
 			if (facilities.pacsize_out < X25_PS16 || facilities.pacsize_out > X25_PS4096)
 				return -EINVAL;
-			if (sk->state == TCP_CLOSE || sk->protinfo.x25->neighbour->extended) 
-			{
-				if (facilities.winsize_in < 1 || facilities.winsize_in > 127)
-					return -EINVAL;
-				if (facilities.winsize_out < 1 || facilities.winsize_out > 127)
-					return -EINVAL;
-			} else {
-				if (facilities.winsize_in < 1 || facilities.winsize_in > 7)
-					return -EINVAL;
-				if (facilities.winsize_out < 1 || facilities.winsize_out > 7)
-					return -EINVAL;
-			}
+			if (facilities.winsize_in < 1 || facilities.winsize_in > 127)
+				return -EINVAL;
 			if (facilities.throughput < 0x03 || facilities.throughput > 0x2C)
 				return -EINVAL;
 			if (facilities.reverse != 0 && facilities.reverse != 1)
@@ -1275,6 +1276,16 @@
 	x25_device_event,
 	0
 };
+
+void x25_kill_by_neigh(struct x25_neigh *neigh)
+{
+	struct sock *s;
+
+	for( s=x25_list; s != NULL; s=s->next){
+		if( s->protinfo.x25->neighbour == neigh )
+			x25_disconnect(s, ENETUNREACH, 0, 0);
+	} 
+}
 
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry proc_net_x25 = {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov