svn commit: r359512 - in head: contrib/bsnmp/lib contrib/bsnmp/snmp_mibII contrib/bsnmp/snmp_usm contrib/bsnmp/snmp_vacm contrib/bsnmp/snmpd contrib/bsnmp/tests lib/libbsnmp/libbsnmp
, the port number and the community strings with +reasonable default values when they are not specified. +The default transport +is +.Dv SNMP_TRANS_UDP . +If the host name contains a slash the default is modified to +.Dv SNMP_TRANS_LOC_DGRAM . +If the host name looks like a numeric IPv6 address the default is +.Dv SNMP_TRANS_UDP6 . +For numeric IPv6 addresses the transport name udp is automatically +translated as +.Dv SNMP_TRANS_UDP6 . +The default port number (for +.Dv udp +or +.Dv udp6 ) +is +.Qq snmp . +The default read community is +.Qq public +and the default write community +.Qq private . +.Pp +.Fn snmp_parse_server +recognizes path names, host names and numerical IPv4 and IPv6 addresses. +A string consisting of digits and periods is assumed to be an IPv4 address +and must be parseable by +.Fn inet_aton 3 . +An IPv6 address is any string enclosed in square brackets. +It must be parseable with +.Fn gethostinfo 3 . +.Pp +The port number for +.Fn snmp_parse_server +can be specified numerically or symbolically. +It is ignored for local sockets. .Sh DIAGNOSTICS -If an error occurs in any of the function an error indication as described +If an error occurs in any of the functions an error indication as described above is returned. -Additionally the function sets a printable error string -in the +Additionally the function sets a printable error string in the .Va error -filed of +field of .Va snmp_client . .Sh SEE ALSO .Xr gensnmptree 1 , Modified: head/contrib/bsnmp/lib/snmpclient.c == --- head/contrib/bsnmp/lib/snmpclient.c Wed Apr 1 15:12:51 2020 (r359511) +++ head/contrib/bsnmp/lib/snmpclient.c Wed Apr 1 15:25:16 2020 (r359512) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2005,2018 + * Copyright (c) 2004-2005,2018-2019 * Hartmut Brandt. * All rights reserved. * Copyright (c) 2001-2003 @@ -930,7 +930,7 @@ open_client_udp(const char *host, const char *port) /* open connection */ memset(, 0, sizeof(hints)); hints.ai_flags = AI_CANONNAME; - hints.ai_family = snmp_client.trans == SNMP_TRANS_UDP ? AF_INET: + hints.ai_family = snmp_client.trans == SNMP_TRANS_UDP ? AF_INET : AF_INET6; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; @@ -1884,7 +1884,8 @@ static const char *const trans_list[] = { /** * Try to get a transport identifier which is a leading alphanumeric string * terminated by a double colon. The string may not be empty. The transport - * identifier is optional. + * identifier is optional. Unknown transport identifiers are reject. + * Be careful: a double colon can also occur in a numeric IPv6 address. * * \param sc client struct to set errors * \param strp possible start of transport; updated to point to @@ -1899,8 +1900,6 @@ get_transp(struct snmp_client *sc, const char **strp) size_t i; for (i = 0; i < nitems(trans_list); i++) { - if (trans_list[i] == NULL || *trans_list[i] == '\0') - continue; p = strstr(*strp, trans_list[i]); if (p == *strp) { *strp += strlen(trans_list[i]); @@ -1908,13 +1907,23 @@ get_transp(struct snmp_client *sc, const char **strp) } } - p = *strp; - if (p[0] == ':' && p[1] == ':') { + p = strstr(*strp, "::"); + if (p == *strp) { seterr(sc, "empty transport specifier"); return (-1); } - /* by default assume UDP */ - return (SNMP_TRANS_UDP); + if (p == NULL) + /* by default assume UDP */ + return (SNMP_TRANS_UDP); + + /* ignore :: after [ */ + const char *ob = strchr(*strp, '['); + if (ob != NULL && p > ob) + /* by default assume UDP */ + return (SNMP_TRANS_UDP); + + seterr(sc, "unknown transport specifier '%.*s'", p - *strp, *strp); + return (-1); } /** @@ -2153,12 +2162,14 @@ int snmp_parse_server(struct snmp_client *sc, const char *str) { const char *const orig = str; + /* parse input */ - int i, trans = get_transp(sc, ); + int def_trans = 0, trans = get_transp(sc, ); if (trans < 0) return (-1); /* choose automatically */ - i = orig == str ? -1: trans; + if (orig == str) + def_trans = 1; const char *const comm[2] = { str, @@ -2204,7 +2215,7 @@ snmp_parse_server(struct snmp_client *sc, const char * } #if DEBUG_PARSE - printf("transp: %u\n", trans); + printf("transp: %d (def=%d)\n", trans, def_trans); printf("comm: %zu %zu\n", comm[0] - orig, comm[1] - orig); printf("ipv6: %zu %zu\n", ipv6[0] - orig, ipv6[1] - orig); printf(&q
svn commit: r359514 - head/tools/test/bsnmp
Author: harti Date: Wed Apr 1 15:39:02 2020 New Revision: 359514 URL: https://svnweb.freebsd.org/changeset/base/359514 Log: Add a makefile to build and run the tests for the bsnmp library. This is not automatically built or run but must explicitly be built with 'make' and run with 'make run'. Added: head/tools/test/bsnmp/ head/tools/test/bsnmp/Makefile (contents, props changed) Added: head/tools/test/bsnmp/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/test/bsnmp/Makefile Wed Apr 1 15:39:02 2020 (r359514) @@ -0,0 +1,19 @@ +# $FreeBSD$ + +CONTRIB=${SRCTOP}/contrib/bsnmp +.PATH: ${CONTRIB}/tests + +PROG_CXX=ctest +SRCS= main.cc asn1.cc snmp_parse_server.cc +CFLAGS += -I/${CONTRIB}/lib +CXXFLAGS+= -std=c++2a +LIBADD= bsnmp + +CFLAGS += -DBOGUS_CVE_2019_5610_FIX +MK_MAN= no + +.include + + +run: + ${.OBJDIR}/ctest ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335885 - in head: contrib/bsnmp contrib/bsnmp/gensnmptree contrib/bsnmp/lib contrib/bsnmp/snmp_mibII contrib/bsnmp/snmp_ntp contrib/bsnmp/snmp_target contrib/bsnmp/snmp_usm contrib/bsn...
Author: harti Date: Tue Jul 3 08:44:40 2018 New Revision: 335885 URL: https://svnweb.freebsd.org/changeset/base/335885 Log: Update bsnmp to version 1.13. This does not bring user-visible changes. For developers gensnmptree can now generate functions for enums to convert between enums and strings and to check the validity of a value. The sources in FreeBSD are now in sync with the upstream which allows to bring in IPv6 modifications. Modified: head/contrib/bsnmp/VERSION head/contrib/bsnmp/gensnmptree/gensnmptree.1 head/contrib/bsnmp/gensnmptree/gensnmptree.c head/contrib/bsnmp/lib/snmp.h head/contrib/bsnmp/lib/tc.def head/contrib/bsnmp/snmp_mibII/mibII.c head/contrib/bsnmp/snmp_mibII/mibII_route.c head/contrib/bsnmp/snmp_ntp/snmp_ntp.c head/contrib/bsnmp/snmp_target/target_snmp.c head/contrib/bsnmp/snmp_target/target_tree.def head/contrib/bsnmp/snmp_usm/usm_snmp.c head/contrib/bsnmp/snmp_usm/usm_tree.def head/contrib/bsnmp/snmp_vacm/vacm_snmp.c head/contrib/bsnmp/snmp_vacm/vacm_tree.def head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/trans_udp.c head/contrib/bsnmp/snmpd/trap.c head/contrib/bsnmp/snmpd/tree.def head/contrib/libbegemot/rpoll.c head/contrib/libbegemot/rpoll.h head/lib/libbsnmp/libbsnmp/Makefile head/share/mk/bsd.snmpmod.mk head/usr.sbin/bsnmpd/bsnmpd/Makefile head/usr.sbin/bsnmpd/modules/snmp_bridge/Makefile head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_addrs.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_pf.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.c head/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c head/usr.sbin/bsnmpd/modules/snmp_hast/Makefile head/usr.sbin/bsnmpd/modules/snmp_pf/Makefile head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c head/usr.sbin/bsnmpd/modules/snmp_target/Makefile head/usr.sbin/bsnmpd/modules/snmp_usm/Makefile head/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile head/usr.sbin/bsnmpd/modules/snmp_wlan/Makefile head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.c head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c Modified: head/contrib/bsnmp/VERSION == --- head/contrib/bsnmp/VERSION Tue Jul 3 05:56:23 2018(r335884) +++ head/contrib/bsnmp/VERSION Tue Jul 3 08:44:40 2018(r335885) @@ -1 +1 @@ -1.12 +1.13 Modified: head/contrib/bsnmp/gensnmptree/gensnmptree.1 == --- head/contrib/bsnmp/gensnmptree/gensnmptree.1Tue Jul 3 05:56:23 2018(r335884) +++ head/contrib/bsnmp/gensnmptree/gensnmptree.1Tue Jul 3 08:44:40 2018(r335885) @@ -2,7 +2,7 @@ .\" Copyright (c) 2001-2005 .\"Fraunhofer Institute for Open Communication Systems (FhG Fokus). .\"All rights reserved. -.\" Copyright (c) 2006 +.\" Copyright (c) 2006,2018 .\"Hartmut Brandt .\"All rights reserved. .\" @@ -31,7 +31,7 @@ .\" .\" $Begemot: gensnmptree.1 383 2006-05-30 07:40:49Z brandt_h $ .\" -.Dd May 26, 2006 +.Dd June 29, 2018 .Dt GENSNMPTREE 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd "generate C and header files from a MIB description file" .Sh SYNOPSIS .Nm -.Op Fl dEehlt +.Op Fl dEeFfhlt .Op Fl I Ar directory .Op Fl i Ar infile .Op Fl p Ar prefix @@ -99,6 +99,26 @@ is the length of the OID. .It Va OID_ Ns Ar name is the last component of the OID. .El +.It Fl F +Together with +.Fl E +causes +.Nm +instead of the generation of enum definitions the generation of +functions for checking a value to be one of the enumeration variants and +for conversion between strings and the enum. The file is sent to standard +output and is meant to be included into a C-file for compilation. +.It Fl f +This flag can be used together with +.Fl E +or when generating the tree files. It causes +.Nm +to emit static inline functions for checking a value to be one of the +enumeration values and for conversion between strings and the enum. +If used when generating the tree files, the preprocessor symbol +.Ar SNMPTREE_TYPES +must be defined when including the tree header file for these definitions +to become visible. .It Fl h Print a short help page. .It Fl I Ar directory @@ -116,6 +136,36 @@ Instead of normal output print the resulting tree. Prefix the file names and the table name with .Ar prefix . .El +.Pp +The following functions are generated by +.Fl f +or +.Fl F : +.Pp +.Ft static inline int +.Fn isok_EnumName "enum EnumName" ; +.Pp +.Ft static inline const char * +.Fn tostr_EnumName "enum EnumName" ; +.Pp +.Ft static inline int +.Fn fromstr_EnumName "const char *" "enum EnumName *" ; +.Pp +The +.Fa EnumName +is replaced with the enumeration name. +.Fn isok_EnumName +returns
svn commit: r313043 - head/sys/kern
Author: harti Date: Wed Feb 1 13:12:07 2017 New Revision: 313043 URL: https://svnweb.freebsd.org/changeset/base/313043 Log: Merge filt_soread and filt_solisten and decide what to do when checking for EVFILT_READ at the point of the check not when the event is registers. This fixes a problem with asio when accepting a connection. Reviewed by: kib@, Scott Mitchell Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Wed Feb 1 08:46:59 2017(r313042) +++ head/sys/kern/uipc_socket.c Wed Feb 1 13:12:07 2017(r313043) @@ -159,16 +159,10 @@ static void filt_sordetach(struct knote static int filt_soread(struct knote *kn, long hint); static voidfilt_sowdetach(struct knote *kn); static int filt_sowrite(struct knote *kn, long hint); -static int filt_solisten(struct knote *kn, long hint); static int inline hhook_run_socket(struct socket *so, void *hctx, int32_t h_id); static int filt_soempty(struct knote *kn, long hint); fo_kqfilter_t soo_kqfilter; -static struct filterops solisten_filtops = { - .f_isfd = 1, - .f_detach = filt_sordetach, - .f_event = filt_solisten, -}; static struct filterops soread_filtops = { .f_isfd = 1, .f_detach = filt_sordetach, @@ -3107,10 +3101,7 @@ soo_kqfilter(struct file *fp, struct kno switch (kn->kn_filter) { case EVFILT_READ: - if (so->so_options & SO_ACCEPTCONN) - kn->kn_fop = _filtops; - else - kn->kn_fop = _filtops; + kn->kn_fop = _filtops; sb = >so_rcv; break; case EVFILT_WRITE: @@ -3321,6 +3312,11 @@ filt_soread(struct knote *kn, long hint) struct socket *so; so = kn->kn_fp->f_data; + if (so->so_options & SO_ACCEPTCONN) { + kn->kn_data = so->so_qlen; + return (!TAILQ_EMPTY(>so_comp)); + + } SOCKBUF_LOCK_ASSERT(>so_rcv); kn->kn_data = sbavail(>so_rcv) - so->so_rcv.sb_ctl; @@ -,11 +3329,9 @@ filt_soread(struct knote *kn, long hint) if (kn->kn_sfflags & NOTE_LOWAT) { if (kn->kn_data >= kn->kn_sdata) - return 1; - } else { - if (sbavail(>so_rcv) >= so->so_rcv.sb_lowat) - return 1; - } + return (1); + } else if (sbavail(>so_rcv) >= so->so_rcv.sb_lowat) + return (1); /* This hook returning non-zero indicates an event, not error */ return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); @@ -3397,16 +3391,6 @@ filt_soempty(struct knote *kn, long hint return (0); } -/*ARGSUSED*/ -static int -filt_solisten(struct knote *kn, long hint) -{ - struct socket *so = kn->kn_fp->f_data; - - kn->kn_data = so->so_qlen; - return (!TAILQ_EMPTY(>so_comp)); -} - int socheckuid(struct socket *so, uid_t uid) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r294507 - head/contrib/bsnmp/snmp_mibII
Author: harti Date: Thu Jan 21 16:11:20 2016 New Revision: 294507 URL: https://svnweb.freebsd.org/changeset/base/294507 Log: Fill the ifAlias leaf of the ifXTable with the interface description if there is one available and it fits into the maximum size (64 characters). Modified: head/contrib/bsnmp/snmp_mibII/mibII.c head/contrib/bsnmp/snmp_mibII/mibII.h head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c == --- head/contrib/bsnmp/snmp_mibII/mibII.c Thu Jan 21 15:27:44 2016 (r294506) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Thu Jan 21 16:11:20 2016 (r294507) @@ -443,6 +443,7 @@ mib_fetch_ifmib(struct mibif *ifp) size_t len; void *newmib; struct ifmibdata oldmib = ifp->mib; + struct ifreq irr; if (fetch_generic_mib(ifp, ) == -1) return (-1); @@ -514,6 +515,18 @@ mib_fetch_ifmib(struct mibif *ifp) } out: + strncpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name)); + irr.ifr_buffer.buffer = MIBIF_PRIV(ifp)->alias; + irr.ifr_buffer.length = sizeof(MIBIF_PRIV(ifp)->alias); + if (ioctl(mib_netsock, SIOCGIFDESCR, ) == -1) { + MIBIF_PRIV(ifp)->alias[0] = 0; + if (errno != ENOMSG) + syslog(LOG_WARNING, "SIOCGIFDESCR (%s): %m", ifp->name); + } else if (irr.ifr_buffer.buffer == NULL) { + MIBIF_PRIV(ifp)->alias[0] = 0; + syslog(LOG_WARNING, "SIOCGIFDESCR (%s): too long (%zu)", + ifp->name, irr.ifr_buffer.length); + } ifp->mibtick = get_ticks(); return (0); } Modified: head/contrib/bsnmp/snmp_mibII/mibII.h == --- head/contrib/bsnmp/snmp_mibII/mibII.h Thu Jan 21 15:27:44 2016 (r294506) +++ head/contrib/bsnmp/snmp_mibII/mibII.h Thu Jan 21 16:11:20 2016 (r294507) @@ -57,6 +57,9 @@ #include "snmp_mibII.h" #include "mibII_tree.h" +/* maximum size of the interface alias */ +static const u_int MIBIF_ALIAS_SIZE = 64 + 1; + /* * Interface list and flags. */ @@ -77,6 +80,9 @@ struct mibif_private { uint64_thc_opackets; uint64_thc_imcasts; uint64_thc_ipackets; + + /* this should be made public */ + charalias[MIBIF_ALIAS_SIZE]; }; #defineMIBIF_PRIV(IFP) ((struct mibif_private *)((IFP)->private)) Modified: head/contrib/bsnmp/snmp_mibII/mibII_interfaces.c == --- head/contrib/bsnmp/snmp_mibII/mibII_interfaces.cThu Jan 21 15:27:44 2016(r294506) +++ head/contrib/bsnmp/snmp_mibII/mibII_interfaces.cThu Jan 21 16:11:20 2016(r294507) @@ -528,7 +528,7 @@ op_ifxtable(struct snmp_context *ctx, st break; case LEAF_ifAlias: - ret = string_get(value, "", -1); + ret = string_get(value, MIBIF_PRIV(ifp)->alias, -1); break; case LEAF_ifCounterDiscontinuityTime: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r260986 - head/contrib/bsnmp/lib
Author: harti Date: Tue Jan 21 16:49:54 2014 New Revision: 260986 URL: http://svnweb.freebsd.org/changeset/base/260986 Log: Fix a problem with OBJECT IDENTIFIER encoding: need to check the second subid to be less than 40, not the first when the first subid is 0 or 1. Modified: head/contrib/bsnmp/lib/asn1.c Modified: head/contrib/bsnmp/lib/asn1.c == --- head/contrib/bsnmp/lib/asn1.c Tue Jan 21 16:02:31 2014 (r260985) +++ head/contrib/bsnmp/lib/asn1.c Tue Jan 21 16:49:54 2014 (r260986) @@ -652,7 +652,7 @@ asn_put_objid(struct asn_buf *b, const s err = ASN_ERR_RANGE; } if (oid-subs[0] 2 || - (oid-subs[0] 2 oid-subs[0] = 40)) { + (oid-subs[0] 2 oid-subs[1] = 40)) { asn_error(NULL, oid out of range (%u,%u), oid-subs[0], oid-subs[1]); err = ASN_ERR_RANGE; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r235777 - head/sys/kern
Author: harti Date: Tue May 22 07:23:41 2012 New Revision: 235777 URL: http://svn.freebsd.org/changeset/base/235777 Log: Make dumptid non-static. It is used by libkvm to detect whether this is a VNET-kernel or not. gcc used to put the static symbol into the symbol table, clang does not. This fixes the 'netstat: no namelist' error seen on clang+VNET systems. Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c == --- head/sys/kern/kern_shutdown.c Tue May 22 07:04:23 2012 (r235776) +++ head/sys/kern/kern_shutdown.c Tue May 22 07:23:41 2012 (r235777) @@ -151,7 +151,7 @@ static struct dumperinfo dumper;/* our /* Context information for dump-debuggers. */ static struct pcb dumppcb; /* Registers. */ -static lwpid_t dumptid;/* Thread ID. */ +lwpid_t dumptid; /* Thread ID. */ static void poweroff_wait(void *, int); static void shutdown_halt(void *junk, int howto); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r235780 - head/include
Author: harti Date: Tue May 22 09:59:49 2012 New Revision: 235780 URL: http://svn.freebsd.org/changeset/base/235780 Log: Fix a compilation error with some compilers: __attribute__ requires two parenthesis for its argument, but instead of using __attribute__ directly, use the appropriate __nonnull macro from cdefs.h. Modified: head/include/malloc_np.h Modified: head/include/malloc_np.h == --- head/include/malloc_np.hTue May 22 09:27:57 2012(r235779) +++ head/include/malloc_np.hTue May 22 09:59:49 2012(r235780) @@ -55,13 +55,11 @@ int mallctlbymib(const size_t *mib, size #defineALLOCM_ERR_OOM 1 #defineALLOCM_ERR_NOT_MOVED2 -intallocm(void **ptr, size_t *rsize, size_t size, int flags) -__attribute__(nonnull(1)); +intallocm(void **ptr, size_t *rsize, size_t size, int flags) __nonnull(1); intrallocm(void **ptr, size_t *rsize, size_t size, size_t extra, -int flags) __attribute__(nonnull(1)); -intsallocm(const void *ptr, size_t *rsize, int flags) -__attribute__(nonnull(1)); -intdallocm(void *ptr, int flags) __attribute__(nonnull(1)); +int flags) __nonnull(1); +intsallocm(const void *ptr, size_t *rsize, int flags) __nonnull(1); +intdallocm(void *ptr, int flags) __nonnull(1); intnallocm(size_t *rsize, size_t size, int flags); __END_DECLS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r235777 - head/sys/kern
On Tue, 22 May 2012, Bruce Evans wrote: BEOn Tue, 22 May 2012, Hartmut Brandt wrote: BE BE Log: BE Make dumptid non-static. It is used by libkvm to detect whether BE this is a VNET-kernel or not. gcc used to put the static symbol into BE the symbol table, clang does not. This fixes the 'netstat: no namelist' BE error seen on clang+VNET systems. BE BE Modified: BE head/sys/kern/kern_shutdown.c BE BEThat would be a bug in clang if it were done for static symbols generally, BEbut here the bug seems to be that the symbol is not declared as __used. I don't get this. Why should a symbol declared static be in the symbol table (except for debugging purposes) ? It has internal linkage and so has a meaning only in the given file. What is the linker supposed to do with several static symbols with the same name from several object files? If several files declared static dumptids, which one would kldsym be supposed to return? harti BE BEgcc does the same for a file containing only static int x;, but it BEis apparently confused by dumptid being initialized non-statically, BEalthough the initialization has no side effects. If dumptid were a BElocal variable, then clang would probably warn about the variable being BEunused, but gcc-4.2.1 never detects such unused variables (thus code BEthat compiles with gcc -Wunused -Werror often fails with clang). Here BEthe initialization is to curthread-td_tid, so it isn't clear if the BEcompiler can tell if it has no side effects. curthread() is actually BE__curthread(). __curthread() is now declared as __pure2, but that BEnever worked for me with older compilers (its result wasn't cached). BEIf the compilers can tell that the expression has no side effects, BEthen it is another bug that they don't warn about it having no effect BEwhen it is only assigned to the apparently-unused variable dumptid. BE BE Modified: head/sys/kern/kern_shutdown.c BE == BE --- head/sys/kern/kern_shutdown.c Tue May 22 07:04:23 2012 BE (r235776) BE +++ head/sys/kern/kern_shutdown.c Tue May 22 07:23:41 2012 BE (r235777) BE @@ -151,7 +151,7 @@ static struct dumperinfo dumper; /* our BE BE /* Context information for dump-debuggers. */ BE static struct pcb dumppcb; /* Registers. */ BE -static lwpid_t dumptid; /* Thread ID. */ BE +lwpid_t dumptid; /* Thread ID. */ BE BE static void poweroff_wait(void *, int); BE static void shutdown_halt(void *junk, int howto); BE BENow there are 3 bugs instead of 1: BE- the variable is declared (implicit) extern instead of static BE- the extern declaration is in a section for static declaration BE- the variable is still not declared as __used. If the compiler did BE a more extensive usage analysis, that looked at all object files but BE not at the libkvm API, then it should remove this variable anyway BE when it is not declared as __used. BE BEBruce BE BE ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r233128 - head/contrib/bsnmp/snmpd
Author: harti Date: Sun Mar 18 19:28:52 2012 New Revision: 233128 URL: http://svn.freebsd.org/changeset/base/233128 Log: memset() wants the size of the structure to clear, not the size of the pointer to it. Submitted by: Pawel Worach Modified: head/contrib/bsnmp/snmpd/main.c Modified: head/contrib/bsnmp/snmpd/main.c == --- head/contrib/bsnmp/snmpd/main.c Sun Mar 18 19:15:11 2012 (r233127) +++ head/contrib/bsnmp/snmpd/main.c Sun Mar 18 19:28:52 2012 (r233128) @@ -2703,7 +2703,7 @@ bsnmpd_get_usm_stats(void) void bsnmpd_reset_usm_stats(void) { - memset(snmpd_usmstats, 0, sizeof(snmpd_usmstats)); + memset(snmpd_usmstats, 0, sizeof(snmpd_usmstats)); } struct usm_user * ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r218225 - head/contrib/bsnmp
Author: harti Date: Thu Feb 3 15:19:18 2011 New Revision: 218225 URL: http://svn.freebsd.org/changeset/base/218225 Log: Bring the list of OIDs up-to-date to prevent conflicts. Modified: head/contrib/bsnmp/oid-list Modified: head/contrib/bsnmp/oid-list == --- head/contrib/bsnmp/oid-list Thu Feb 3 15:13:15 2011(r218224) +++ head/contrib/bsnmp/oid-list Thu Feb 3 15:19:18 2011(r218225) @@ -1,4 +1,4 @@ -$Begemot: bsnmp/oid-list,v 1.5 2006/02/27 09:55:45 brandt_h Exp $ +$Begemot: bsnmp/trunk/oid-list 1512 2011-02-03 15:16:22Z brandt_h $ This file documents the OID assignments under BSNMP's private OID. @@ -12,12 +12,30 @@ enterprises 1BEGEMOT-SNMPD 2BEGEMOT-NETGRAPHsnmpd netgraph module 3BEGEMOT-IP snmpd IP related stuff. + 4BEGEMOT-IFACE-MIB interface MIB private stuff + 5BEGEMOT-IPSTATS-MIB IP statistics + 6BEGEMOT-IP-MIB IP objects 100 BEGEMOT-ILMID snmpd ILMID module 101 BEGEMOT-ATM snmpd ATM module 200 BEGEMOT-PF snmpd PF module (phil...@freebsd.org) 201 BEGEMOT-NTP snmpd NTP module 202 BEGEMOT-HOSTRES snmpd HOSTRES module private stuff + 203 regexData bsnmp-regex (Nate Nielsen niel...@memberwebs.com) + 204 pingDatabsnmp-ping (Nate Nielsen niel...@memberwebs.com) + 205 begemotBridge bridge module + 210 begemotWlan WLAN module + 300 BEGEMOT-ACM DLR ACM project + 303 BEGEMOT-WLINK DLR WLINK simulator + 304 BEGEMOT-SATXDLR SatX simulator + + 405 mysql (vani...@fatpipi.com) + 406 varnish (vani...@fatpipi.com) + + 500 DLR-MOSAKA DLR Mosaka simulation platform + + bsnmp-jails per-jail network, cpu, disk, memory statistics (Stef Walter s...@memberwebs.com) + 1112 bsnmp-pcap monitor traffic for specific network flows (Stef Walter s...@memberwebs.com) If you need an OID and don't know where to stuck it in, I can assign you one - just drop me a mail. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org