This means that AgentX can be configured to use tcp:127.0.0.1:705 (for
example). Since we are running in a chroot, we cannot use hostnames.
Any network socket should work. Unix sockets should work as before
(using privilege separation).
};
void
-agent_init(struct lldpd *cfg, int debug)
+agent_init(struct lldpd *cfg, char *agentx, int debug)
{
int rc;
#ifdef HAVE___PROGNAME
/* We provide our UNIX domain transport */
agent_priv_register_domain();
+ if (agentx)
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET, agentx);
init_agent("lldpAgent");
REGISTER_MIB("lldp", lldp_vars, variable8, lldp_oid);
init_snmp("lldpAgent");
int ch, debug = 0;
#ifdef USE_SNMP
int snmp = 0;
+ char *agentx = NULL; /* AgentX socket */
#endif
char *mgmtp = NULL;
char *popt, opts[] =
#ifdef ENABLE_LISTENVLAN
"v"
#endif
- "kdxm:p:M:i@ ";
+ "kdxX:m:p:M:i@ ";
int i, found, advertise_version = 1;
#ifdef ENABLE_LISTENVLAN
int vlan = 0;
usage();
break;
#endif
- case 'x':
#ifdef USE_SNMP
+ case 'x':
+ snmp = 1;
+ break;
+ case 'X':
snmp = 1;
+ agentx = optarg;
+ break;
#else
+ case 'x':
+ case 'X':
fprintf(stderr, "SNMP support is not built-in\n");
usage();
#endif
#ifdef USE_SNMP
if (snmp) {
cfg->g_snmp = 1;
- agent_init(cfg, debug);
+ agent_init(cfg, agentx, debug);
}
#endif /* USE_SNMP */
/* agent.c */
void agent_shutdown(void);
-void agent_init(struct lldpd *, int);
+void agent_init(struct lldpd *, char *, int);
/* agent_priv.c */
void agent_priv_register_domain(void);