diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /net/netrom/nr_route.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'net/netrom/nr_route.c')
-rw-r--r-- | net/netrom/nr_route.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index fa2167a46..0a3f3a1f3 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c @@ -47,7 +47,7 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/notifier.h> -#include <linux/firewall.h> +#include <linux/netfilter.h> #include <net/netrom.h> static unsigned int nr_neigh_no = 1; @@ -62,7 +62,7 @@ static void nr_remove_neigh(struct nr_neigh *); * neighbour if it is new. */ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax25, - ax25_digi *ax25_digi, struct device *dev, int quality, int obs_count) + ax25_digi *ax25_digi, struct net_device *dev, int quality, int obs_count) { struct nr_node *nr_node; struct nr_neigh *nr_neigh; @@ -321,7 +321,7 @@ static void nr_remove_neigh(struct nr_neigh *nr_neigh) * "Delete" a node. Strictly speaking remove a route to a node. The node * is only deleted if no routes are left to it. */ -static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct device *dev) +static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct net_device *dev) { struct nr_node *nr_node; struct nr_neigh *nr_neigh; @@ -371,7 +371,7 @@ static int nr_del_node(ax25_address *callsign, ax25_address *neighbour, struct d /* * Lock a neighbour with a quality. */ -static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct device *dev, unsigned int quality) +static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net_device *dev, unsigned int quality) { struct nr_neigh *nr_neigh; unsigned long flags; @@ -420,7 +420,7 @@ static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct dev * "Delete" a neighbour. The neighbour is only removed if the number * of nodes that may use it is zero. */ -static int nr_del_neigh(ax25_address *callsign, struct device *dev, unsigned int quality) +static int nr_del_neigh(ax25_address *callsign, struct net_device *dev, unsigned int quality) { struct nr_neigh *nr_neigh; @@ -499,7 +499,7 @@ static int nr_dec_obs(void) /* * A device has been removed. Remove its routes and neighbours. */ -void nr_rt_device_down(struct device *dev) +void nr_rt_device_down(struct net_device *dev) { struct nr_neigh *s, *nr_neigh = nr_neigh_list; struct nr_node *t, *nr_node; @@ -544,25 +544,26 @@ void nr_rt_device_down(struct device *dev) * Check that the device given is a valid AX.25 interface that is "up". * Or a valid ethernet interface with an AX.25 callsign binding. */ -static struct device *nr_ax25_dev_get(char *devname) +static struct net_device *nr_ax25_dev_get(char *devname) { - struct device *dev; + struct net_device *dev; - if ((dev = dev_get(devname)) == NULL) + if ((dev = dev_get_by_name(devname)) == NULL) return NULL; if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25) return dev; + dev_put(dev); return NULL; } /* * Find the first active NET/ROM device, usually "nr0". */ -struct device *nr_dev_first(void) +struct net_device *nr_dev_first(void) { - struct device *dev, *first = NULL; + struct net_device *dev, *first = NULL; read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { @@ -578,14 +579,16 @@ struct device *nr_dev_first(void) /* * Find the NET/ROM device for the given callsign. */ -struct device *nr_dev_get(ax25_address *addr) +struct net_device *nr_dev_get(ax25_address *addr) { - struct device *dev; + struct net_device *dev; read_lock(&dev_base_lock); for (dev = dev_base; dev != NULL; dev = dev->next) { - if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0) + if ((dev->flags & IFF_UP) && dev->type == ARPHRD_NETROM && ax25cmp(addr, (ax25_address *)dev->dev_addr) == 0) { + dev_hold(dev); goto out; + } } out: read_unlock(&dev_base_lock); @@ -617,7 +620,7 @@ static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) int nr_rt_ioctl(unsigned int cmd, void *arg) { struct nr_route_struct nr_route; - struct device *dev; + struct net_device *dev; switch (cmd) { @@ -703,14 +706,9 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) ax25_address *nr_src, *nr_dest; struct nr_neigh *nr_neigh; struct nr_node *nr_node; - struct device *dev; + struct net_device *dev; unsigned char *dptr; - if (ax25 != NULL && call_in_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; - - if (ax25 == NULL && call_out_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; nr_src = (ax25_address *)(skb->data + 0); nr_dest = (ax25_address *)(skb->data + 7); @@ -745,9 +743,6 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) if ((dev = nr_dev_first()) == NULL) return 0; - if (ax25 != NULL && call_fw_firewall(PF_NETROM, skb->dev, skb->data, NULL, &skb) != FW_ACCEPT) - return 0; - dptr = skb_push(skb, 1); *dptr = AX25_P_NETROM; |