All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Kutkov <elenbert@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Notifier chains bug ?
Date: Tue, 02 Mar 2010 02:08:16 +0200	[thread overview]
Message-ID: <4B8C56F0.5090700@gmail.com> (raw)

Hello.
I try to used notifier chains for monitoring network devices events.
All works perfectly when just i'm connecting/disconnecting network cable 
or up/down interface via ifconfig.
But when i try to change interface address - nothing happens. Notifier 
is don't send any events :(
There is many events in notifier.h:

#define NETDEV_UP                                        0x0001   
#define NETDEV_DOWN                                 0x0002
#define NETDEV_REBOOT                              0x0003   
#define NETDEV_CHANGE                             0x0004 
#define NETDEV_REGISTER                          0x0005
#define NETDEV_UNREGISTER                    0x0006
#define NETDEV_CHANGEMTU                    0x0007
#define NETDEV_CHANGEADDR                  0x0008
#define NETDEV_GOING_DOWN                  0x0009
#define NETDEV_CHANGENAME                 0x000A
#define NETDEV_FEAT_CHANGE                 0x000B
#define NETDEV_BONDING_FAILOVER      0x000C
#define NETDEV_PRE_UP                               0x000D
#define NETDEV_BONDING_OLDTYPE        0x000E
#define NETDEV_BONDING_NEWTYPE       0x000F

So i receive only NETDEV_UP  and NETDEV_DOWN events.

Part of my code:

//event handler
static int ifEventListener(struct notifier_block *nb, unsigned long 
event, void *ptr);

//set handler
struct notifier_block nbListener =
{
    .notifier_call = ifEventListener
};

//event handler
static int ifEventListener(struct notifier_block *this, unsigned long 
event, void *ptr)
{
    struct net_device *dev = (struct net_device *) ptr;

    printk(KERN_INFO "eventListener() -- %d event from net_device '%s' 
(0x%08X)\n", event, dev->name, (unsigned) dev);
 
    return 0;
}

//register handler
register_netdevice_notifier(&nbListener);



So, this is a bug in notifier or something wrong with my code ?
Thank for any help

-- 
Best regards, 
Oleg


             reply	other threads:[~2010-03-02  0:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02  0:08 Oleg Kutkov [this message]
2010-03-02  3:24 ` Notifier chains bug ? Américo Wang
2010-03-02  5:50   ` Oleg Kutkov
2010-03-02 15:42     ` Américo Wang
2010-03-02 15:57       ` Atis Elsts
     [not found]       ` <7f9bf5711003020755p653a0b8cq707e9b1e12b44c98@mail.gmail.com>
2010-03-04 10:08         ` Américo Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B8C56F0.5090700@gmail.com \
    --to=elenbert@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.