DragonFly-2.1.1.143.g5bd44 master sbin/ifconfig ifcarp.c sys/net if_var.h sys/net/pf pf_if.c sys/netinet if_ether.c if_ether.h in.c in_var.h ip_carp.c ip_carp.h sys/netinet6 in6.c

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Fri Dec 26 04:53:23 PST 2008


commit 5bd4422ea3a838c306436350229ff4bc24397660
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Fri Dec 26 19:14:19 2008 +0800

    Rework carp(4) IPv4 support.
    
    Generic layer changes:
    - Pass more detailed information to ifaddr_event handler.
      o  The ifaddr which triggers the event is passed in
      o  The action (add/delete/change) performed upon the ifaddr is
         passed in
    - Add ifa_prflags field in ifaddr_container.  This field should
      be used to hold protocol specific flags.  For inet addresses,
      IA_PRF_RTEXISTOK is defined to ignore rtinit() EEXIST error in
      in_ifinit().
    
    carp(4) changes:
    - Add virtual address struct, which holds corresponding carp(4)
      inet address and backing address of a "real" interface (backing
      interface).
    - The list holding virtual address struct is sorted.  This is
      mainly used to fix the bug in following case:
        host1:
        ifconfig carp0 192.168.5.1
        ifconfig carp0 alias 192.168.5.2
        host2:
        ifconfig carp0 192.168.5.2
        ifconfig carp0 alias 192.168.5.1
      Before this change, the inet addresses sha1 calculated for these
      two host will be different, thus CARP fails.
      Based-on: OpenBSD
    - Allow inet addresses to be added to carp(4) interface, even if
      no backing interface could be found or the backing interface is
      not running.
    - Don't abuse IFF_UP, which is administrative flag; use IFF_RUNNING
      instead.
    - Factor out carp_stop().
    - Handle ifaddr_event; most of the carp(4) inet address configuration
      happens in this event handler.  In carp_ioctl(), we just mark the
      carp(4) interface IFF_UP|IFF_RUNNING and set IA_PRF_RTEXISTOK on
      the inet address.
    - Fix the ifdetach_event handler:
      o  Don't sit on the branch while we are sawing it off.
      o  We always need to leave the joined multicast group.
    - Free carp_if to the proper kmalloc pool.
    - Simplify the carp_if struct; except the TAILQ_HEAD, rest of the
      fields are not used; nuke them.
    - Use 'void *' as ifnet.if_carp's type.  This could ease upcoming
      carp(4) MPSAFE work.
    - M_NOWAIT -> MB_DONTWAIT
    - Throw in assertions
    - Cleanup:
      o  Nuke SC2IFP
      o  Nuke carp_softc.sc_ifp compat shim
      o  Constify function parameters
      o  ...

Summary of changes:
 sbin/ifconfig/ifcarp.c |   82 +++-
 sys/net/if_var.h       |   27 +-
 sys/net/pf/pf_if.c     |    8 +-
 sys/netinet/if_ether.c |   62 ++--
 sys/netinet/if_ether.h |    2 +-
 sys/netinet/in.c       |   27 +-
 sys/netinet/in_var.h   |    3 +
 sys/netinet/ip_carp.c  | 1360 ++++++++++++++++++++++++++++++++----------------
 sys/netinet/ip_carp.h  |   22 +-
 sys/netinet6/in6.c     |   19 +-
 10 files changed, 1101 insertions(+), 511 deletions(-)

http://gitweb.dragonflybsd.org/?p=dragonfly.git;a=commitdiff;h=5bd4422ea3a838c306436350229ff4bc24397660


-- 
DragonFly BSD source repository





More information about the Commits mailing list