On Fri, 2020-06-05 at 14:20 +0100, Stuart Henderson wrote:
> On 2020/06/05 13:50, Denis Fondras wrote:
> > On Fri, Jun 05, 2020 at 12:56:21PM +0200, Prof. Dr. Steffen Wendzel wrote:
> > > Dear all:
> > > 
> > > just in case this appears useful to you: I found some redundant code
> > > lines in the following files.
> > > 
> > > sys/net/pipex.h:
> > >    struct pipex_session  *pipex_pppoe_lookup_session (struct mbuf *);
> > >    struct pipex_session  *pipex_pppoe_lookup_session (struct mbuf *);
> > > 
> > > usr.sbin/relayd/agentx.c
> > >    snmp_agentx_oid(pdu, oid) == -1 ||
> > >    snmp_agentx_oid(pdu, oid) == -1 ||
> > > 
> > > usr.sbin/snmpd/agentx.c:
> > >      snmp_agentx_oid(pdu, oid) == -1 ||
> > >      snmp_agentx_oid(pdu, oid) == -1 ||
> 
> My first thought for these two was "were they just accidentally
> duplicated, or was something else meant to be there instead". Looking at
> the commit and code (the function is identical in snmpd and relayd) I am
> going more on the side of accidental dup (plus removing it doesn't
> change behaviour of code that been running for a while) so OK with me.

It's definitely a duplicate. This is when an unregister-pdu is created,
which only contains a single OID. Ranges can be specified, that's done
via the range_index/range_bound combo, or as the RFC names them:
range_subid/upper_bound.

Since the unregister pdu is a client generated pdu it's by definition
not being called in snmpd(8). A quick grep in relayd shows that it's
also never called there.
> 
> > > usr.sbin/bgpd/rde.h:
> > >       void             path_init(u_int32_t);
> > >       void             path_init(u_int32_t);
> > > 
> > > lib/libcurses/nc_tparm.h:
> > > #define TPARM_1(a,b) TPARM_2(a,b,0)
> > > #define TPARM_1(a,b) TPARM_2(a,b,0)
> > > 
> > 
> > Nice catch, thank you.
> > 
> > 
> > Index: lib/libcurses/nc_tparm.h
> > ===================================================================
> > RCS file: /cvs/src/lib/libcurses/nc_tparm.h,v
> > retrieving revision 1.1
> > diff -u -p -r1.1 nc_tparm.h
> > --- lib/libcurses/nc_tparm.h        12 Jan 2010 23:21:59 -0000      1.1
> > +++ lib/libcurses/nc_tparm.h        5 Jun 2020 11:45:41 -0000
> > @@ -62,6 +62,5 @@
> >  #define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
> >  #define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
> >  #define TPARM_1(a,b) TPARM_2(a,b,0)
> > -#define TPARM_1(a,b) TPARM_2(a,b,0)
> >  #define TPARM_0(a) TPARM_1(a,0)
> >  #endif
> > Index: sys/net/pipex.h
> > ===================================================================
> > RCS file: /cvs/src/sys/net/pipex.h,v
> > retrieving revision 1.22
> > diff -u -p -r1.22 pipex.h
> > --- sys/net/pipex.h 26 May 2020 07:06:37 -0000      1.22
> > +++ sys/net/pipex.h 5 Jun 2020 11:45:44 -0000
> > @@ -206,7 +206,6 @@ int                   pipex_notify_close
> >  
> >  struct mbuf           *pipex_output (struct mbuf *, int, int, struct 
> > pipex_iface_context *);
> >  struct pipex_session  *pipex_pppoe_lookup_session (struct mbuf *);
> > -struct pipex_session  *pipex_pppoe_lookup_session (struct mbuf *);
> >  struct mbuf           *pipex_pppoe_input (struct mbuf *, struct 
> > pipex_session *);
> >  struct pipex_session  *pipex_pptp_lookup_session (struct mbuf *);
> >  struct mbuf           *pipex_pptp_input (struct mbuf *, struct 
> > pipex_session *);
> > Index: usr.sbin/bgpd/rde.h
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
> > retrieving revision 1.233
> > diff -u -p -r1.233 rde.h
> > --- usr.sbin/bgpd/rde.h     24 Jan 2020 05:44:05 -0000      1.233
> > +++ usr.sbin/bgpd/rde.h     5 Jun 2020 11:45:45 -0000
> > @@ -557,7 +557,6 @@ re_rib(struct rib_entry *re)
> >  }
> >  
> >  void                path_init(u_int32_t);
> > -void                path_init(u_int32_t);
> >  void                path_shutdown(void);
> >  void                path_hash_stats(struct rde_hashstats *);
> >  int                 path_compare(struct rde_aspath *, struct rde_aspath *);
> > Index: usr.sbin/relayd/agentx.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/relayd/agentx.c,v
> > retrieving revision 1.14
> > diff -u -p -r1.14 agentx.c
> > --- usr.sbin/relayd/agentx.c        28 May 2017 10:39:15 -0000      1.14
> > +++ usr.sbin/relayd/agentx.c        5 Jun 2020 11:45:45 -0000
> > @@ -654,7 +654,6 @@ snmp_agentx_unregister_pdu(struct snmp_o
> >  
> >     if (snmp_agentx_raw(pdu, &uhdr, sizeof(uhdr)) == -1 ||
> >         snmp_agentx_oid(pdu, oid) == -1 ||
> > -       snmp_agentx_oid(pdu, oid) == -1 ||
> >         (range_index && snmp_agentx_int(pdu, &range_bound) == -1)) {
> >             snmp_agentx_pdu_free(pdu);
> >             return (NULL);
> > Index: usr.sbin/snmpd/agentx.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/snmpd/agentx.c,v
> > retrieving revision 1.13
> > diff -u -p -r1.13 agentx.c
> > --- usr.sbin/snmpd/agentx.c 17 Jun 2018 18:19:59 -0000      1.13
> > +++ usr.sbin/snmpd/agentx.c 5 Jun 2020 11:45:45 -0000
> > @@ -658,7 +658,6 @@ snmp_agentx_unregister_pdu(struct snmp_o
> >  
> >     if (snmp_agentx_raw(pdu, &uhdr, sizeof(uhdr)) == -1 ||
> >         snmp_agentx_oid(pdu, oid) == -1 ||
> > -       snmp_agentx_oid(pdu, oid) == -1 ||
> >         (range_index && snmp_agentx_int(pdu, &range_bound) == -1)) {
> >             snmp_agentx_pdu_free(pdu);
> >             return (NULL);
> > 

Reply via email to