aboutsummaryrefslogtreecommitdiffstats
path: root/net/rose/af_rose.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/rose/af_rose.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'net/rose/af_rose.c')
-rw-r--r--net/rose/af_rose.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index d952e7eac188..f9ea925ad9cb 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -682,10 +682,8 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
682 if ((unsigned int) addr->srose_ndigis > ROSE_MAX_DIGIS) 682 if ((unsigned int) addr->srose_ndigis > ROSE_MAX_DIGIS)
683 return -EINVAL; 683 return -EINVAL;
684 684
685 if ((dev = rose_dev_get(&addr->srose_addr)) == NULL) { 685 if ((dev = rose_dev_get(&addr->srose_addr)) == NULL)
686 SOCK_DEBUG(sk, "ROSE: bind failed: invalid address\n");
687 return -EADDRNOTAVAIL; 686 return -EADDRNOTAVAIL;
688 }
689 687
690 source = &addr->srose_call; 688 source = &addr->srose_call;
691 689
@@ -716,7 +714,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
716 rose_insert_socket(sk); 714 rose_insert_socket(sk);
717 715
718 sock_reset_flag(sk, SOCK_ZAPPED); 716 sock_reset_flag(sk, SOCK_ZAPPED);
719 SOCK_DEBUG(sk, "ROSE: socket is bound\n"); 717
720 return 0; 718 return 0;
721} 719}
722 720
@@ -803,7 +801,6 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
803 801
804 rose_insert_socket(sk); /* Finish the bind */ 802 rose_insert_socket(sk); /* Finish the bind */
805 } 803 }
806rose_try_next_neigh:
807 rose->dest_addr = addr->srose_addr; 804 rose->dest_addr = addr->srose_addr;
808 rose->dest_call = addr->srose_call; 805 rose->dest_call = addr->srose_call;
809 rose->rand = ((long)rose & 0xFFFF) + rose->lci; 806 rose->rand = ((long)rose & 0xFFFF) + rose->lci;
@@ -865,12 +862,6 @@ rose_try_next_neigh:
865 } 862 }
866 863
867 if (sk->sk_state != TCP_ESTABLISHED) { 864 if (sk->sk_state != TCP_ESTABLISHED) {
868 /* Try next neighbour */
869 rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause, &diagnostic, 0);
870 if (rose->neighbour)
871 goto rose_try_next_neigh;
872
873 /* No more neighbours */
874 sock->state = SS_UNCONNECTED; 865 sock->state = SS_UNCONNECTED;
875 err = sock_error(sk); /* Always set at this point */ 866 err = sock_error(sk); /* Always set at this point */
876 goto out_release; 867 goto out_release;
@@ -985,7 +976,7 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
985 struct sock *make; 976 struct sock *make;
986 struct rose_sock *make_rose; 977 struct rose_sock *make_rose;
987 struct rose_facilities_struct facilities; 978 struct rose_facilities_struct facilities;
988 int n, len; 979 int n;
989 980
990 skb->sk = NULL; /* Initially we don't know who it's for */ 981 skb->sk = NULL; /* Initially we don't know who it's for */
991 982
@@ -994,9 +985,9 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros
994 */ 985 */
995 memset(&facilities, 0x00, sizeof(struct rose_facilities_struct)); 986 memset(&facilities, 0x00, sizeof(struct rose_facilities_struct));
996 987
997 len = (((skb->data[3] >> 4) & 0x0F) + 1) >> 1; 988 if (!rose_parse_facilities(skb->data + ROSE_CALL_REQ_FACILITIES_OFF,
998 len += (((skb->data[3] >> 0) & 0x0F) + 1) >> 1; 989 skb->len - ROSE_CALL_REQ_FACILITIES_OFF,
999 if (!rose_parse_facilities(skb->data + len + 4, &facilities)) { 990 &facilities)) {
1000 rose_transmit_clear_request(neigh, lci, ROSE_INVALID_FACILITY, 76); 991 rose_transmit_clear_request(neigh, lci, ROSE_INVALID_FACILITY, 76);
1001 return 0; 992 return 0;
1002 } 993 }
@@ -1116,10 +1107,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
1116 srose.srose_digis[n] = rose->dest_digis[n]; 1107 srose.srose_digis[n] = rose->dest_digis[n];
1117 } 1108 }
1118 1109
1119 SOCK_DEBUG(sk, "ROSE: sendto: Addresses built.\n");
1120
1121 /* Build a packet */ 1110 /* Build a packet */
1122 SOCK_DEBUG(sk, "ROSE: sendto: building packet.\n");
1123 /* Sanity check the packet size */ 1111 /* Sanity check the packet size */
1124 if (len > 65535) 1112 if (len > 65535)
1125 return -EMSGSIZE; 1113 return -EMSGSIZE;
@@ -1134,7 +1122,6 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
1134 /* 1122 /*
1135 * Put the data on the end 1123 * Put the data on the end
1136 */ 1124 */
1137 SOCK_DEBUG(sk, "ROSE: Appending user data\n");
1138 1125
1139 skb_reset_transport_header(skb); 1126 skb_reset_transport_header(skb);
1140 skb_put(skb, len); 1127 skb_put(skb, len);
@@ -1159,8 +1146,6 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
1159 */ 1146 */
1160 asmptr = skb_push(skb, ROSE_MIN_LEN); 1147 asmptr = skb_push(skb, ROSE_MIN_LEN);
1161 1148
1162 SOCK_DEBUG(sk, "ROSE: Building Network Header.\n");
1163
1164 /* Build a ROSE Network header */ 1149 /* Build a ROSE Network header */
1165 asmptr[0] = ((rose->lci >> 8) & 0x0F) | ROSE_GFI; 1150 asmptr[0] = ((rose->lci >> 8) & 0x0F) | ROSE_GFI;
1166 asmptr[1] = (rose->lci >> 0) & 0xFF; 1151 asmptr[1] = (rose->lci >> 0) & 0xFF;
@@ -1169,10 +1154,6 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
1169 if (qbit) 1154 if (qbit)
1170 asmptr[0] |= ROSE_Q_BIT; 1155 asmptr[0] |= ROSE_Q_BIT;
1171 1156
1172 SOCK_DEBUG(sk, "ROSE: Built header.\n");
1173
1174 SOCK_DEBUG(sk, "ROSE: Transmitting buffer\n");
1175
1176 if (sk->sk_state != TCP_ESTABLISHED) { 1157 if (sk->sk_state != TCP_ESTABLISHED) {
1177 kfree_skb(skb); 1158 kfree_skb(skb);
1178 return -ENOTCONN; 1159 return -ENOTCONN;