Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> writes:

> > +static inline struct raw_sock *raw_sk(const struct sock *sk)
> > +{
> > +   return (struct raw_sock *)sk;
> > +}
> 
> 
> What if I want to do some kernel module that uses INET raw sockets
> (include/net/icmp.h) and CAN raw sockets? Namespace collision, could you
> please use can_raw_ for this namespace?

raw_sk is static so you can't use in another file where you include
include/net/icmp.h.  There is no collision.  Also, since it's inline
you won't even see it in a symbol table.

Hm, it's more than 10 years that I've tested ctags(1) and etags(1)
with several identical static names in different files and I don't
remember my results.  Do these tools have a problem with multiple
defs?  I think they shouldn't since C is explicitly designed for that.

> > +static unsigned int raw_poll(struct file *file, struct socket *sock,
> > +                        poll_table *wait)
> > +{
> > +   unsigned int mask = 0;
> > +
> > +   DBG("socket %p\n", sock);
> > +
> > +   mask = datagram_poll(file, sock, wait);
> > +   return mask;
> 
> What is the value of 'mask' here? Leftover from debugging?

Ah, yes.  We should remove it.

> > +static int raw_setsockopt(struct socket *sock, int level, int optname,
> > +                     char __user *optval, int optlen)
> > +{

> > +           lock_sock(sk);
> > +
> > +           if (ro->bound && ro->ifindex)
> > +                   dev = dev_get_by_index(&init_net, ro->ifindex);
> 
> dev_get_by_index can fail, are you sure that raw_enable_filters can cope
> with this possibility?

When ro->ifindex != 0, the call to dev_get_by_index() shouldn't fail.
We also use lock_sock() here and in NETDEV_UNREGISTER, so there should
be no problem.


urs
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to