diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
commit | b9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch) | |
tree | 42d07b0c7246ae2536a702e7c5de9e2732341116 /net/x25 | |
parent | 7406b0a326f2d70ade2671c37d1beef62249db97 (diff) |
Merge with 2.3.99-pre6.
Diffstat (limited to 'net/x25')
-rw-r--r-- | net/x25/af_x25.c | 41 | ||||
-rw-r--r-- | net/x25/x25_facilities.c | 27 | ||||
-rw-r--r-- | net/x25/x25_in.c | 10 | ||||
-rw-r--r-- | net/x25/x25_link.c | 11 | ||||
-rw-r--r-- | net/x25/x25_subr.c | 10 |
5 files changed, 63 insertions, 36 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index e042ce1d8..ebaaa7242 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -17,6 +17,9 @@ * X.25 002 Jonathan Naylor Centralised disconnect handling. * New timer architecture. * 2000-11-03 Henner Eisen MSG_EOR handling more POSIX compliant. + * 2000-22-03 Daniela Squassoni Allowed disabling/enabling of + * facilities negotiation and increased + * the throughput upper limit. */ #include <linux/config.h> @@ -811,6 +814,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *neigh, unsigned i make->protinfo.x25->source_addr = source_addr; make->protinfo.x25->neighbour = neigh; make->protinfo.x25->facilities = facilities; + make->protinfo.x25->vc_facil_mask = sk->protinfo.x25->vc_facil_mask; x25_write_internal(make, X25_CALL_ACCEPTED); @@ -1133,7 +1137,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) return -EINVAL; if (facilities.winsize_in < 1 || facilities.winsize_in > 127) return -EINVAL; - if (facilities.throughput < 0x03 || facilities.throughput > 0x2C) + if (facilities.throughput < 0x03 || facilities.throughput > 0xDD) return -EINVAL; if (facilities.reverse != 0 && facilities.reverse != 1) return -EINVAL; @@ -1239,24 +1243,23 @@ struct net_proto_family x25_family_ops = { }; static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = { - AF_X25, - - x25_release, - x25_bind, - x25_connect, - sock_no_socketpair, - x25_accept, - x25_getname, - datagram_poll, - x25_ioctl, - x25_listen, - sock_no_shutdown, - x25_setsockopt, - x25_getsockopt, - sock_no_fcntl, - x25_sendmsg, - x25_recvmsg, - sock_no_mmap + family: AF_X25, + + release: x25_release, + bind: x25_bind, + connect: x25_connect, + socketpair: sock_no_socketpair, + accept: x25_accept, + getname: x25_getname, + poll: datagram_poll, + ioctl: x25_ioctl, + listen: x25_listen, + shutdown: sock_no_shutdown, + setsockopt: x25_setsockopt, + getsockopt: x25_getsockopt, + sendmsg: x25_sendmsg, + recvmsg: x25_recvmsg, + mmap: sock_no_mmap, }; #include <linux/smp_lock.h> diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 18de2da1a..ad41d1cde 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c @@ -14,6 +14,8 @@ * * History * X.25 001 Split from x25_subr.c + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #include <linux/config.h> @@ -43,12 +45,13 @@ * Parse a set of facilities into the facilities structure. Unrecognised * facilities are written to the debug log file. */ -int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities) +int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, unsigned long *vc_fac_mask) { unsigned int len; unsigned char *p = skb->data; len = *p++; + *vc_fac_mask = 0; while (len > 0) { switch (*p & X25_FAC_CLASS_MASK) { @@ -56,9 +59,11 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities) switch (*p) { case X25_FAC_REVERSE: facilities->reverse = (p[1] & 0x01); + *vc_fac_mask |= X25_MASK_REVERSE; break; case X25_FAC_THROUGHPUT: facilities->throughput = p[1]; + *vc_fac_mask |= X25_MASK_THROUGHPUT; break; default: printk(KERN_DEBUG "X.25: unknown facility %02X, value %02X\n", p[0], p[1]); @@ -73,10 +78,12 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities) case X25_FAC_PACKET_SIZE: facilities->pacsize_in = p[1]; facilities->pacsize_out = p[2]; + *vc_fac_mask |= X25_MASK_PACKET_SIZE; break; case X25_FAC_WINDOW_SIZE: facilities->winsize_in = p[1]; facilities->winsize_out = p[2]; + *vc_fac_mask |= X25_MASK_WINDOW_SIZE; break; default: printk(KERN_DEBUG "X.25: unknown facility %02X, values %02X, %02X\n", p[0], p[1], p[2]); @@ -106,28 +113,34 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities) /* * Create a set of facilities. */ -int x25_create_facilities(unsigned char *buffer, struct x25_facilities *facilities) +int x25_create_facilities(unsigned char *buffer, struct x25_facilities *facilities, unsigned long facil_mask) { unsigned char *p = buffer + 1; int len; - if (facilities->reverse != 0) { + if (facil_mask == 0) { + buffer [0] = 0; /* length of the facilities field in call_req or call_accept packets */ + len = 1; /* 1 byte for the length field */ + return len; + } + + if ((facilities->reverse != 0) && (facil_mask & X25_MASK_REVERSE)) { *p++ = X25_FAC_REVERSE; *p++ = (facilities->reverse) ? 0x01 : 0x00; } - if (facilities->throughput != 0) { + if ((facilities->throughput != 0) && (facil_mask & X25_MASK_THROUGHPUT)) { *p++ = X25_FAC_THROUGHPUT; *p++ = facilities->throughput; } - if (facilities->pacsize_in != 0 || facilities->pacsize_out != 0) { + if ((facilities->pacsize_in != 0 || facilities->pacsize_out != 0) && (facil_mask & X25_MASK_PACKET_SIZE)) { *p++ = X25_FAC_PACKET_SIZE; *p++ = (facilities->pacsize_in == 0) ? facilities->pacsize_out : facilities->pacsize_in; *p++ = (facilities->pacsize_out == 0) ? facilities->pacsize_in : facilities->pacsize_out; } - if (facilities->winsize_in != 0 || facilities->winsize_out != 0) { + if ((facilities->winsize_in != 0 || facilities->winsize_out != 0) && (facil_mask & X25_MASK_WINDOW_SIZE)) { *p++ = X25_FAC_WINDOW_SIZE; *p++ = (facilities->winsize_in == 0) ? facilities->winsize_out : facilities->winsize_in; *p++ = (facilities->winsize_out == 0) ? facilities->winsize_in : facilities->winsize_out; @@ -156,7 +169,7 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk, struct x25_fa *new = *ours; - len = x25_parse_facilities(skb, &theirs); + len = x25_parse_facilities(skb, &theirs, &sk->protinfo.x25->vc_facil_mask); /* * They want reverse charging, we won't accept it. diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index a8a2905fe..5110d327a 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c @@ -13,9 +13,11 @@ * 2 of the License, or (at your option) any later version. * * History - * X.25 001 Jonathan Naylor Started coding. - * X.25 002 Jonathan Naylor Centralised disconnection code. - * New timer architecture. + * X.25 001 Jonathan Naylor Started coding. + * X.25 002 Jonathan Naylor Centralised disconnection code. + * New timer architecture. + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #include <linux/config.h> @@ -111,7 +113,7 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp */ skb_pull(skb, X25_STD_MIN_LEN); skb_pull(skb, x25_addr_ntoa(skb->data, &source_addr, &dest_addr)); - skb_pull(skb, x25_parse_facilities(skb, &sk->protinfo.x25->facilities)); + skb_pull(skb, x25_parse_facilities(skb, &sk->protinfo.x25->facilities, &sk->protinfo.x25->vc_facil_mask)); /* * Copy any Call User Data. */ diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index d33dc63c3..34d065b83 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -13,8 +13,10 @@ * 2 of the License, or (at your option) any later version. * * History - * X.25 001 Jonathan Naylor Started coding. - * X.25 002 Jonathan Naylor New timer architecture. + * X.25 001 Jonathan Naylor Started coding. + * X.25 002 Jonathan Naylor New timer architecture. + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #include <linux/config.h> @@ -293,6 +295,7 @@ void x25_link_device_up(struct net_device *dev) x25_neigh->dev = dev; x25_neigh->state = X25_LINK_STATE_0; x25_neigh->extended = 0; + x25_neigh->global_facil_mask = (X25_MASK_REVERSE | X25_MASK_THROUGHPUT | X25_MASK_PACKET_SIZE | X25_MASK_WINDOW_SIZE); /* enables negotiation */ x25_neigh->t20 = sysctl_x25_restart_request_timeout; save_flags(flags); cli(); @@ -377,6 +380,8 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) switch (cmd) { case SIOCX25GSUBSCRIP: + if (copy_from_user(&x25_subscr, arg, sizeof(struct x25_subscrip_struct))) + return -EFAULT; if ((dev = x25_dev_get(x25_subscr.device)) == NULL) return -EINVAL; if ((x25_neigh = x25_get_neigh(dev)) == NULL) { @@ -385,6 +390,7 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) } dev_put(dev); x25_subscr.extended = x25_neigh->extended; + x25_subscr.global_facil_mask = x25_neigh->global_facil_mask; if (copy_to_user(arg, &x25_subscr, sizeof(struct x25_subscrip_struct))) return -EFAULT; break; @@ -402,6 +408,7 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) if (x25_subscr.extended != 0 && x25_subscr.extended != 1) return -EINVAL; x25_neigh->extended = x25_subscr.extended; + x25_neigh->global_facil_mask = x25_subscr.global_facil_mask; break; default: diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c index 8b055e40e..25a700af9 100644 --- a/net/x25/x25_subr.c +++ b/net/x25/x25_subr.c @@ -13,8 +13,10 @@ * 2 of the License, or (at your option) any later version. * * History - * X.25 001 Jonathan Naylor Started coding. - * X.25 002 Jonathan Naylor Centralised disconnection processing. + * X.25 001 Jonathan Naylor Started coding. + * X.25 002 Jonathan Naylor Centralised disconnection processing. + * mar/20/00 Daniela Squassoni Disabling/enabling of facilities + * negotiation. */ #include <linux/config.h> @@ -206,7 +208,7 @@ void x25_write_internal(struct sock *sk, int frametype) len = x25_addr_aton(addresses, &sk->protinfo.x25->dest_addr, &sk->protinfo.x25->source_addr); dptr = skb_put(skb, len); memcpy(dptr, addresses, len); - len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities); + len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities, sk->protinfo.x25->neighbour->global_facil_mask); dptr = skb_put(skb, len); memcpy(dptr, facilities, len); dptr = skb_put(skb, sk->protinfo.x25->calluserdata.cudlength); @@ -218,7 +220,7 @@ void x25_write_internal(struct sock *sk, int frametype) dptr = skb_put(skb, 2); *dptr++ = X25_CALL_ACCEPTED; *dptr++ = 0x00; /* Address lengths */ - len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities); + len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities, sk->protinfo.x25->vc_facil_mask); dptr = skb_put(skb, len); memcpy(dptr, facilities, len); dptr = skb_put(skb, sk->protinfo.x25->calluserdata.cudlength); |