From 12173d801dbbe1950befa35386f584c2841de6a6 Mon Sep 17 00:00:00 2001 From: Hideaki Yoshifuji Date: Wed, 31 Dec 2003 20:27:45 -0800 Subject: [IPV6]: Kill obsolete functions (ip6_frag_xmit() and ip6_build_xmit()). --- include/net/ipv6.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 18020987d369..6ac444968292 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -329,13 +329,6 @@ extern int ip6_nd_hdr(struct sock *sk, struct in6_addr *daddr, int proto, int len); -extern int ip6_build_xmit(struct sock *sk, - inet_getfrag_t getfrag, - const void *data, - struct flowi *fl, - unsigned length, - struct ipv6_txoptions *opt, - int hlimit, int flags); extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); extern int ip6_append_data(struct sock *sk, -- cgit v1.2.3 From 951fc9df9558ee5ae01cef7255b1a33078a7653c Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Wed, 31 Dec 2003 20:28:44 -0800 Subject: [NET]: Do type checking in {udp,inet6,raw6,inet}_sk(). --- include/linux/ip.h | 5 ++++- include/linux/ipv6.h | 11 +++++++++-- include/linux/udp.h | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/ip.h b/include/linux/ip.h index 1adc75a76926..ab799b48b485 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -159,7 +159,10 @@ struct inet_sock { struct inet_opt inet; }; -#define inet_sk(__sk) (&((struct inet_sock *)__sk)->inet) +static inline struct inet_opt * inet_sk(const struct sock *__sk) +{ + return &((struct inet_sock *)__sk)->inet; +} #endif diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index da2e64899c95..7f5a5c4280f7 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -270,8 +270,15 @@ struct tcp6_sock { struct ipv6_pinfo inet6; }; -#define inet6_sk(__sk) ((struct raw6_sock *)__sk)->pinet6 -#define raw6_sk(__sk) (&((struct raw6_sock *)__sk)->raw6) +static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) +{ + return ((struct raw6_sock *)__sk)->pinet6; +} + +static inline struct raw6_opt * raw6_sk(const struct sock *__sk) +{ + return &((struct raw6_sock *)__sk)->raw6; +} #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) diff --git a/include/linux/udp.h b/include/linux/udp.h index 492b258c76c8..cecbccdc1835 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -60,7 +60,10 @@ struct udp_sock { struct udp_opt udp; }; -#define udp_sk(__sk) (&((struct udp_sock *)__sk)->udp) +static inline struct udp_opt * udp_sk(const struct sock *__sk) +{ + return &((struct udp_sock *)__sk)->udp; +} #endif -- cgit v1.2.3 From cdd56702d6800194618b7de0545157ed8ca0b229 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 5 Jan 2004 03:54:41 -0800 Subject: [NET]: In dev_kfree_skb_any() use dev_kfree_skb_irq() if irqs_disabled(). With help from Jeff Garzik and others. --- include/linux/netdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b4744f9e42b0..666d89f875f5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -634,7 +634,7 @@ static inline void dev_kfree_skb_irq(struct sk_buff *skb) */ static inline void dev_kfree_skb_any(struct sk_buff *skb) { - if (in_irq()) + if (in_irq() || irqs_disabled()) dev_kfree_skb_irq(skb); else dev_kfree_skb(skb); -- cgit v1.2.3 From ef06b19295898ec6dea4e82effd6e09e31fcb4ac Mon Sep 17 00:00:00 2001 From: Jean Tourrilhes Date: Mon, 5 Jan 2004 04:03:28 -0800 Subject: [IRDA]: Fix locking in the ircomm-shutdown path. --- include/net/irda/ircomm_tty.h | 7 ++++++- net/irda/ircomm/ircomm_tty.c | 39 +++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index dbb43c14934d..b1f19269c026 100644 --- a/include/net/irda/ircomm_tty.h +++ b/include/net/irda/ircomm_tty.h @@ -52,6 +52,11 @@ /* Same for payload size. See qos.c for the smallest max data size */ #define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED) +/* Those are really defined in include/linux/serial.h - Jean II */ +#define ASYNC_B_INITIALIZED 31 /* Serial port was initialized */ +#define ASYNC_B_NORMAL_ACTIVE 29 /* Normal device is active */ +#define ASYNC_B_CLOSING 27 /* Serial port is closing */ + /* * IrCOMM TTY driver state */ @@ -75,7 +80,7 @@ struct ircomm_tty_cb { LOCAL_FLOW flow; /* IrTTP flow status */ int line; - __u32 flags; + volatile unsigned long flags; __u8 dlsap_sel; __u8 slsap_sel; diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index d6e3a3396169..8556878167cb 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -181,15 +181,15 @@ void __exit ircomm_tty_cleanup(void) static int ircomm_tty_startup(struct ircomm_tty_cb *self) { notify_t notify; - int ret; + int ret = -ENODEV; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - /* Already open */ - if (self->flags & ASYNC_INITIALIZED) { + /* Check if already open */ + if (test_and_set_bit(ASYNC_B_INITIALIZED, &self->flags)) { IRDA_DEBUG(2, "%s(), already open so break out!\n", __FUNCTION__ ); return 0; } @@ -213,7 +213,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) self->line); } if (!self->ircomm) - return -ENODEV; + goto err; self->slsap_sel = self->ircomm->slsap_sel; @@ -221,12 +221,13 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) ret = ircomm_tty_attach_cable(self); if (ret < 0) { ERROR("%s(), error attaching cable!\n", __FUNCTION__); - return ret; + goto err; } - self->flags |= ASYNC_INITIALIZED; - return 0; +err: + clear_bit(ASYNC_B_INITIALIZED, &self->flags); + return ret; } /* @@ -299,7 +300,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, current->state = TASK_INTERRUPTIBLE; - if (tty_hung_up_p(filp) || !(self->flags & ASYNC_INITIALIZED)){ + if (tty_hung_up_p(filp) || + !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { retval = (self->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS; break; @@ -310,7 +312,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, * specified, we cannot return before the IrCOMM link is * ready */ - if (!(self->flags & ASYNC_CLOSING) && + if (!test_bit(ASYNC_B_CLOSING, &self->flags) && (do_clocal || (self->settings.dce & IRCOMM_CD)) && self->state == IRCOMM_TTY_READY) { @@ -425,7 +427,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) * If the port is the middle of closing, bail out now */ if (tty_hung_up_p(filp) || - (self->flags & ASYNC_CLOSING)) { + test_bit(ASYNC_B_CLOSING, &self->flags)) { /* Hm, why are we blocking on ASYNC_CLOSING if we * do return -EAGAIN/-ERESTARTSYS below anyway? @@ -435,7 +437,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) * probably better sleep uninterruptible? */ - if (wait_event_interruptible(self->close_wait, !(self->flags&ASYNC_CLOSING))) { + if (wait_event_interruptible(self->close_wait, !test_bit(ASYNC_B_CLOSING, &self->flags))) { WARNING("%s - got signal while blocking on ASYNC_CLOSING!\n", __FUNCTION__); return -ERESTARTSYS; @@ -530,11 +532,13 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) IRDA_DEBUG(0, "%s(), open count > 0\n", __FUNCTION__ ); return; } - self->flags |= ASYNC_CLOSING; + + /* Hum... Should be test_and_set_bit ??? - Jean II */ + set_bit(ASYNC_B_CLOSING, &self->flags); /* We need to unlock here (we were unlocking at the end of this * function), because tty_wait_until_sent() may schedule. - * I don't know if the rest should be locked somehow, + * I don't know if the rest should be protected somehow, * so someone should check. - Jean II */ spin_unlock_irqrestore(&self->spinlock, flags); @@ -978,10 +982,12 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - - if (!(self->flags & ASYNC_INITIALIZED)) + + if (!test_and_clear_bit(ASYNC_B_INITIALIZED, &self->flags)) return; + ircomm_tty_detach_cable(self); + spin_lock_irqsave(&self->spinlock, flags); del_timer(&self->watchdog_timer); @@ -998,13 +1004,10 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) self->tx_skb = NULL; } - ircomm_tty_detach_cable(self); - if (self->ircomm) { ircomm_close(self->ircomm); self->ircomm = NULL; } - self->flags &= ~ASYNC_INITIALIZED; spin_unlock_irqrestore(&self->spinlock, flags); } -- cgit v1.2.3 From 53b78d22d516fa23f50f250cfaf6057f1824c6bc Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 5 Jan 2004 04:33:31 -0800 Subject: [NET]: Un-deprecate skb_linearize(), we can re-deprecate in 2.7.x --- include/linux/skbuff.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 77162e4c2819..b7b96854e23c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1132,7 +1132,7 @@ static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len) * is returned and the old skb data released. */ extern int __skb_linearize(struct sk_buff *skb, int gfp); -static inline int __deprecated skb_linearize(struct sk_buff *skb, int gfp) +static inline int skb_linearize(struct sk_buff *skb, int gfp) { return __skb_linearize(skb, gfp); } -- cgit v1.2.3 From cd4eb2e9407321888234cceabd957d3168c724d9 Mon Sep 17 00:00:00 2001 From: James Morris Date: Tue, 6 Jan 2004 05:42:12 -0800 Subject: [NETFILTER]: Add SELINUX priority values for ipv4/ipv6, approved by Harald Welte. --- include/linux/netfilter_ipv4.h | 2 ++ include/linux/netfilter_ipv6.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 336c47be6837..8744f0c57fb6 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h @@ -51,6 +51,7 @@ enum nf_ip_hook_priorities { NF_IP_PRI_FIRST = INT_MIN, + NF_IP_PRI_SELINUX_FIRST = -225, NF_IP_PRI_CONNTRACK = -200, NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD = -175, NF_IP_PRI_MANGLE = -150, @@ -58,6 +59,7 @@ enum nf_ip_hook_priorities { NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, NF_IP_PRI_FILTER = 0, NF_IP_PRI_NAT_SRC = 100, + NF_IP_PRI_SELINUX_LAST = 225, NF_IP_PRI_LAST = INT_MAX, }; diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index f6da04e49207..ad7d8a4e0d55 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h @@ -56,11 +56,13 @@ enum nf_ip6_hook_priorities { NF_IP6_PRI_FIRST = INT_MIN, + NF_IP6_PRI_SELINUX_FIRST = -225, NF_IP6_PRI_CONNTRACK = -200, NF_IP6_PRI_MANGLE = -150, NF_IP6_PRI_NAT_DST = -100, NF_IP6_PRI_FILTER = 0, NF_IP6_PRI_NAT_SRC = 100, + NF_IP6_PRI_SELINUX_LAST = 225, NF_IP6_PRI_LAST = INT_MAX, }; -- cgit v1.2.3