root/net/ipv4/ip_alias.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ip_alias_init_1
  2. ip_alias_done_1
  3. ip_alias_print_1
  4. ip_alias_init
  5. ip_alias_done
  6. init_module
  7. cleanup_module

   1 #include <linux/module.h>
   2 
   3 #include <linux/types.h>
   4 #include <linux/errno.h>
   5 #include <linux/netdevice.h>
   6 #include <linux/if.h>
   7 #include <linux/inet.h>
   8 
   9 #ifdef ALIAS_USER_LAND_DEBUG
  10 #include "net_alias.h"
  11 #include "ip_alias.h"
  12 #include "user_stubs.h"
  13 #endif
  14 
  15 #include <linux/net_alias.h>
  16 #include <net/ip_alias.h>
  17 
  18 /*
  19  * AF_INET alias init
  20  */
  21 static int 
  22 ip_alias_init_1(struct net_alias *alias, struct sockaddr *sa)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24 #ifdef ALIAS_USER_LAND_DEBUG
  25   printk("alias_init(%s) called.\n", alias->name);
  26 #endif
  27   MOD_INC_USE_COUNT;
  28   return 0;
  29 }
  30 
  31 /*
  32  * AF_INET alias done
  33  */
  34 static int
  35 ip_alias_done_1(struct net_alias *alias)
     /* [previous][next][first][last][top][bottom][index][help] */
  36 {
  37 #ifdef ALIAS_USER_LAND_DEBUG
  38   printk("alias_done(%s) called.\n", alias->name);
  39 #endif
  40   MOD_DEC_USE_COUNT;
  41   return 0;
  42 }
  43 
  44 /*
  45  * print address info
  46  */
  47 
  48 int
  49 ip_alias_print_1(char *buf, int len, struct net_alias *alias)
     /* [previous][next][first][last][top][bottom][index][help] */
  50 {
  51   char *p;
  52 
  53   p = (char *) &alias->dev.pa_addr;
  54   return sprintf(buf, "%d.%d.%d.%d",
  55                  (p[0] & 255), (p[1] & 255), (p[2] & 255), (p[3] & 255));
  56 }
  57 
  58 /*
  59  * net_alias AF_INET type defn.
  60  */
  61 
  62 struct net_alias_type ip_alias_type =
  63 {
  64   AF_INET,                      /* type */
  65   0,                            /* n_attach */
  66   "ip",                         /* name */
  67   NULL,                         /* get_addr32() */
  68   NULL,                         /* addr_chk() */
  69   ip_alias_init_1,              /* alias_init_1() */
  70   ip_alias_done_1,              /* alias_done_1() */
  71   ip_alias_print_1,             /* alias_print_1() */
  72   NULL                          /* next */
  73 };
  74 
  75 /*
  76  * ip_alias module initialization
  77  */
  78 
  79 int ip_alias_init(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  80 {
  81   return register_net_alias_type(&ip_alias_type, AF_INET);
  82 }
  83 
  84 /*
  85  * ip_alias module done
  86  */
  87 
  88 int ip_alias_done(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  89 {
  90   return unregister_net_alias_type(&ip_alias_type);
  91 }
  92 
  93 #ifdef MODULE
  94 
  95 int init_module(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  96 {
  97   if (ip_alias_init() != 0)
  98     return -EIO;
  99   return 0;
 100 }
 101 
 102 void cleanup_module(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 103 {
 104   if (ip_alias_done() != 0)
 105     printk("ip_alias: can't remove module");
 106 }
 107 
 108 #endif /* MODULE */

/* [previous][next][first][last][top][bottom][index][help] */