Re: snmpd(8): Allow overlapping region from same backend

2022-08-29 Thread Theo Buehler
On Mon, Aug 29, 2022 at 07:39:35PM +0200, Martijn van Duren wrote:
> Right now we don't allow overlapping regions when the subtree flag is
> set, . However I don't see a reason why a single backend can't
> make an overlapping region with itself.
> 
> I would also like to use this feature when moving mib.c code into an
> libagentx based backend.
> 
> OK?

Sure, makes sense.

ok



snmpd(8): Allow overlapping region from same backend

2022-08-29 Thread Martijn van Duren
Right now we don't allow overlapping regions when the subtree flag is
set, . However I don't see a reason why a single backend can't
make an overlapping region with itself.

I would also like to use this feature when moving mib.c code into an
libagentx based backend.

OK?

martijn@

Index: application.c
===
RCS file: /cvs/src/usr.sbin/snmpd/application.c,v
retrieving revision 1.10
diff -u -p -r1.10 application.c
--- application.c   29 Aug 2022 13:25:18 -  1.10
+++ application.c   29 Aug 2022 17:39:15 -
@@ -223,12 +223,14 @@ appl_region(struct appl_context *ctx, ui
 * This allows us to keep control of certain regions like system.
 */
region = appl_region_find(ctx, oid);
-   if (region != NULL && region->ar_subtree)
+   if (region != NULL && region->ar_subtree &&
+   region->ar_backend != backend)
goto overlap;
 
search.ar_oid = *oid;
region = RB_NFIND(appl_regions, &(ctx->ac_regions), );
-   if (region != NULL && region->ar_subtree && (
+   if (region != NULL && region->ar_subtree && 
+   region->ar_backend != backend && (
appl_region_cmp(, region) == 0 ||
appl_region_cmp(, region) == -2))
goto overlap;