Hi, I have written a sample code to modify the link-local address of an Ethernet interface. The code snippet is – while(1) { printf("\n1.Add Link Local\n2.Modify LinkLocal\n”); scanf("%d", &ch); switch(ch) { case 1: { add_linklocaladdr(fd, NLM_F_CREATE|NLM_F_EXCL); break; } case 2: { add_linklocaladdr(fd, NLM_F_REPLACE); break; } ------------- ------------- void add_linklocaladdr(int fd, int flags)) { ------------- ------------- nlh = (struct nlmsghdr *)buf; len = MSG_ALIGN(sizeof(struct nlmsghdr)); nlh->nlmsg_len = len; nlh->nlmsg_type = RTM_NEWADDR; nlh->nlmsg_flags = NLM_F_REQUEST | flag; nlh->nlmsg_seq = 1; ifadr = nlmsg_put_extra_header(nlh, sizeof(struct ifaddrmsg)); ifadr->ifa_family = AF_INET6; ifadr->ifa_prefixlen = 0x40 ; /*hardcoded*/ ifadr->ifa_flags = IFA_F_PERMANENT;; ifadr->ifa_scope = RT_SCOPE_HOST; ifadr->ifa_index = 2; /*Push ‘struct nlattr’ */ attr_put(nlh, IFA_ADDRESS, dst); When I execute case 1 (add link-local), a new ipv6 ip is getting added. I want to modify an existing link local address in case2, but it’s not working. Can anybody help me correcting this code for case2. Thanks & Regards Murali Annamneni
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. ---------------------------------------------------------------------------------------------------------------------------------------------------- |
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies