php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80661 Add string output format function for SNMP
Submitted: 2021-01-22 18:26 UTC Modified: 2022-02-15 00:46 UTC
From: thewitness at cacti dot net Assigned:
Status: Open Package: SNMP related
PHP Version: Next minor version OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thewitness at cacti dot net
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2021-01-22 18:26 UTC] thewitness at cacti dot net
Description:
------------
The various native snmp commands for some time have supported what is referred to as a string out put format of:

GUESS
ASCII
HEX

However, the current php-snmp implementation can not take advantage of those directives when performing a walk or a get of a variable.

Test script:
---------------
N/A


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-22 18:28 UTC] thewitness at cacti dot net
I've got the fix building on PHP-8 branch.  It's to add a new function:

snmp_string_output_format(blah);

Do you want a patch, or a pull request?  If so, from what branch?
 [2021-01-22 21:59 UTC] girgias@php.net
-Summary: php-snmp lacks a string output format function +Summary: Add string output format function for SNMP -Type: Bug +Type: Feature/Change Request -Operating System: All +Operating System: -PHP Version: 8.0.1 +PHP Version: Next minor version
 [2021-01-22 21:59 UTC] girgias@php.net
As this is a new feature this can only be added in PHP 8.1.0.

Please provide a PR to the master branch of php-src on GitHub.
It might also need an RFC depending on the scope.
 [2021-01-23 22:23 UTC] thewitness at cacti dot net
For some reason on the master branch and stock source, when I run ./configure --with-snmp, I'm getting errors.  I was able to compile just fine on PHP-7.3.26 with my changes though.

I had had to slightly modify the source for 7.3.26 due to some changes, making changes to php-snmp with the stock master as the basis, with --with-snmp is failing.  My guess is that there have been a bunch of type definition changes that have not been migrated to 'master'.  There's been a lot of changes between releases, so I'll track the commits and wait for some upstream fixes before doing a pull.
 [2021-01-23 22:34 UTC] thewitness at cacti dot net
Here is what I get with stock master:

[root@vmhost3 php-src-master]# make
/bin/sh /root/php-src-master/libtool --silent --preserve-dup-deps --mode=compile cc -std=gnu99 -Iext/snmp/ -I/root/php-src-master/ext/snmp/ -I/root/php-src-master/include -I/root/php-src-master/main -I/root/php-src-master -I/root/php-src-master/ext/date/lib -I/usr/include/libxml2 -I/root/php-src-master/TSRM -I/root/php-src-master/Zend    -fno-common -Wlogical-op -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare -g -O2 -fvisibility=hidden -DZEND_SIGNALS    -c /root/php-src-master/ext/snmp/snmp.c -o ext/snmp/snmp.lo
In file included from /root/php-src-master/main/php.h:35:0,
                 from /root/php-src-master/ext/snmp/snmp.c:26:
/root/php-src-master/Zend/zend_API.h:77:88: error: expected expression before ‘,’ token
 #define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags)   { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                        ^
/root/php-src-master/Zend/zend_API.h:83:38: note: in expansion of macro ‘ZEND_RAW_FENTRY’
 #define ZEND_FE(name, arg_info)      ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0)
                                      ^
/root/php-src-master/ext/snmp/snmp_arginfo.h:217:2: note: in expansion of macro ‘ZEND_FE’
  ZEND_FE(snmp_set_string_output_format, arginfo_snmp_set_string_output_format)
  ^
/root/php-src-master/Zend/zend_API.h:77:88: warning: missing initializer for field ‘arg_info’ of ‘zend_function_entry’ [-Wmissing-field-initializers]
 #define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags)   { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                        ^
/root/php-src-master/Zend/zend_API.h:83:38: note: in expansion of macro ‘ZEND_RAW_FENTRY’
 #define ZEND_FE(name, arg_info)      ZEND_RAW_FENTRY(#name, zif_##name, arg_info, 0)
                                      ^
/root/php-src-master/ext/snmp/snmp_arginfo.h:217:2: note: in expansion of macro ‘ZEND_FE’
  ZEND_FE(snmp_set_string_output_format, arginfo_snmp_set_string_output_format)
  ^
In file included from /root/php-src-master/main/php.h:35:0,
                 from /root/php-src-master/ext/snmp/snmp.c:26:
/root/php-src-master/Zend/zend_API.h:38:40: note: ‘arg_info’ declared here
  const struct _zend_internal_arg_info *arg_info;
                                        ^
cc1: warning: unrecognized command line option "-Wno-implicit-fallthrough" [enabled by default]
make: *** [ext/snmp/snmp.lo] Error 1
 [2021-01-24 01:09 UTC] thewitness at cacti dot net
Okay, getting a hang of the code now.
 [2021-01-24 02:46 UTC] thewitness at cacti dot net
Pull request is here.  Passed testing it looks.

https://github.com/php/php-src/pull/6633
 [2021-08-18 10:39 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #80661: Add string output format function for SNMP
On GitHub:  https://github.com/php/php-src/pull/6633
Patch:      https://github.com/php/php-src/pull/6633.patch
 [2022-02-15 00:46 UTC] requinix@php.net
-Block user comment: No +Block user comment: Yes
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC