blob: 444130655d8ea845ee7395a344f0a57c98aabddf [file] [log] [blame]
Thomas Gleixner25763b32019-05-28 10:10:09 -07001// SPDX-License-Identifier: GPL-2.0-only
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Generic HDLC support routines for Linux
4 * Cisco HDLC support
5 *
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +02006 * Copyright (C) 2000 - 2006 Krzysztof Halasa <khc@pm.waw.pl>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/errno.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/hdlc.h>
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +020011#include <linux/if_arp.h>
12#include <linux/inetdevice.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/pkt_sched.h>
17#include <linux/poll.h>
18#include <linux/rtnetlink.h>
19#include <linux/skbuff.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#undef DEBUG_HARD_HEADER
22
23#define CISCO_MULTICAST 0x8F /* Cisco multicast address */
24#define CISCO_UNICAST 0x0F /* Cisco unicast address */
25#define CISCO_KEEPALIVE 0x8035 /* Cisco keepalive protocol */
26#define CISCO_SYS_INFO 0x2000 /* Cisco interface/system info */
27#define CISCO_ADDR_REQ 0 /* Cisco address request */
28#define CISCO_ADDR_REPLY 1 /* Cisco address reply */
29#define CISCO_KEEPALIVE_REQ 2 /* Cisco keepalive request */
30
31
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020032struct hdlc_header {
33 u8 address;
34 u8 control;
Krzysztof Halasaabf17ff2007-04-27 13:13:33 +020035 __be16 protocol;
Eric Dumazetba2d3582010-06-02 18:10:09 +000036}__packed;
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020037
38
39struct cisco_packet {
Krzysztof Halasaabf17ff2007-04-27 13:13:33 +020040 __be32 type; /* code */
41 __be32 par1;
42 __be32 par2;
43 __be16 rel; /* reliability */
44 __be32 time;
Eric Dumazetba2d3582010-06-02 18:10:09 +000045}__packed;
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020046#define CISCO_PACKET_LEN 18
47#define CISCO_BIG_PACKET_LEN 20
48
49
50struct cisco_state {
51 cisco_proto settings;
52
53 struct timer_list timer;
Kees Cookd26c0892017-10-16 17:29:22 -070054 struct net_device *dev;
Krzysztof Halasaaff26e22008-05-19 19:11:08 +020055 spinlock_t lock;
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020056 unsigned long last_poll;
57 int up;
Krzysztof Halasa96520412009-10-09 06:16:10 +000058 u32 txseq; /* TX sequence number, 0 = none */
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020059 u32 rxseq; /* RX sequence number */
60};
61
62
63static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr);
64
65
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +020066static inline struct cisco_state* state(hdlc_device *hdlc)
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020067{
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +020068 return (struct cisco_state *)hdlc->state;
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020069}
70
71
Linus Torvalds1da177e2005-04-16 15:20:36 -070072static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev,
Stephen Hemminger3b04ddd2007-10-09 01:40:57 -070073 u16 type, const void *daddr, const void *saddr,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 unsigned int len)
75{
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020076 struct hdlc_header *data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#ifdef DEBUG_HARD_HEADER
Chen Zhouc68d7242020-01-07 17:33:46 +080078 netdev_dbg(dev, "%s called\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079#endif
80
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020081 skb_push(skb, sizeof(struct hdlc_header));
82 data = (struct hdlc_header*)skb->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 if (type == CISCO_KEEPALIVE)
84 data->address = CISCO_MULTICAST;
85 else
86 data->address = CISCO_UNICAST;
87 data->control = 0;
88 data->protocol = htons(type);
89
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020090 return sizeof(struct hdlc_header);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
92
93
94
95static void cisco_keepalive_send(struct net_device *dev, u32 type,
Krzysztof Halasaabf17ff2007-04-27 13:13:33 +020096 __be32 par1, __be32 par2)
Linus Torvalds1da177e2005-04-16 15:20:36 -070097{
98 struct sk_buff *skb;
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +020099 struct cisco_packet *data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200101 skb = dev_alloc_skb(sizeof(struct hdlc_header) +
102 sizeof(struct cisco_packet));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 if (!skb) {
Chen Zhouc68d7242020-01-07 17:33:46 +0800104 netdev_warn(dev, "Memory squeeze on %s()\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 return;
106 }
107 skb_reserve(skb, 4);
108 cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0);
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200109 data = (struct cisco_packet*)(skb->data + 4);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
111 data->type = htonl(type);
Krzysztof Halasaabf17ff2007-04-27 13:13:33 +0200112 data->par1 = par1;
113 data->par2 = par2;
Harvey Harrison09640e632009-02-01 00:45:17 -0800114 data->rel = cpu_to_be16(0xFFFF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 /* we will need do_div here if 1000 % HZ != 0 */
116 data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ));
117
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200118 skb_put(skb, sizeof(struct cisco_packet));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 skb->priority = TC_PRIO_CONTROL;
120 skb->dev = dev;
Arnaldo Carvalho de Meloc1d2bbe2007-04-10 20:45:18 -0700121 skb_reset_network_header(skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
123 dev_queue_xmit(skb);
124}
125
126
127
Alexey Dobriyanab611482005-07-12 12:08:43 -0700128static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129{
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200130 struct hdlc_header *data = (struct hdlc_header*)skb->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200132 if (skb->len < sizeof(struct hdlc_header))
Harvey Harrison09640e632009-02-01 00:45:17 -0800133 return cpu_to_be16(ETH_P_HDLC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134
135 if (data->address != CISCO_MULTICAST &&
136 data->address != CISCO_UNICAST)
Harvey Harrison09640e632009-02-01 00:45:17 -0800137 return cpu_to_be16(ETH_P_HDLC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Rudy Matela640462c2009-12-09 11:35:40 -0300139 switch (data->protocol) {
Harvey Harrison09640e632009-02-01 00:45:17 -0800140 case cpu_to_be16(ETH_P_IP):
141 case cpu_to_be16(ETH_P_IPX):
142 case cpu_to_be16(ETH_P_IPV6):
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200143 skb_pull(skb, sizeof(struct hdlc_header));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 return data->protocol;
145 default:
Harvey Harrison09640e632009-02-01 00:45:17 -0800146 return cpu_to_be16(ETH_P_HDLC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 }
148}
149
150
151static int cisco_rx(struct sk_buff *skb)
152{
153 struct net_device *dev = skb->dev;
154 hdlc_device *hdlc = dev_to_hdlc(dev);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200155 struct cisco_state *st = state(hdlc);
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200156 struct hdlc_header *data = (struct hdlc_header*)skb->data;
157 struct cisco_packet *cisco_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 struct in_device *in_dev;
Al Viroa144ea42006-09-28 18:00:55 -0700159 __be32 addr, mask;
Krzysztof Halasa96520412009-10-09 06:16:10 +0000160 u32 ack;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200162 if (skb->len < sizeof(struct hdlc_header))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 goto rx_error;
164
165 if (data->address != CISCO_MULTICAST &&
166 data->address != CISCO_UNICAST)
167 goto rx_error;
168
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +0200169 switch (ntohs(data->protocol)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 case CISCO_SYS_INFO:
171 /* Packet is not needed, drop it. */
172 dev_kfree_skb_any(skb);
173 return NET_RX_SUCCESS;
174
175 case CISCO_KEEPALIVE:
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200176 if ((skb->len != sizeof(struct hdlc_header) +
177 CISCO_PACKET_LEN) &&
178 (skb->len != sizeof(struct hdlc_header) +
179 CISCO_BIG_PACKET_LEN)) {
Joe Perches12a3bfe2011-06-26 19:01:28 +0000180 netdev_info(dev, "Invalid length of Cisco control packet (%d bytes)\n",
181 skb->len);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 goto rx_error;
183 }
184
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200185 cisco_data = (struct cisco_packet*)(skb->data + sizeof
186 (struct hdlc_header));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187
Rudy Matela640462c2009-12-09 11:35:40 -0300188 switch (ntohl (cisco_data->type)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
Eric Dumazet95ae6b22010-09-15 04:04:31 +0000190 rcu_read_lock();
191 in_dev = __in_dev_get_rcu(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 addr = 0;
Harvey Harrison09640e632009-02-01 00:45:17 -0800193 mask = ~cpu_to_be32(0); /* is the mask correct? */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
195 if (in_dev != NULL) {
Florian Westphalcb8f1472019-05-31 18:27:08 +0200196 const struct in_ifaddr *ifa;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
Florian Westphalcb8f1472019-05-31 18:27:08 +0200198 in_dev_for_each_ifa_rcu(ifa, in_dev) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 if (strcmp(dev->name,
Florian Westphalcb8f1472019-05-31 18:27:08 +0200200 ifa->ifa_label) == 0) {
201 addr = ifa->ifa_local;
202 mask = ifa->ifa_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 break;
204 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 }
206
207 cisco_keepalive_send(dev, CISCO_ADDR_REPLY,
208 addr, mask);
209 }
Eric Dumazet95ae6b22010-09-15 04:04:31 +0000210 rcu_read_unlock();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 dev_kfree_skb_any(skb);
212 return NET_RX_SUCCESS;
213
214 case CISCO_ADDR_REPLY:
Joe Perches12a3bfe2011-06-26 19:01:28 +0000215 netdev_info(dev, "Unexpected Cisco IP address reply\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 goto rx_error;
217
218 case CISCO_KEEPALIVE_REQ:
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200219 spin_lock(&st->lock);
220 st->rxseq = ntohl(cisco_data->par1);
Krzysztof Halasa96520412009-10-09 06:16:10 +0000221 ack = ntohl(cisco_data->par2);
222 if (ack && (ack == st->txseq ||
223 /* our current REQ may be in transit */
224 ack == st->txseq - 1)) {
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200225 st->last_poll = jiffies;
226 if (!st->up) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 u32 sec, min, hrs, days;
228 sec = ntohl(cisco_data->time) / 1000;
229 min = sec / 60; sec -= min * 60;
230 hrs = min / 60; min -= hrs * 60;
231 days = hrs / 24; hrs -= days * 24;
Joe Perches12a3bfe2011-06-26 19:01:28 +0000232 netdev_info(dev, "Link up (peer uptime %ud%uh%um%us)\n",
233 days, hrs, min, sec);
Krzysztof Halasac2ce9202006-07-12 13:46:12 -0700234 netif_dormant_off(dev);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200235 st->up = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 }
237 }
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200238 spin_unlock(&st->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239
240 dev_kfree_skb_any(skb);
241 return NET_RX_SUCCESS;
Rudy Matela640462c2009-12-09 11:35:40 -0300242 } /* switch (keepalive type) */
243 } /* switch (protocol) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
Joe Perches12a3bfe2011-06-26 19:01:28 +0000245 netdev_info(dev, "Unsupported protocol %x\n", ntohs(data->protocol));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 dev_kfree_skb_any(skb);
247 return NET_RX_DROP;
248
Krzysztof Halasa198191c2008-06-30 23:26:53 +0200249rx_error:
250 dev->stats.rx_errors++; /* Mark error */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 dev_kfree_skb_any(skb);
252 return NET_RX_DROP;
253}
254
255
256
Kees Cookd26c0892017-10-16 17:29:22 -0700257static void cisco_timer(struct timer_list *t)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258{
Kees Cookd26c0892017-10-16 17:29:22 -0700259 struct cisco_state *st = from_timer(st, t, timer);
260 struct net_device *dev = st->dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200262 spin_lock(&st->lock);
263 if (st->up &&
264 time_after(jiffies, st->last_poll + st->settings.timeout * HZ)) {
265 st->up = 0;
Joe Perches12a3bfe2011-06-26 19:01:28 +0000266 netdev_info(dev, "Link down\n");
Krzysztof Halasac2ce9202006-07-12 13:46:12 -0700267 netif_dormant_on(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 }
269
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200270 cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq),
271 htonl(st->rxseq));
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200272 spin_unlock(&st->lock);
273
274 st->timer.expires = jiffies + st->settings.interval * HZ;
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200275 add_timer(&st->timer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276}
277
278
279
280static void cisco_start(struct net_device *dev)
281{
282 hdlc_device *hdlc = dev_to_hdlc(dev);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200283 struct cisco_state *st = state(hdlc);
284 unsigned long flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200286 spin_lock_irqsave(&st->lock, flags);
Krzysztof Halasa96520412009-10-09 06:16:10 +0000287 st->up = st->txseq = st->rxseq = 0;
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200288 spin_unlock_irqrestore(&st->lock, flags);
289
Kees Cookd26c0892017-10-16 17:29:22 -0700290 st->dev = dev;
291 timer_setup(&st->timer, cisco_timer, 0);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200292 st->timer.expires = jiffies + HZ; /* First poll after 1 s */
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200293 add_timer(&st->timer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294}
295
296
297
298static void cisco_stop(struct net_device *dev)
299{
300 hdlc_device *hdlc = dev_to_hdlc(dev);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200301 struct cisco_state *st = state(hdlc);
302 unsigned long flags;
303
304 del_timer_sync(&st->timer);
305
306 spin_lock_irqsave(&st->lock, flags);
Krzysztof Halasac2ce9202006-07-12 13:46:12 -0700307 netif_dormant_on(dev);
Krzysztof Halasa96520412009-10-09 06:16:10 +0000308 st->up = st->txseq = 0;
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200309 spin_unlock_irqrestore(&st->lock, flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310}
311
312
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200313static struct hdlc_proto proto = {
314 .start = cisco_start,
315 .stop = cisco_stop,
316 .type_trans = cisco_type_trans,
317 .ioctl = cisco_ioctl,
Krzysztof Halasa40d25142008-02-01 22:37:12 +0100318 .netif_rx = cisco_rx,
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200319 .module = THIS_MODULE,
320};
Stephen Hemminger3b04ddd2007-10-09 01:40:57 -0700321
322static const struct header_ops cisco_header_ops = {
323 .create = cisco_hard_header,
324};
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +0200325
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200326static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327{
328 cisco_proto __user *cisco_s = ifr->ifr_settings.ifs_ifsu.cisco;
329 const size_t size = sizeof(cisco_proto);
330 cisco_proto new_settings;
331 hdlc_device *hdlc = dev_to_hdlc(dev);
332 int result;
333
334 switch (ifr->ifr_settings.type) {
335 case IF_GET_PROTO:
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200336 if (dev_to_hdlc(dev)->proto != &proto)
337 return -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 ifr->ifr_settings.type = IF_PROTO_CISCO;
339 if (ifr->ifr_settings.size < size) {
340 ifr->ifr_settings.size = size; /* data size wanted */
341 return -ENOBUFS;
342 }
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200343 if (copy_to_user(cisco_s, &state(hdlc)->settings, size))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 return -EFAULT;
345 return 0;
346
347 case IF_PROTO_CISCO:
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +0200348 if (!capable(CAP_NET_ADMIN))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349 return -EPERM;
350
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +0200351 if (dev->flags & IFF_UP)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 return -EBUSY;
353
354 if (copy_from_user(&new_settings, cisco_s, size))
355 return -EFAULT;
356
357 if (new_settings.interval < 1 ||
358 new_settings.timeout < 2)
359 return -EINVAL;
360
Krzysztof Hałasa4dfce402008-06-30 19:06:40 +0200361 result = hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 if (result)
363 return result;
364
Krzysztof Halasa40d25142008-02-01 22:37:12 +0100365 result = attach_hdlc_protocol(dev, &proto,
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200366 sizeof(struct cisco_state));
367 if (result)
368 return result;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200370 memcpy(&state(hdlc)->settings, &new_settings, size);
Krzysztof Halasaaff26e22008-05-19 19:11:08 +0200371 spin_lock_init(&state(hdlc)->lock);
Stephen Hemminger3b04ddd2007-10-09 01:40:57 -0700372 dev->header_ops = &cisco_header_ops;
Xie He1a545eb2020-08-28 00:07:52 -0700373 dev->hard_header_len = sizeof(struct hdlc_header);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 dev->type = ARPHRD_CISCO;
Andrew Lunn2f8364a2015-12-03 21:12:31 +0100375 call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev);
Krzysztof Halasac2ce9202006-07-12 13:46:12 -0700376 netif_dormant_on(dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 return 0;
378 }
379
380 return -EINVAL;
381}
Krzysztof Halasaeb2a2fd2006-09-26 23:23:45 +0200382
383
384static int __init mod_init(void)
385{
386 register_hdlc_protocol(&proto);
387 return 0;
388}
389
390
391
392static void __exit mod_exit(void)
393{
394 unregister_hdlc_protocol(&proto);
395}
396
397
398module_init(mod_init);
399module_exit(mod_exit);
400
401MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
402MODULE_DESCRIPTION("Cisco HDLC protocol support for generic HDLC");
403MODULE_LICENSE("GPL v2");