Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys



Module Name:    src
Committed By:   ozaki-r
Date:           Fri Jul 17 02:21:08 UTC 2015

Modified Files:
        src/sys/net: if.c route.c route.h rtsock.c
        src/sys/netinet: if_atm.c ip_output.c
        src/sys/netinet6: icmp6.c nd6.c nd6.h nd6_nbr.c nd6_rtr.c

Log Message:
Reform use of rt_refcnt

rt_refcnt of rtentry was used in bad manners, for example, direct rt_refcnt++
and rt_refcnt-- outside route.c, "rt->rt_refcnt++; rtfree(rt);" idiom, and
touching rt after rt->rt_refcnt--.

These abuses seem to be needed because rt_refcnt manages only references
between rtentry and doesn't take care of references during packet processing
(IOW references from local variables). In order to reduce the above abuses,
the latter cases should be counted by rt_refcnt as well as the former cases.

This change improves consistency of use of rt_refcnt:
- rtentry is always accessed with rt_refcnt incremented
- rtentry's rt_refcnt is decremented after use (rtfree is always used instead
  of rt_refcnt--)
- functions returning rtentry increment its rt_refcnt (and caller rtfree it)

Note that rt_refcnt prevents rtentry from being freed but doesn't prevent
rtentry from being updated. Toward MP-safe, we need to provide another
protection for rtentry, e.g., locks. (Or introduce a better data structure
allowing concurrent readers during updates.)


To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/sys/net/if.c
cvs rdiff -u -r1.145 -r1.146 src/sys/net/route.c
cvs rdiff -u -r1.91 -r1.92 src/sys/net/route.h
cvs rdiff -u -r1.171 -r1.172 src/sys/net/rtsock.c
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/if_atm.c
cvs rdiff -u -r1.243 -r1.244 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.170 -r1.171 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.164 -r1.165 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.65 -r1.66 src/sys/netinet6/nd6.h
cvs rdiff -u -r1.108 -r1.109 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.100 -r1.101 src/sys/netinet6/nd6_rtr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index