diff options
Diffstat (limited to 'net/netrom')
-rw-r--r-- | net/netrom/af_netrom.c | 8 | ||||
-rw-r--r-- | net/netrom/nr_dev.c | 26 |
2 files changed, 15 insertions, 19 deletions
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index e9c05b8f4f45..4e705f87969f 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -1082,7 +1082,11 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1082 | 1082 | ||
1083 | SOCK_DEBUG(sk, "NET/ROM: sendto: Addresses built.\n"); | 1083 | SOCK_DEBUG(sk, "NET/ROM: sendto: Addresses built.\n"); |
1084 | 1084 | ||
1085 | /* Build a packet */ | 1085 | /* Build a packet - the conventional user limit is 236 bytes. We can |
1086 | do ludicrously large NetROM frames but must not overflow */ | ||
1087 | if (len > 65536) | ||
1088 | return -EMSGSIZE; | ||
1089 | |||
1086 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); | 1090 | SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); |
1087 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 1091 | size = len + NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
1088 | 1092 | ||
@@ -1432,7 +1436,7 @@ static int __init nr_proto_init(void) | |||
1432 | struct net_device *dev; | 1436 | struct net_device *dev; |
1433 | 1437 | ||
1434 | sprintf(name, "nr%d", i); | 1438 | sprintf(name, "nr%d", i); |
1435 | dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup); | 1439 | dev = alloc_netdev(0, name, nr_setup); |
1436 | if (!dev) { | 1440 | if (!dev) { |
1437 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); | 1441 | printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); |
1438 | goto fail; | 1442 | goto fail; |
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 6caf459665f2..351372463fed 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) | 43 | int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) |
44 | { | 44 | { |
45 | struct net_device_stats *stats = netdev_priv(dev); | 45 | struct net_device_stats *stats = &dev->stats; |
46 | 46 | ||
47 | if (!netif_running(dev)) { | 47 | if (!netif_running(dev)) { |
48 | stats->rx_dropped++; | 48 | stats->rx_dropped++; |
@@ -171,8 +171,7 @@ static int nr_close(struct net_device *dev) | |||
171 | 171 | ||
172 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) | 172 | static int nr_xmit(struct sk_buff *skb, struct net_device *dev) |
173 | { | 173 | { |
174 | struct nr_private *nr = netdev_priv(dev); | 174 | struct net_device_stats *stats = &dev->stats; |
175 | struct net_device_stats *stats = &nr->stats; | ||
176 | unsigned int len = skb->len; | 175 | unsigned int len = skb->len; |
177 | 176 | ||
178 | if (!nr_route_frame(skb, NULL)) { | 177 | if (!nr_route_frame(skb, NULL)) { |
@@ -187,34 +186,27 @@ static int nr_xmit(struct sk_buff *skb, struct net_device *dev) | |||
187 | return 0; | 186 | return 0; |
188 | } | 187 | } |
189 | 188 | ||
190 | static struct net_device_stats *nr_get_stats(struct net_device *dev) | ||
191 | { | ||
192 | struct nr_private *nr = netdev_priv(dev); | ||
193 | |||
194 | return &nr->stats; | ||
195 | } | ||
196 | |||
197 | static const struct header_ops nr_header_ops = { | 189 | static const struct header_ops nr_header_ops = { |
198 | .create = nr_header, | 190 | .create = nr_header, |
199 | .rebuild= nr_rebuild_header, | 191 | .rebuild= nr_rebuild_header, |
200 | }; | 192 | }; |
201 | 193 | ||
194 | static const struct net_device_ops nr_netdev_ops = { | ||
195 | .ndo_open = nr_open, | ||
196 | .ndo_stop = nr_close, | ||
197 | .ndo_start_xmit = nr_xmit, | ||
198 | .ndo_set_mac_address = nr_set_mac_address, | ||
199 | }; | ||
202 | 200 | ||
203 | void nr_setup(struct net_device *dev) | 201 | void nr_setup(struct net_device *dev) |
204 | { | 202 | { |
205 | dev->mtu = NR_MAX_PACKET_SIZE; | 203 | dev->mtu = NR_MAX_PACKET_SIZE; |
206 | dev->hard_start_xmit = nr_xmit; | 204 | dev->netdev_ops = &nr_netdev_ops; |
207 | dev->open = nr_open; | ||
208 | dev->stop = nr_close; | ||
209 | |||
210 | dev->header_ops = &nr_header_ops; | 205 | dev->header_ops = &nr_header_ops; |
211 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 206 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
212 | dev->addr_len = AX25_ADDR_LEN; | 207 | dev->addr_len = AX25_ADDR_LEN; |
213 | dev->type = ARPHRD_NETROM; | 208 | dev->type = ARPHRD_NETROM; |
214 | dev->set_mac_address = nr_set_mac_address; | ||
215 | 209 | ||
216 | /* New-style flags. */ | 210 | /* New-style flags. */ |
217 | dev->flags = IFF_NOARP; | 211 | dev->flags = IFF_NOARP; |
218 | |||
219 | dev->get_stats = nr_get_stats; | ||
220 | } | 212 | } |