ndd commands using function calls


 
Thread Tools Search this Thread
Top Forums Programming ndd commands using function calls
# 1  
Old 09-06-2002
ndd commands using function calls

Hi,

Is there any function calls available ( for using in a C program ) to get the Ethernet Link status. ?

I am looking for the status available from

ndd /dev/hme link_status

And how about plumbing and configuring an interface using C program ?


BTW, Is all this documented anywere ?

Thanks in Advance ...
# 2  
Old 09-06-2002
All of this stuff is currently done via c programs so you know it's possible. You can use a program like truss to reverse engineer the operation of those programs.

But you shouldn't do this. For example, the SunOS man page for ndd states: "The ioctl() command that ndd uses to communicate with drivers is likely to change in a future release. User programs should avoid making dependencies on it." And that's the problem when you use undocumented interfaces. Sun will keep the driver and the ndd program in sync as changes are made and you are out of the loop.

The right move in a case like this is to just use popen() to run the ndd program and then read and parse the output.
# 3  
Old 09-07-2002
Hi,

Thanks for the reply.
# 4  
Old 03-17-2009
ndd

Actually you can write a litle bash script to get all the informations you require:

all the commands below, just assemble them to do anything you need:

#To find which driver, interfaces you have:
<ifconfig -a>

Here are some NIC drivers userd by Solaris (just in case)
# hme - Sun Fast-Ethernet device driver
# qfe - Sun qfe Quad Fast-Ethernet device driver
# eri - Fast-Ethernet device driver
# fjqe - Fujitsu PCI Quad 10/100 Ethernet
# fjgi - Fujitsu PCI Gigabit Ethernet
# e1000g - Gigabit Ethernet driver Intel PRO/1000
# bge - Gigabit Ethernet driver for Broadcom BCM57xx
# nxge - Sun 10/1 Gigabit Ethernet network driver
# ce - Cassini Gigabit-Ethernet device driver

#Check the which instance of NIC port we are connecting to:

ndd -get /dev/interface instance

#Check status:
ndd -get /dev/interface link_status (0=down, 1=up)

#Check link mode:
ndd -get /dev/interface link_mode (0=half-duplex, 1=full-duplex)

#Check link speed :
ndd -get /dev/interface link_speed (0=10mbs, 1=100mbs)

#Check autonegotiation capabilities:
ndd -get /dev/interface adv_autoneg_cap (0=false, 1=true)

#Set autonegotiation:
ndd -set /dev/intergace adv_autoneg_cap 1 (set to true)

#Finding errors in dmesg
grep -i <interface> /var/adm/messages

Note: Those changes written with ndd -set, are not persisten, they will be lost at system reboot. But if you like to add them permanently, you may consider editing file /kernel/drv/<interface>.conf


Hope this helped Smilie
______________________
The power of Solaris cannot be experienced on an Intel machine!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Linkage of POSIX threads function calls

I wonder if someone knows what is the rationale behind linking function calls of the POSIX threads library at link-time vs. run-time. For example, if I create the following program: #include <pthread.h> void noop() { return; } int main() { pthread_self(); pthread_atfork(noop,... (1 Reply)
Discussion started by: jsimsa
1 Replies

2. Shell Programming and Scripting

How to achieve Parellelism for the function which has multiple cp commands

Hi, Here is my requirement. Currently, there is a function which gets called in a for loop 2 times. doCopy() { cp /src/a*.jar /target/ cp /src/b*.jar /target/ cp /src/c*.jar /target } Since it is called sequentially from the for loop, I was asked to make parellel copy to... (7 Replies)
Discussion started by: kgsrinivas
7 Replies

3. Shell Programming and Scripting

Question about Function calls

Hello everyone, here's my problem: I want to create two shell scripts. one of them should includes some functions, the other one just the function calls. Is this possible? Can i call a function which is placed in a scriptfile eg functions.sh out of another script eg call.sh? :confused: And if... (2 Replies)
Discussion started by: Sebi0815
2 Replies

4. UNIX for Advanced & Expert Users

Using Library Calls (3) as commands

My understanding is when you see a man page command with a (3), is that this is a library call such as XSetScreenSaver(3) .. Sometimes these "calls" seem to do exactly what I need from a command. is there a way to access these calls from the terminal and just run them like a normal binary? How... (1 Reply)
Discussion started by: glev2005
1 Replies

5. Solaris

ndd matters

Hi, I would like to know whether there is any config file that i can refer to for the result of 'ndd -get /dev/tcp tcp_time_wait_interval'? When i man 'ndd', there is one statement which is -> Each driver chooses which parameters to make visible using ndd. Does it answering my question above... (3 Replies)
Discussion started by: honmin
3 Replies

6. Programming

Tracing Function Calls in a program

Apart from writing debug and statements in constructors is there any way by which we can trace the function call stack at any depth? The issue that we always face is that when program crashes (Web Server running on Linux) we have no idea where it crashes and we have to do the hard way of... (1 Reply)
Discussion started by: uunniixx
1 Replies

7. Solaris

Questions related to ndd commands

Hello Gurus I would like to know more about ndd commands related to ethernet(NIC) like how to set link_status, link_speed & link_mode as I know how to check these value. And I also would like to know how to make these setting permanents after reboot as I know that these setting will vanish... (5 Replies)
Discussion started by: amity
5 Replies

8. IP Networking

Identification of data calls & voice calls

Is there any facility to filter/identify the data calls and voice calls coming throug modem? OR Can we get the data or voice calls information through a script(preferably C Kermit)? (0 Replies)
Discussion started by: pcsaji
0 Replies

9. Solaris

ndd help

Hi Guys, I need help with ndd. I was going through network FAQ but i have more questions then answers regarding ndd. #ndd -set /dev/hme instance 0 #ndd -set /dev/hme adv_100fdx_cap 1 #ndd -set /dev/hme adv_100hdx_cap 0 #ndd -set /dev/hme adv_10fdx_cap 0 #ndd -set /dev/hme adv_10hdx_cap 0... (2 Replies)
Discussion started by: nitinkgoud
2 Replies

10. AIX

overriding function calls without recompiling

i want to replace the *alloc and free function calls in an existing project with my own functions, to be able to log the adresses etc in a text file. (memoryleak debugging) I think LD_PRELOAD is what i am looking for. That way i could create a Library with my own malloc functions and link them... (1 Reply)
Discussion started by: Lazzar
1 Replies
Login or Register to Ask a Question